Changes in uspace/srv/fs/ext2fs/ext2fs_ops.c [efcebe1:b33870b] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/ext2fs/ext2fs_ops.c
refcebe1 rb33870b 42 42 #include <libext2.h> 43 43 #include <ipc/services.h> 44 #include <ipc/ devmap.h>44 #include <ipc/loc.h> 45 45 #include <macros.h> 46 46 #include <async.h> … … 69 69 typedef struct ext2fs_instance { 70 70 link_t link; 71 devmap_handle_t devmap_handle;71 service_id_t service_id; 72 72 ext2_filesystem_t *filesystem; 73 73 unsigned int open_nodes_count; … … 85 85 * Forward declarations of auxiliary functions 86 86 */ 87 static int ext2fs_instance_get( devmap_handle_t, ext2fs_instance_t **);87 static int ext2fs_instance_get(service_id_t, ext2fs_instance_t **); 88 88 static int ext2fs_read_directory(ipc_callid_t, aoff64_t, size_t, 89 89 ext2fs_instance_t *, ext2_inode_ref_t *, size_t *); … … 97 97 * Forward declarations of EXT2 libfs operations. 98 98 */ 99 static int ext2fs_root_get(fs_node_t **, devmap_handle_t);99 static int ext2fs_root_get(fs_node_t **, service_id_t); 100 100 static int ext2fs_match(fs_node_t **, fs_node_t *, const char *); 101 static int ext2fs_node_get(fs_node_t **, devmap_handle_t, fs_index_t);101 static int ext2fs_node_get(fs_node_t **, service_id_t, fs_index_t); 102 102 static int ext2fs_node_open(fs_node_t *); 103 103 static int ext2fs_node_put(fs_node_t *); 104 static int ext2fs_create_node(fs_node_t **, devmap_handle_t, int);104 static int ext2fs_create_node(fs_node_t **, service_id_t, int); 105 105 static int ext2fs_destroy_node(fs_node_t *); 106 106 static int ext2fs_link(fs_node_t *, fs_node_t *, const char *); … … 112 112 static bool ext2fs_is_directory(fs_node_t *); 113 113 static bool ext2fs_is_file(fs_node_t *node); 114 static devmap_handle_t ext2fs_device_get(fs_node_t *node);114 static service_id_t ext2fs_service_get(fs_node_t *node); 115 115 116 116 /* … … 134 134 ext2fs_node_t *enode = hash_table_get_instance(item, ext2fs_node_t, link); 135 135 assert(keys > 0); 136 if (enode->instance-> devmap_handle!=137 (( devmap_handle_t) key[OPEN_NODES_DEV_HANDLE_KEY])) {136 if (enode->instance->service_id != 137 ((service_id_t) key[OPEN_NODES_DEV_HANDLE_KEY])) { 138 138 return false; 139 139 } … … 180 180 181 181 /** 182 * Find an instance of filesystem for the given devmap_handle183 */ 184 int ext2fs_instance_get( devmap_handle_t devmap_handle, ext2fs_instance_t **inst)185 { 186 EXT2FS_DBG("(%" PRIun ", -)", devmap_handle);182 * Find an instance of filesystem for the given service_id 183 */ 184 int ext2fs_instance_get(service_id_t service_id, ext2fs_instance_t **inst) 185 { 186 EXT2FS_DBG("(%" PRIun ", -)", service_id); 187 187 ext2fs_instance_t *tmp; 188 188 … … 198 198 tmp = list_get_instance(link, ext2fs_instance_t, link); 199 199 200 if (tmp-> devmap_handle == devmap_handle) {200 if (tmp->service_id == service_id) { 201 201 *inst = tmp; 202 202 fibril_mutex_unlock(&instance_list_mutex); … … 213 213 214 214 215 int ext2fs_root_get(fs_node_t **rfn, devmap_handle_t devmap_handle)216 { 217 EXT2FS_DBG("(-, %" PRIun ")", devmap_handle);218 return ext2fs_node_get(rfn, devmap_handle, EXT2_INODE_ROOT_INDEX);215 int ext2fs_root_get(fs_node_t **rfn, service_id_t service_id) 216 { 217 EXT2FS_DBG("(-, %" PRIun ")", service_id); 218 return ext2fs_node_get(rfn, service_id, EXT2_INODE_ROOT_INDEX); 219 219 } 220 220 … … 289 289 290 290 /** Instantiate a EXT2 in-core node. */ 291 int ext2fs_node_get(fs_node_t **rfn, devmap_handle_t devmap_handle, fs_index_t index)292 { 293 EXT2FS_DBG("(-,%" PRIun ",%u)", devmap_handle, index);291 int ext2fs_node_get(fs_node_t **rfn, service_id_t service_id, fs_index_t index) 292 { 293 EXT2FS_DBG("(-,%" PRIun ",%u)", service_id, index); 294 294 295 295 ext2fs_instance_t *inst = NULL; 296 296 int rc; 297 297 298 rc = ext2fs_instance_get( devmap_handle, &inst);298 rc = ext2fs_instance_get(service_id, &inst); 299 299 if (rc != EOK) { 300 300 return rc; … … 317 317 /* Check if the node is not already open */ 318 318 unsigned long key[] = { 319 [OPEN_NODES_DEV_HANDLE_KEY] = inst-> devmap_handle,319 [OPEN_NODES_DEV_HANDLE_KEY] = inst->service_id, 320 320 [OPEN_NODES_INODE_KEY] = index, 321 321 }; … … 411 411 412 412 unsigned long key[] = { 413 [OPEN_NODES_DEV_HANDLE_KEY] = enode->instance-> devmap_handle,413 [OPEN_NODES_DEV_HANDLE_KEY] = enode->instance->service_id, 414 414 [OPEN_NODES_INODE_KEY] = enode->inode_ref->index, 415 415 }; … … 429 429 } 430 430 431 int ext2fs_create_node(fs_node_t **rfn, devmap_handle_t devmap_handle, int flags)431 int ext2fs_create_node(fs_node_t **rfn, service_id_t service_id, int flags) 432 432 { 433 433 EXT2FS_DBG(""); … … 557 557 } 558 558 559 devmap_handle_t ext2fs_device_get(fs_node_t *fn)559 service_id_t ext2fs_service_get(fs_node_t *fn) 560 560 { 561 561 EXT2FS_DBG(""); 562 562 ext2fs_node_t *enode = EXT2FS_NODE(fn); 563 return enode->instance-> devmap_handle;563 return enode->instance->service_id; 564 564 } 565 565 … … 581 581 .is_directory = ext2fs_is_directory, 582 582 .is_file = ext2fs_is_file, 583 . device_get = ext2fs_device_get583 .service_get = ext2fs_service_get 584 584 }; 585 585 … … 588 588 */ 589 589 590 static int ext2fs_mounted( devmap_handle_t devmap_handle, const char *opts,590 static int ext2fs_mounted(service_id_t service_id, const char *opts, 591 591 fs_index_t *index, aoff64_t *size, unsigned *lnkcnt) 592 592 { … … 610 610 611 611 /* Initialize the filesystem */ 612 rc = ext2_filesystem_init(fs, devmap_handle);612 rc = ext2_filesystem_init(fs, service_id); 613 613 if (rc != EOK) { 614 614 free(fs); … … 637 637 /* Initialize instance */ 638 638 link_initialize(&inst->link); 639 inst-> devmap_handle = devmap_handle;639 inst->service_id = service_id; 640 640 inst->filesystem = fs; 641 641 inst->open_nodes_count = 0; … … 666 666 } 667 667 668 static int ext2fs_unmounted( devmap_handle_t devmap_handle)668 static int ext2fs_unmounted(service_id_t service_id) 669 669 { 670 670 EXT2FS_DBG(""); … … 672 672 int rc; 673 673 674 rc = ext2fs_instance_get( devmap_handle, &inst);674 rc = ext2fs_instance_get(service_id, &inst); 675 675 676 676 if (rc != EOK) … … 698 698 699 699 static int 700 ext2fs_read( devmap_handle_t devmap_handle, fs_index_t index, aoff64_t pos,700 ext2fs_read(service_id_t service_id, fs_index_t index, aoff64_t pos, 701 701 size_t *rbytes) 702 702 { … … 717 717 } 718 718 719 rc = ext2fs_instance_get( devmap_handle, &inst);719 rc = ext2fs_instance_get(service_id, &inst); 720 720 if (rc != EOK) { 721 721 async_answer_0(callid, rc); … … 907 907 908 908 /* Usual case - we need to read a block from device */ 909 rc = block_get(&block, inst-> devmap_handle, fs_block, BLOCK_FLAGS_NONE);909 rc = block_get(&block, inst->service_id, fs_block, BLOCK_FLAGS_NONE); 910 910 if (rc != EOK) { 911 911 async_answer_0(callid, rc); … … 925 925 926 926 static int 927 ext2fs_write( devmap_handle_t devmap_handle, fs_index_t index, aoff64_t pos,927 ext2fs_write(service_id_t service_id, fs_index_t index, aoff64_t pos, 928 928 size_t *wbytes, aoff64_t *nsize) 929 929 { … … 933 933 934 934 static int 935 ext2fs_truncate( devmap_handle_t devmap_handle, fs_index_t index, aoff64_t size)935 ext2fs_truncate(service_id_t service_id, fs_index_t index, aoff64_t size) 936 936 { 937 937 EXT2FS_DBG(""); … … 939 939 } 940 940 941 static int ext2fs_close( devmap_handle_t devmap_handle, fs_index_t index)942 { 943 EXT2FS_DBG(""); 944 return EOK; 945 } 946 947 static int ext2fs_destroy( devmap_handle_t devmap_handle, fs_index_t index)941 static int ext2fs_close(service_id_t service_id, fs_index_t index) 942 { 943 EXT2FS_DBG(""); 944 return EOK; 945 } 946 947 static int ext2fs_destroy(service_id_t service_id, fs_index_t index) 948 948 { 949 949 EXT2FS_DBG(""); … … 951 951 } 952 952 953 static int ext2fs_sync( devmap_handle_t devmap_handle, fs_index_t index)953 static int ext2fs_sync(service_id_t service_id, fs_index_t index) 954 954 { 955 955 EXT2FS_DBG("");
Note:
See TracChangeset
for help on using the changeset viewer.