Changeset 15f3c3f in mainline for uspace/srv/fs/tmpfs/tmpfs_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/tmpfs/tmpfs_ops.c
ref09a7a r15f3c3f 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 … … 119 119 } 120 120 121 static devmap_handle_t tmpfs_device_get(fs_node_t *fn)121 static service_id_t tmpfs_device_get(fs_node_t *fn) 122 122 { 123 123 return 0; … … 164 164 switch (keys) { 165 165 case 1: 166 return (nodep-> devmap_handle== key[NODES_KEY_DEV]);166 return (nodep->service_id == key[NODES_KEY_DEV]); 167 167 case 2: 168 return ((nodep-> devmap_handle== key[NODES_KEY_DEV]) &&168 return ((nodep->service_id == key[NODES_KEY_DEV]) && 169 169 (nodep->index == key[NODES_KEY_INDEX])); 170 170 default: … … 208 208 nodep->bp = NULL; 209 209 nodep->index = 0; 210 nodep-> devmap_handle= 0;210 nodep->service_id = 0; 211 211 nodep->type = TMPFS_NONE; 212 212 nodep->lnkcnt = 0; … … 232 232 } 233 233 234 static bool tmpfs_instance_init( devmap_handle_t devmap_handle)234 static bool tmpfs_instance_init(service_id_t service_id) 235 235 { 236 236 fs_node_t *rfn; 237 237 int rc; 238 238 239 rc = tmpfs_create_node(&rfn, devmap_handle, L_DIRECTORY);239 rc = tmpfs_create_node(&rfn, service_id, L_DIRECTORY); 240 240 if (rc != EOK || !rfn) 241 241 return false; … … 244 244 } 245 245 246 static void tmpfs_instance_done( devmap_handle_t devmap_handle)246 static void tmpfs_instance_done(service_id_t service_id) 247 247 { 248 248 unsigned long key[] = { 249 [NODES_KEY_DEV] = devmap_handle249 [NODES_KEY_DEV] = service_id 250 250 }; 251 251 /* … … 276 276 } 277 277 278 int tmpfs_node_get(fs_node_t **rfn, devmap_handle_t devmap_handle, fs_index_t index)278 int tmpfs_node_get(fs_node_t **rfn, service_id_t service_id, fs_index_t index) 279 279 { 280 280 unsigned long key[] = { 281 [NODES_KEY_DEV] = devmap_handle,281 [NODES_KEY_DEV] = service_id, 282 282 [NODES_KEY_INDEX] = index 283 283 }; … … 305 305 } 306 306 307 int tmpfs_create_node(fs_node_t **rfn, devmap_handle_t devmap_handle, int lflag)307 int tmpfs_create_node(fs_node_t **rfn, service_id_t service_id, int lflag) 308 308 { 309 309 fs_node_t *rootfn; … … 324 324 nodep->bp->data = nodep; /* link the FS and TMPFS nodes */ 325 325 326 rc = tmpfs_root_get(&rootfn, devmap_handle);326 rc = tmpfs_root_get(&rootfn, service_id); 327 327 assert(rc == EOK); 328 328 if (!rootfn) … … 330 330 else 331 331 nodep->index = tmpfs_next_index++; 332 nodep-> devmap_handle = devmap_handle;332 nodep->service_id = service_id; 333 333 if (lflag & L_DIRECTORY) 334 334 nodep->type = TMPFS_DIRECTORY; … … 338 338 /* Insert the new node into the nodes hash table. */ 339 339 unsigned long key[] = { 340 [NODES_KEY_DEV] = nodep-> devmap_handle,340 [NODES_KEY_DEV] = nodep->service_id, 341 341 [NODES_KEY_INDEX] = nodep->index 342 342 }; … … 354 354 355 355 unsigned long key[] = { 356 [NODES_KEY_DEV] = nodep-> devmap_handle,356 [NODES_KEY_DEV] = nodep->service_id, 357 357 [NODES_KEY_INDEX] = nodep->index 358 358 }; … … 435 435 void tmpfs_mounted(ipc_callid_t rid, ipc_call_t *request) 436 436 { 437 devmap_handle_t devmap_handle = (devmap_handle_t) IPC_GET_ARG1(*request);437 service_id_t service_id = (service_id_t) IPC_GET_ARG1(*request); 438 438 fs_node_t *rootfn; 439 439 int rc; … … 448 448 449 449 /* Check if this device is not already mounted. */ 450 rc = tmpfs_root_get(&rootfn, devmap_handle);450 rc = tmpfs_root_get(&rootfn, service_id); 451 451 if ((rc == EOK) && (rootfn)) { 452 452 (void) tmpfs_node_put(rootfn); … … 457 457 458 458 /* Initialize TMPFS instance. */ 459 if (!tmpfs_instance_init( devmap_handle)) {459 if (!tmpfs_instance_init(service_id)) { 460 460 free(opts); 461 461 async_answer_0(rid, ENOMEM); … … 463 463 } 464 464 465 rc = tmpfs_root_get(&rootfn, devmap_handle);465 rc = tmpfs_root_get(&rootfn, service_id); 466 466 assert(rc == EOK); 467 467 tmpfs_node_t *rootp = TMPFS_NODE(rootfn); 468 468 if (str_cmp(opts, "restore") == 0) { 469 if (tmpfs_restore( devmap_handle))469 if (tmpfs_restore(service_id)) 470 470 async_answer_3(rid, EOK, rootp->index, rootp->size, 471 471 rootp->lnkcnt); … … 486 486 void tmpfs_unmounted(ipc_callid_t rid, ipc_call_t *request) 487 487 { 488 devmap_handle_t devmap_handle = (devmap_handle_t) IPC_GET_ARG1(*request);489 490 tmpfs_instance_done( devmap_handle);488 service_id_t service_id = (service_id_t) IPC_GET_ARG1(*request); 489 490 tmpfs_instance_done(service_id); 491 491 async_answer_0(rid, EOK); 492 492 } … … 504 504 void tmpfs_read(ipc_callid_t rid, ipc_call_t *request) 505 505 { 506 devmap_handle_t devmap_handle = (devmap_handle_t) IPC_GET_ARG1(*request);506 service_id_t service_id = (service_id_t) IPC_GET_ARG1(*request); 507 507 fs_index_t index = (fs_index_t) IPC_GET_ARG2(*request); 508 508 aoff64_t pos = … … 514 514 link_t *hlp; 515 515 unsigned long key[] = { 516 [NODES_KEY_DEV] = devmap_handle,516 [NODES_KEY_DEV] = service_id, 517 517 [NODES_KEY_INDEX] = index 518 518 }; … … 575 575 void tmpfs_write(ipc_callid_t rid, ipc_call_t *request) 576 576 { 577 devmap_handle_t devmap_handle = (devmap_handle_t) IPC_GET_ARG1(*request);577 service_id_t service_id = (service_id_t) IPC_GET_ARG1(*request); 578 578 fs_index_t index = (fs_index_t) IPC_GET_ARG2(*request); 579 579 aoff64_t pos = … … 585 585 link_t *hlp; 586 586 unsigned long key[] = { 587 [NODES_KEY_DEV] = devmap_handle,587 [NODES_KEY_DEV] = service_id, 588 588 [NODES_KEY_INDEX] = index 589 589 }; … … 640 640 void tmpfs_truncate(ipc_callid_t rid, ipc_call_t *request) 641 641 { 642 devmap_handle_t devmap_handle = (devmap_handle_t) IPC_GET_ARG1(*request);642 service_id_t service_id = (service_id_t) IPC_GET_ARG1(*request); 643 643 fs_index_t index = (fs_index_t) IPC_GET_ARG2(*request); 644 644 aoff64_t size = … … 649 649 */ 650 650 unsigned long key[] = { 651 [NODES_KEY_DEV] = devmap_handle,651 [NODES_KEY_DEV] = service_id, 652 652 [NODES_KEY_INDEX] = index 653 653 }; … … 693 693 void tmpfs_destroy(ipc_callid_t rid, ipc_call_t *request) 694 694 { 695 devmap_handle_t devmap_handle = (devmap_handle_t)IPC_GET_ARG1(*request);695 service_id_t service_id = (service_id_t)IPC_GET_ARG1(*request); 696 696 fs_index_t index = (fs_index_t)IPC_GET_ARG2(*request); 697 697 int rc; … … 699 699 link_t *hlp; 700 700 unsigned long key[] = { 701 [NODES_KEY_DEV] = devmap_handle,701 [NODES_KEY_DEV] = service_id, 702 702 [NODES_KEY_INDEX] = index 703 703 };
Note:
See TracChangeset
for help on using the changeset viewer.