[096c8835] | 1 | /*
|
---|
| 2 | * Copyright (c) 2011 Maurizio Lombardi
|
---|
| 3 | * All rights reserved.
|
---|
| 4 | *
|
---|
| 5 | * Redistribution and use in source and binary forms, with or without
|
---|
| 6 | * modification, are permitted provided that the following conditions
|
---|
| 7 | * are met:
|
---|
| 8 | *
|
---|
| 9 | * - Redistributions of source code must retain the above copyright
|
---|
| 10 | * notice, this list of conditions and the following disclaimer.
|
---|
| 11 | * - Redistributions in binary form must reproduce the above copyright
|
---|
| 12 | * notice, this list of conditions and the following disclaimer in the
|
---|
| 13 | * documentation and/or other materials provided with the distribution.
|
---|
| 14 | * - The name of the author may not be used to endorse or promote products
|
---|
| 15 | * derived from this software without specific prior written permission.
|
---|
| 16 | *
|
---|
| 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
---|
| 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
---|
| 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
---|
| 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
---|
| 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
---|
| 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
---|
| 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
---|
| 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
---|
| 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
---|
| 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
---|
| 27 | */
|
---|
| 28 |
|
---|
| 29 | /** @addtogroup fs
|
---|
| 30 | * @{
|
---|
| 31 | */
|
---|
| 32 |
|
---|
| 33 | #include "mfs_super.h"
|
---|
| 34 |
|
---|
| 35 | void mfs_mounted(ipc_callid_t rid, ipc_call_t *request)
|
---|
| 36 | {
|
---|
| 37 | devmap_handle_t devmap_handle = (devmap_handle_t) IPC_GET_ARG1(*request);
|
---|
| 38 | enum cache_mode cmode;
|
---|
| 39 | struct mfs_superblock *sp;
|
---|
| 40 |
|
---|
| 41 | /* Accept the mount options */
|
---|
| 42 | char *opts;
|
---|
| 43 | int rc = async_data_write_accept((void **) &opts, true, 0, 0, 0, NULL);
|
---|
| 44 |
|
---|
| 45 | if (rc != EOK) {
|
---|
| 46 | async_answer_0(rid, rc);
|
---|
| 47 | return;
|
---|
| 48 | }
|
---|
| 49 |
|
---|
| 50 | /* Check for option enabling write through. */
|
---|
| 51 | if (str_cmp(opts, "wtcache") == 0)
|
---|
| 52 | cmode = CACHE_MODE_WT;
|
---|
| 53 | else
|
---|
| 54 | cmode = CACHE_MODE_WB;
|
---|
| 55 |
|
---|
| 56 | free(opts);
|
---|
| 57 |
|
---|
| 58 | /* initialize libblock */
|
---|
| 59 | rc = block_init(devmap_handle, MFS_SUPER_BLOCK_SIZE);
|
---|
| 60 | if (rc != EOK) {
|
---|
| 61 | async_answer_0(rid, rc);
|
---|
| 62 | return;
|
---|
| 63 | }
|
---|
| 64 |
|
---|
| 65 | /* prepare the superblock */
|
---|
| 66 | rc = block_bb_read(devmap_handle, MFS_SUPER_BLOCK);
|
---|
| 67 | if (rc != EOK) {
|
---|
| 68 | block_fini(devmap_handle);
|
---|
| 69 | async_answer_0(rid, rc);
|
---|
| 70 | return;
|
---|
| 71 | }
|
---|
| 72 |
|
---|
| 73 | /* get the buffer with the superblock */
|
---|
| 74 | sp = block_bb_get(devmap_handle);
|
---|
| 75 | }
|
---|
| 76 |
|
---|
| 77 |
|
---|
| 78 | /**
|
---|
| 79 | * @}
|
---|
| 80 | */
|
---|
| 81 |
|
---|