Changeset 3b08178 in mainline
- Timestamp:
- 2011-03-17T15:22:22Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e54ba607
- Parents:
- 953a823
- Location:
- uspace/srv/fs/minixfs
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/minixfs/mfs.c
r953a823 r3b08178 38 38 */ 39 39 40 #define _MAIN 41 40 42 #include <ipc/services.h> 41 43 #include <ipc/ns.h> … … 45 47 #include <task.h> 46 48 #include <stdio.h> 47 #include <libfs.h>48 49 #include "mfs.h" 49 50 … … 55 56 .write_retains_size = false, 56 57 }; 57 58 fs_reg_t mfs_reg;59 60 58 61 59 … … 104 102 break; 105 103 case VFS_OUT_MOUNT: 106 mfs debug("Mounting...\n");104 mfs_mount(callid, &call); 107 105 break; 108 106 default: -
uspace/srv/fs/minixfs/mfs.h
r953a823 r3b08178 36 36 #include <minix.h> 37 37 #include <libblock.h> 38 #include <libfs.h> 38 39 #include <adt/list.h> 39 40 #include "../../vfs/vfs.h" … … 46 47 #define mfsdebug(...) 47 48 #endif 49 50 #ifdef _MAIN 51 #define GLOBAL 52 #else 53 #define GLOBAL extern 54 #endif 55 56 GLOBAL fs_reg_t mfs_reg; 48 57 49 58 typedef enum { … … 80 89 81 90 extern void mfs_mounted(ipc_callid_t rid, ipc_call_t *request); 91 extern void mfs_mount(ipc_callid_t rid, ipc_call_t *request); 92 extern int mfs_get_instance(devmap_handle_t handle, 93 struct mfs_instance **instance); 82 94 83 95 #endif -
uspace/srv/fs/minixfs/mfs_ops.c
r953a823 r3b08178 31 31 */ 32 32 33 #include <libfs.h>34 33 #include <stdio.h> 35 34 #include <stdlib.h> 36 #include <libblock.h>37 35 #include <fibril_synch.h> 38 36 #include <errno.h> 39 #include <adt/list.h>40 37 #include "mfs.h" 41 38 #include "mfs_utils.h" … … 47 44 static LIST_INITIALIZE(inst_list); 48 45 static FIBRIL_MUTEX_INITIALIZE(inst_list_mutex); 46 47 libfs_ops_t mfs_libfs_ops; 49 48 50 49 void mfs_mounted(ipc_callid_t rid, ipc_call_t *request) … … 161 160 sbi->max_file_size = conv32(native, sb->s_max_file_size); 162 161 sbi->nzones = conv16(native, sb->s_nzones); 162 sbi->block_size = MFS_BLOCKSIZE; 163 163 if (version == MFS_VERSION_V2) 164 164 sbi->nzones = conv32(native, sb->s_nzones2); … … 166 166 167 167 free(sb); 168 169 rc = block_cache_init(devmap_handle, sbi->block_size, 0, CACHE_MODE_WT); 170 171 if (rc != EOK) { 172 block_fini(devmap_handle); 173 async_answer_0(rid, EINVAL); 174 mfsdebug("block cache initialization failed\n"); 175 return; 176 } 168 177 169 178 /*Initialize the instance structure and add it to the list*/ … … 181 190 } 182 191 192 void mfs_mount(ipc_callid_t rid, ipc_call_t *request) 193 { 194 libfs_mount(&mfs_libfs_ops, mfs_reg.fs_handle, rid, request); 195 } 196 197 /* 198 * Find a filesystem instance given the devmap handle 199 */ 200 int mfs_get_instance(devmap_handle_t handle, struct mfs_instance **instance) 201 { 202 link_t *link; 203 struct mfs_instance *instance_ptr; 204 205 fibril_mutex_lock(&inst_list_mutex); 206 207 for (link = inst_list.next; link != &inst_list; link = link->next) { 208 instance_ptr = list_get_instance(link, struct mfs_instance, link); 209 210 if (instance_ptr->handle == handle) { 211 *instance = instance_ptr; 212 fibril_mutex_unlock(&inst_list_mutex); 213 return EOK; 214 } 215 } 216 217 mfsdebug("Instance not found\n"); 218 219 fibril_mutex_unlock(&inst_list_mutex); 220 return EINVAL; 221 } 222 183 223 static bool check_magic_number(uint16_t magic, bool *native, 184 224 mfs_version_t *version, bool *longfilenames) … … 213 253 } 214 254 215 216 255 /** 217 256 * @}
Note:
See TracChangeset
for help on using the changeset viewer.