Changes in uspace/srv/fs/tmpfs/tmpfs_ops.c [efcebe1:b33870b] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/tmpfs/tmpfs_ops.c
refcebe1 rb33870b 69 69 /* Forward declarations of static functions. */ 70 70 static int tmpfs_match(fs_node_t **, fs_node_t *, const char *); 71 static int tmpfs_node_get(fs_node_t **, devmap_handle_t, fs_index_t);71 static int tmpfs_node_get(fs_node_t **, service_id_t, fs_index_t); 72 72 static int tmpfs_node_open(fs_node_t *); 73 73 static int tmpfs_node_put(fs_node_t *); 74 static int tmpfs_create_node(fs_node_t **, devmap_handle_t, int);74 static int tmpfs_create_node(fs_node_t **, service_id_t, int); 75 75 static int tmpfs_destroy_node(fs_node_t *); 76 76 static int tmpfs_link_node(fs_node_t *, fs_node_t *, const char *); … … 78 78 79 79 /* Implementation of helper functions. */ 80 static int tmpfs_root_get(fs_node_t **rfn, devmap_handle_t devmap_handle)81 { 82 return tmpfs_node_get(rfn, devmap_handle, TMPFS_SOME_ROOT);80 static int tmpfs_root_get(fs_node_t **rfn, service_id_t service_id) 81 { 82 return tmpfs_node_get(rfn, service_id, TMPFS_SOME_ROOT); 83 83 } 84 84 … … 114 114 } 115 115 116 static devmap_handle_t tmpfs_device_get(fs_node_t *fn)116 static service_id_t tmpfs_service_get(fs_node_t *fn) 117 117 { 118 118 return 0; … … 136 136 .is_directory = tmpfs_is_directory, 137 137 .is_file = tmpfs_is_file, 138 . device_get = tmpfs_device_get138 .service_get = tmpfs_service_get 139 139 }; 140 140 … … 158 158 switch (keys) { 159 159 case 1: 160 return (nodep-> devmap_handle== key[NODES_KEY_DEV]);160 return (nodep->service_id == key[NODES_KEY_DEV]); 161 161 case 2: 162 return ((nodep-> devmap_handle== key[NODES_KEY_DEV]) &&162 return ((nodep->service_id == key[NODES_KEY_DEV]) && 163 163 (nodep->index == key[NODES_KEY_INDEX])); 164 164 default: … … 202 202 nodep->bp = NULL; 203 203 nodep->index = 0; 204 nodep-> devmap_handle= 0;204 nodep->service_id = 0; 205 205 nodep->type = TMPFS_NONE; 206 206 nodep->lnkcnt = 0; … … 226 226 } 227 227 228 static bool tmpfs_instance_init( devmap_handle_t devmap_handle)228 static bool tmpfs_instance_init(service_id_t service_id) 229 229 { 230 230 fs_node_t *rfn; 231 231 int rc; 232 232 233 rc = tmpfs_create_node(&rfn, devmap_handle, L_DIRECTORY);233 rc = tmpfs_create_node(&rfn, service_id, L_DIRECTORY); 234 234 if (rc != EOK || !rfn) 235 235 return false; … … 238 238 } 239 239 240 static void tmpfs_instance_done( devmap_handle_t devmap_handle)241 { 242 unsigned long key[] = { 243 [NODES_KEY_DEV] = devmap_handle240 static void tmpfs_instance_done(service_id_t service_id) 241 { 242 unsigned long key[] = { 243 [NODES_KEY_DEV] = service_id 244 244 }; 245 245 /* … … 270 270 } 271 271 272 int tmpfs_node_get(fs_node_t **rfn, devmap_handle_t devmap_handle, fs_index_t index)273 { 274 unsigned long key[] = { 275 [NODES_KEY_DEV] = devmap_handle,272 int tmpfs_node_get(fs_node_t **rfn, service_id_t service_id, fs_index_t index) 273 { 274 unsigned long key[] = { 275 [NODES_KEY_DEV] = service_id, 276 276 [NODES_KEY_INDEX] = index 277 277 }; … … 299 299 } 300 300 301 int tmpfs_create_node(fs_node_t **rfn, devmap_handle_t devmap_handle, int lflag)301 int tmpfs_create_node(fs_node_t **rfn, service_id_t service_id, int lflag) 302 302 { 303 303 fs_node_t *rootfn; … … 318 318 nodep->bp->data = nodep; /* link the FS and TMPFS nodes */ 319 319 320 rc = tmpfs_root_get(&rootfn, devmap_handle);320 rc = tmpfs_root_get(&rootfn, service_id); 321 321 assert(rc == EOK); 322 322 if (!rootfn) … … 324 324 else 325 325 nodep->index = tmpfs_next_index++; 326 nodep-> devmap_handle = devmap_handle;326 nodep->service_id = service_id; 327 327 if (lflag & L_DIRECTORY) 328 328 nodep->type = TMPFS_DIRECTORY; … … 332 332 /* Insert the new node into the nodes hash table. */ 333 333 unsigned long key[] = { 334 [NODES_KEY_DEV] = nodep-> devmap_handle,334 [NODES_KEY_DEV] = nodep->service_id, 335 335 [NODES_KEY_INDEX] = nodep->index 336 336 }; … … 348 348 349 349 unsigned long key[] = { 350 [NODES_KEY_DEV] = nodep-> devmap_handle,350 [NODES_KEY_DEV] = nodep->service_id, 351 351 [NODES_KEY_INDEX] = nodep->index 352 352 }; … … 432 432 433 433 static int 434 tmpfs_mounted( devmap_handle_t devmap_handle, const char *opts,434 tmpfs_mounted(service_id_t service_id, const char *opts, 435 435 fs_index_t *index, aoff64_t *size, unsigned *lnkcnt) 436 436 { … … 439 439 440 440 /* Check if this device is not already mounted. */ 441 rc = tmpfs_root_get(&rootfn, devmap_handle);441 rc = tmpfs_root_get(&rootfn, service_id); 442 442 if ((rc == EOK) && (rootfn)) { 443 443 (void) tmpfs_node_put(rootfn); … … 446 446 447 447 /* Initialize TMPFS instance. */ 448 if (!tmpfs_instance_init( devmap_handle))448 if (!tmpfs_instance_init(service_id)) 449 449 return ENOMEM; 450 450 451 rc = tmpfs_root_get(&rootfn, devmap_handle);451 rc = tmpfs_root_get(&rootfn, service_id); 452 452 assert(rc == EOK); 453 453 tmpfs_node_t *rootp = TMPFS_NODE(rootfn); 454 454 if (str_cmp(opts, "restore") == 0) { 455 if (!tmpfs_restore( devmap_handle))455 if (!tmpfs_restore(service_id)) 456 456 return ELIMIT; 457 457 } … … 464 464 } 465 465 466 static int tmpfs_unmounted( devmap_handle_t devmap_handle)467 { 468 tmpfs_instance_done( devmap_handle);469 return EOK; 470 } 471 472 static int tmpfs_read( devmap_handle_t devmap_handle, fs_index_t index, aoff64_t pos,466 static int tmpfs_unmounted(service_id_t service_id) 467 { 468 tmpfs_instance_done(service_id); 469 return EOK; 470 } 471 472 static int tmpfs_read(service_id_t service_id, fs_index_t index, aoff64_t pos, 473 473 size_t *rbytes) 474 474 { … … 478 478 link_t *hlp; 479 479 unsigned long key[] = { 480 [NODES_KEY_DEV] = devmap_handle,480 [NODES_KEY_DEV] = service_id, 481 481 [NODES_KEY_INDEX] = index 482 482 }; … … 532 532 533 533 static int 534 tmpfs_write( devmap_handle_t devmap_handle, fs_index_t index, aoff64_t pos,534 tmpfs_write(service_id_t service_id, fs_index_t index, aoff64_t pos, 535 535 size_t *wbytes, aoff64_t *nsize) 536 536 { … … 540 540 link_t *hlp; 541 541 unsigned long key[] = { 542 [NODES_KEY_DEV] = devmap_handle,542 [NODES_KEY_DEV] = service_id, 543 543 [NODES_KEY_INDEX] = index 544 544 }; … … 594 594 } 595 595 596 static int tmpfs_truncate( devmap_handle_t devmap_handle, fs_index_t index,596 static int tmpfs_truncate(service_id_t service_id, fs_index_t index, 597 597 aoff64_t size) 598 598 { … … 601 601 */ 602 602 unsigned long key[] = { 603 [NODES_KEY_DEV] = devmap_handle,603 [NODES_KEY_DEV] = service_id, 604 604 [NODES_KEY_INDEX] = index 605 605 }; … … 629 629 } 630 630 631 static int tmpfs_close( devmap_handle_t devmap_handle, fs_index_t index)632 { 633 return EOK; 634 } 635 636 static int tmpfs_destroy( devmap_handle_t devmap_handle, fs_index_t index)631 static int tmpfs_close(service_id_t service_id, fs_index_t index) 632 { 633 return EOK; 634 } 635 636 static int tmpfs_destroy(service_id_t service_id, fs_index_t index) 637 637 { 638 638 link_t *hlp; 639 639 unsigned long key[] = { 640 [NODES_KEY_DEV] = devmap_handle,640 [NODES_KEY_DEV] = service_id, 641 641 [NODES_KEY_INDEX] = index 642 642 }; … … 649 649 } 650 650 651 static int tmpfs_sync( devmap_handle_t devmap_handle, fs_index_t index)651 static int tmpfs_sync(service_id_t service_id, fs_index_t index) 652 652 { 653 653 /*
Note:
See TracChangeset
for help on using the changeset viewer.