Changeset 44c0f5b in mainline
- Timestamp:
- 2011-03-18T19:44:55Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- fe4ac35
- Parents:
- 8b86ed26
- Location:
- uspace/srv/fs/minixfs
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/minixfs/mfs.h
r8b86ed26 r44c0f5b 104 104 extern bool mfs_is_file(fs_node_t *fsnode); 105 105 extern devmap_handle_t mfs_device_get(fs_node_t *fsnode); 106 extern int mfs_get_instance(devmap_handle_t handle,106 extern int mfs_instance_get(devmap_handle_t handle, 107 107 struct mfs_instance **instance); 108 int mfs_node_get(fs_node_t **rfn, devmap_handle_t devmap_handle, 109 fs_index_t index); 108 110 109 111 /*mfs_inode.c*/ -
uspace/srv/fs/minixfs/mfs_ops.c
r8b86ed26 r44c0f5b 40 40 static bool check_magic_number(uint16_t magic, bool *native, 41 41 mfs_version_t *version, bool *longfilenames); 42 static int mfs_node_core_get(fs_node_t **rfn, struct mfs_instance *inst, 43 fs_index_t index); 42 44 43 45 static LIST_INITIALIZE(inst_list); … … 47 49 .device_get = mfs_device_get, 48 50 .is_directory = mfs_is_directory, 49 .is_file = mfs_is_file 51 .is_file = mfs_is_file, 52 .node_get = mfs_node_get 50 53 }; 51 54 … … 204 207 } 205 208 209 int mfs_node_get(fs_node_t **rfn, devmap_handle_t devmap_handle, 210 fs_index_t index) 211 { 212 int rc; 213 struct mfs_instance *instance; 214 215 rc = mfs_instance_get(devmap_handle, &instance); 216 217 if (rc != EOK) 218 return rc; 219 220 return mfs_node_core_get(rfn, instance, index); 221 } 222 223 static int mfs_node_core_get(fs_node_t **rfn, struct mfs_instance *inst, 224 fs_index_t index) 225 { 226 fs_node_t *node = NULL; 227 struct mfs_node *mnode = NULL; 228 int rc; 229 230 const struct mfs_sb_info *sbi = inst->sbi; 231 232 node = (fs_node_t *) malloc(sizeof(fs_node_t)); 233 if (!node) { 234 rc = ENOMEM; 235 goto out_err; 236 } 237 238 fs_node_initialize(node); 239 240 mnode = (struct mfs_node *) malloc(sizeof(struct mfs_node)); 241 if (!mnode) { 242 rc = ENOMEM; 243 goto out_err; 244 } 245 246 if (sbi->fs_version == MFS_VERSION_V1) { 247 /*Read MFS V1 inode*/ 248 struct mfs_inode *ino; 249 250 ino = mfs_read_inode_raw(inst, index); 251 mnode->ino = ino; 252 } else { 253 /*Read MFS V2/V3 inode*/ 254 struct mfs2_inode *ino2; 255 256 ino2 = mfs2_read_inode_raw(inst, index); 257 mnode->ino2 = ino2; 258 } 259 260 mnode->instance = inst; 261 node->data = mnode; 262 *rfn = node; 263 264 return EOK; 265 266 out_err: 267 if (node) 268 free(node); 269 if (mnode) 270 free(mnode); 271 return rc; 272 } 273 206 274 bool mfs_is_directory(fs_node_t *fsnode) 207 275 { 208 struct mfs_node *node = fsnode->data;209 struct mfs_sb_info *sbi = node->instance->sbi;276 const struct mfs_node *node = fsnode->data; 277 const struct mfs_sb_info *sbi = node->instance->sbi; 210 278 211 279 if (sbi->fs_version == MFS_VERSION_V1) … … 229 297 * Find a filesystem instance given the devmap handle 230 298 */ 231 int mfs_ get_instance(devmap_handle_t handle, struct mfs_instance **instance)299 int mfs_instance_get(devmap_handle_t handle, struct mfs_instance **instance) 232 300 { 233 301 link_t *link;
Note:
See TracChangeset
for help on using the changeset viewer.