Changeset 15f3c3f in mainline for uspace/srv/fs/ext2fs/ext2fs_ops.c
- Timestamp:
- 2011-06-22T22:00:52Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 86ffa27f
- Parents:
- ef09a7a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/ext2fs/ext2fs_ops.c
ref09a7a r15f3c3f 43 43 #include <libext2.h> 44 44 #include <ipc/services.h> 45 #include <ipc/ devmap.h>45 #include <ipc/loc.h> 46 46 #include <macros.h> 47 47 #include <async.h> … … 70 70 typedef struct ext2fs_instance { 71 71 link_t link; 72 devmap_handle_t devmap_handle;72 service_id_t service_id; 73 73 ext2_filesystem_t *filesystem; 74 74 unsigned int open_nodes_count; … … 86 86 * Forward declarations of auxiliary functions 87 87 */ 88 static int ext2fs_instance_get( devmap_handle_t, ext2fs_instance_t **);88 static int ext2fs_instance_get(service_id_t, ext2fs_instance_t **); 89 89 static void ext2fs_read_directory(ipc_callid_t, ipc_callid_t, aoff64_t, 90 90 size_t, ext2fs_instance_t *, ext2_inode_ref_t *); … … 98 98 * Forward declarations of EXT2 libfs operations. 99 99 */ 100 static int ext2fs_root_get(fs_node_t **, devmap_handle_t);100 static int ext2fs_root_get(fs_node_t **, service_id_t); 101 101 static int ext2fs_match(fs_node_t **, fs_node_t *, const char *); 102 static int ext2fs_node_get(fs_node_t **, devmap_handle_t, fs_index_t);102 static int ext2fs_node_get(fs_node_t **, service_id_t, fs_index_t); 103 103 static int ext2fs_node_open(fs_node_t *); 104 104 static int ext2fs_node_put(fs_node_t *); 105 static int ext2fs_create_node(fs_node_t **, devmap_handle_t, int);105 static int ext2fs_create_node(fs_node_t **, service_id_t, int); 106 106 static int ext2fs_destroy_node(fs_node_t *); 107 107 static int ext2fs_link(fs_node_t *, fs_node_t *, const char *); … … 114 114 static bool ext2fs_is_directory(fs_node_t *); 115 115 static bool ext2fs_is_file(fs_node_t *node); 116 static devmap_handle_t ext2fs_device_get(fs_node_t *node);116 static service_id_t ext2fs_device_get(fs_node_t *node); 117 117 118 118 /* … … 136 136 ext2fs_node_t *enode = hash_table_get_instance(item, ext2fs_node_t, link); 137 137 assert(keys > 0); 138 if (enode->instance-> devmap_handle!=139 (( devmap_handle_t) key[OPEN_NODES_DEV_HANDLE_KEY])) {138 if (enode->instance->service_id != 139 ((service_id_t) key[OPEN_NODES_DEV_HANDLE_KEY])) { 140 140 return false; 141 141 } … … 182 182 183 183 /** 184 * Find an instance of filesystem for the given devmap_handle184 * Find an instance of filesystem for the given service_id 185 185 */ 186 int ext2fs_instance_get( devmap_handle_t devmap_handle, ext2fs_instance_t **inst)187 { 188 EXT2FS_DBG("(%" PRIun ", -)", devmap_handle);186 int ext2fs_instance_get(service_id_t service_id, ext2fs_instance_t **inst) 187 { 188 EXT2FS_DBG("(%" PRIun ", -)", service_id); 189 189 ext2fs_instance_t *tmp; 190 190 … … 200 200 tmp = list_get_instance(link, ext2fs_instance_t, link); 201 201 202 if (tmp-> devmap_handle == devmap_handle) {202 if (tmp->service_id == service_id) { 203 203 *inst = tmp; 204 204 fibril_mutex_unlock(&instance_list_mutex); … … 215 215 216 216 217 int ext2fs_root_get(fs_node_t **rfn, devmap_handle_t devmap_handle)218 { 219 EXT2FS_DBG("(-, %" PRIun ")", devmap_handle);220 return ext2fs_node_get(rfn, devmap_handle, EXT2_INODE_ROOT_INDEX);217 int ext2fs_root_get(fs_node_t **rfn, service_id_t service_id) 218 { 219 EXT2FS_DBG("(-, %" PRIun ")", service_id); 220 return ext2fs_node_get(rfn, service_id, EXT2_INODE_ROOT_INDEX); 221 221 } 222 222 … … 291 291 292 292 /** Instantiate a EXT2 in-core node. */ 293 int ext2fs_node_get(fs_node_t **rfn, devmap_handle_t devmap_handle, fs_index_t index)294 { 295 EXT2FS_DBG("(-,%" PRIun ",%u)", devmap_handle, index);293 int ext2fs_node_get(fs_node_t **rfn, service_id_t service_id, fs_index_t index) 294 { 295 EXT2FS_DBG("(-,%" PRIun ",%u)", service_id, index); 296 296 297 297 ext2fs_instance_t *inst = NULL; 298 298 int rc; 299 299 300 rc = ext2fs_instance_get( devmap_handle, &inst);300 rc = ext2fs_instance_get(service_id, &inst); 301 301 if (rc != EOK) { 302 302 return rc; … … 319 319 /* Check if the node is not already open */ 320 320 unsigned long key[] = { 321 [OPEN_NODES_DEV_HANDLE_KEY] = inst-> devmap_handle,321 [OPEN_NODES_DEV_HANDLE_KEY] = inst->service_id, 322 322 [OPEN_NODES_INODE_KEY] = index, 323 323 }; … … 413 413 414 414 unsigned long key[] = { 415 [OPEN_NODES_DEV_HANDLE_KEY] = enode->instance-> devmap_handle,415 [OPEN_NODES_DEV_HANDLE_KEY] = enode->instance->service_id, 416 416 [OPEN_NODES_INODE_KEY] = enode->inode_ref->index, 417 417 }; … … 431 431 } 432 432 433 int ext2fs_create_node(fs_node_t **rfn, devmap_handle_t devmap_handle, int flags)433 int ext2fs_create_node(fs_node_t **rfn, service_id_t service_id, int flags) 434 434 { 435 435 EXT2FS_DBG(""); … … 564 564 } 565 565 566 devmap_handle_t ext2fs_device_get(fs_node_t *fn)566 service_id_t ext2fs_device_get(fs_node_t *fn) 567 567 { 568 568 EXT2FS_DBG(""); 569 569 ext2fs_node_t *enode = EXT2FS_NODE(fn); 570 return enode->instance-> devmap_handle;570 return enode->instance->service_id; 571 571 } 572 572 … … 600 600 EXT2FS_DBG(""); 601 601 int rc; 602 devmap_handle_t devmap_handle = (devmap_handle_t) IPC_GET_ARG1(*request);602 service_id_t service_id = (service_id_t) IPC_GET_ARG1(*request); 603 603 ext2_filesystem_t *fs; 604 604 ext2fs_instance_t *inst; … … 632 632 633 633 /* Initialize the filesystem */ 634 rc = ext2_filesystem_init(fs, devmap_handle);634 rc = ext2_filesystem_init(fs, service_id); 635 635 if (rc != EOK) { 636 636 free(fs); … … 662 662 /* Initialize instance */ 663 663 link_initialize(&inst->link); 664 inst-> devmap_handle = devmap_handle;664 inst->service_id = service_id; 665 665 inst->filesystem = fs; 666 666 inst->open_nodes_count = 0; … … 700 700 { 701 701 EXT2FS_DBG(""); 702 devmap_handle_t devmap_handle = (devmap_handle_t) IPC_GET_ARG1(*request);702 service_id_t service_id = (service_id_t) IPC_GET_ARG1(*request); 703 703 ext2fs_instance_t *inst; 704 704 int rc; 705 705 706 rc = ext2fs_instance_get( devmap_handle, &inst);706 rc = ext2fs_instance_get(service_id, &inst); 707 707 708 708 if (rc != EOK) { … … 747 747 { 748 748 EXT2FS_DBG(""); 749 devmap_handle_t devmap_handle = (devmap_handle_t) IPC_GET_ARG1(*request);749 service_id_t service_id = (service_id_t) IPC_GET_ARG1(*request); 750 750 fs_index_t index = (fs_index_t) IPC_GET_ARG2(*request); 751 751 aoff64_t pos = … … 767 767 } 768 768 769 rc = ext2fs_instance_get( devmap_handle, &inst);769 rc = ext2fs_instance_get(service_id, &inst); 770 770 if (rc != EOK) { 771 771 async_answer_0(callid, rc); … … 965 965 966 966 /* Usual case - we need to read a block from device */ 967 rc = block_get(&block, inst-> devmap_handle, fs_block, BLOCK_FLAGS_NONE);967 rc = block_get(&block, inst->service_id, fs_block, BLOCK_FLAGS_NONE); 968 968 if (rc != EOK) { 969 969 async_answer_0(callid, rc); … … 987 987 { 988 988 EXT2FS_DBG(""); 989 // devmap_handle_t devmap_handle = (devmap_handle_t) IPC_GET_ARG1(*request);989 // service_id_t service_id = (service_id_t) IPC_GET_ARG1(*request); 990 990 // fs_index_t index = (fs_index_t) IPC_GET_ARG2(*request); 991 991 // aoff64_t pos = … … 999 999 { 1000 1000 EXT2FS_DBG(""); 1001 // devmap_handle_t devmap_handle = (devmap_handle_t) IPC_GET_ARG1(*request);1001 // service_id_t service_id = (service_id_t) IPC_GET_ARG1(*request); 1002 1002 // fs_index_t index = (fs_index_t) IPC_GET_ARG2(*request); 1003 1003 // aoff64_t size = … … 1017 1017 { 1018 1018 EXT2FS_DBG(""); 1019 // devmap_handle_t devmap_handle = (devmap_handle_t)IPC_GET_ARG1(*request);1019 // service_id_t service_id = (service_id_t)IPC_GET_ARG1(*request); 1020 1020 // fs_index_t index = (fs_index_t)IPC_GET_ARG2(*request); 1021 1021 … … 1039 1039 { 1040 1040 EXT2FS_DBG(""); 1041 // devmap_handle_t devmap_handle = (devmap_handle_t) IPC_GET_ARG1(*request);1041 // service_id_t service_id = (service_id_t) IPC_GET_ARG1(*request); 1042 1042 // fs_index_t index = (fs_index_t) IPC_GET_ARG2(*request); 1043 1043
Note:
See TracChangeset
for help on using the changeset viewer.