Changeset 45f04f8 in mainline for uspace/srv/fs/tmpfs/tmpfs_ops.c
- Timestamp:
- 2010-11-18T18:23:43Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 3f0a7971, a7811f17, cb569e6
- Parents:
- 51a268f (diff), c63e70c (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/tmpfs/tmpfs_ops.c
r51a268f r45f04f8 70 70 /* Forward declarations of static functions. */ 71 71 static int tmpfs_match(fs_node_t **, fs_node_t *, const char *); 72 static int tmpfs_node_get(fs_node_t **, dev _handle_t, fs_index_t);72 static int tmpfs_node_get(fs_node_t **, devmap_handle_t, fs_index_t); 73 73 static int tmpfs_node_open(fs_node_t *); 74 74 static int tmpfs_node_put(fs_node_t *); 75 static int tmpfs_create_node(fs_node_t **, dev _handle_t, int);75 static int tmpfs_create_node(fs_node_t **, devmap_handle_t, int); 76 76 static int tmpfs_destroy_node(fs_node_t *); 77 77 static int tmpfs_link_node(fs_node_t *, fs_node_t *, const char *); … … 79 79 80 80 /* Implementation of helper functions. */ 81 static int tmpfs_root_get(fs_node_t **rfn, dev _handle_t dev_handle)82 { 83 return tmpfs_node_get(rfn, dev _handle, TMPFS_SOME_ROOT);81 static int tmpfs_root_get(fs_node_t **rfn, devmap_handle_t devmap_handle) 82 { 83 return tmpfs_node_get(rfn, devmap_handle, TMPFS_SOME_ROOT); 84 84 } 85 85 … … 120 120 } 121 121 122 static dev _handle_t tmpfs_device_get(fs_node_t *fn)122 static devmap_handle_t tmpfs_device_get(fs_node_t *fn) 123 123 { 124 124 return 0; … … 165 165 switch (keys) { 166 166 case 1: 167 return (nodep->dev _handle == key[NODES_KEY_DEV]);167 return (nodep->devmap_handle == key[NODES_KEY_DEV]); 168 168 case 2: 169 return ((nodep->dev _handle == key[NODES_KEY_DEV]) &&169 return ((nodep->devmap_handle == key[NODES_KEY_DEV]) && 170 170 (nodep->index == key[NODES_KEY_INDEX])); 171 171 default: … … 209 209 nodep->bp = NULL; 210 210 nodep->index = 0; 211 nodep->dev _handle = 0;211 nodep->devmap_handle = 0; 212 212 nodep->type = TMPFS_NONE; 213 213 nodep->lnkcnt = 0; … … 233 233 } 234 234 235 static bool tmpfs_instance_init(dev _handle_t dev_handle)235 static bool tmpfs_instance_init(devmap_handle_t devmap_handle) 236 236 { 237 237 fs_node_t *rfn; 238 238 int rc; 239 239 240 rc = tmpfs_create_node(&rfn, dev _handle, L_DIRECTORY);240 rc = tmpfs_create_node(&rfn, devmap_handle, L_DIRECTORY); 241 241 if (rc != EOK || !rfn) 242 242 return false; … … 245 245 } 246 246 247 static void tmpfs_instance_done(dev _handle_t dev_handle)247 static void tmpfs_instance_done(devmap_handle_t devmap_handle) 248 248 { 249 249 unsigned long key[] = { 250 [NODES_KEY_DEV] = dev _handle250 [NODES_KEY_DEV] = devmap_handle 251 251 }; 252 252 /* … … 279 279 } 280 280 281 int tmpfs_node_get(fs_node_t **rfn, dev _handle_t dev_handle, fs_index_t index)281 int tmpfs_node_get(fs_node_t **rfn, devmap_handle_t devmap_handle, fs_index_t index) 282 282 { 283 283 unsigned long key[] = { 284 [NODES_KEY_DEV] = dev _handle,284 [NODES_KEY_DEV] = devmap_handle, 285 285 [NODES_KEY_INDEX] = index 286 286 }; … … 308 308 } 309 309 310 int tmpfs_create_node(fs_node_t **rfn, dev _handle_t dev_handle, int lflag)310 int tmpfs_create_node(fs_node_t **rfn, devmap_handle_t devmap_handle, int lflag) 311 311 { 312 312 fs_node_t *rootfn; … … 327 327 nodep->bp->data = nodep; /* link the FS and TMPFS nodes */ 328 328 329 rc = tmpfs_root_get(&rootfn, dev _handle);329 rc = tmpfs_root_get(&rootfn, devmap_handle); 330 330 assert(rc == EOK); 331 331 if (!rootfn) … … 333 333 else 334 334 nodep->index = tmpfs_next_index++; 335 nodep->dev _handle = dev_handle;335 nodep->devmap_handle = devmap_handle; 336 336 if (lflag & L_DIRECTORY) 337 337 nodep->type = TMPFS_DIRECTORY; … … 341 341 /* Insert the new node into the nodes hash table. */ 342 342 unsigned long key[] = { 343 [NODES_KEY_DEV] = nodep->dev _handle,343 [NODES_KEY_DEV] = nodep->devmap_handle, 344 344 [NODES_KEY_INDEX] = nodep->index 345 345 }; … … 357 357 358 358 unsigned long key[] = { 359 [NODES_KEY_DEV] = nodep->dev _handle,359 [NODES_KEY_DEV] = nodep->devmap_handle, 360 360 [NODES_KEY_INDEX] = nodep->index 361 361 }; … … 442 442 void tmpfs_mounted(ipc_callid_t rid, ipc_call_t *request) 443 443 { 444 dev _handle_t dev_handle = (dev_handle_t) IPC_GET_ARG1(*request);444 devmap_handle_t devmap_handle = (devmap_handle_t) IPC_GET_ARG1(*request); 445 445 fs_node_t *rootfn; 446 446 int rc; … … 455 455 456 456 /* Check if this device is not already mounted. */ 457 rc = tmpfs_root_get(&rootfn, dev _handle);457 rc = tmpfs_root_get(&rootfn, devmap_handle); 458 458 if ((rc == EOK) && (rootfn)) { 459 459 (void) tmpfs_node_put(rootfn); … … 464 464 465 465 /* Initialize TMPFS instance. */ 466 if (!tmpfs_instance_init(dev _handle)) {466 if (!tmpfs_instance_init(devmap_handle)) { 467 467 free(opts); 468 468 ipc_answer_0(rid, ENOMEM); … … 470 470 } 471 471 472 rc = tmpfs_root_get(&rootfn, dev _handle);472 rc = tmpfs_root_get(&rootfn, devmap_handle); 473 473 assert(rc == EOK); 474 474 tmpfs_node_t *rootp = TMPFS_NODE(rootfn); 475 475 if (str_cmp(opts, "restore") == 0) { 476 if (tmpfs_restore(dev _handle))476 if (tmpfs_restore(devmap_handle)) 477 477 ipc_answer_3(rid, EOK, rootp->index, rootp->size, 478 478 rootp->lnkcnt); … … 493 493 void tmpfs_unmounted(ipc_callid_t rid, ipc_call_t *request) 494 494 { 495 dev _handle_t dev_handle = (dev_handle_t) IPC_GET_ARG1(*request);496 497 tmpfs_instance_done(dev _handle);495 devmap_handle_t devmap_handle = (devmap_handle_t) IPC_GET_ARG1(*request); 496 497 tmpfs_instance_done(devmap_handle); 498 498 ipc_answer_0(rid, EOK); 499 499 } … … 511 511 void tmpfs_read(ipc_callid_t rid, ipc_call_t *request) 512 512 { 513 dev _handle_t dev_handle = (dev_handle_t) IPC_GET_ARG1(*request);513 devmap_handle_t devmap_handle = (devmap_handle_t) IPC_GET_ARG1(*request); 514 514 fs_index_t index = (fs_index_t) IPC_GET_ARG2(*request); 515 515 aoff64_t pos = … … 521 521 link_t *hlp; 522 522 unsigned long key[] = { 523 [NODES_KEY_DEV] = dev _handle,523 [NODES_KEY_DEV] = devmap_handle, 524 524 [NODES_KEY_INDEX] = index 525 525 }; … … 586 586 void tmpfs_write(ipc_callid_t rid, ipc_call_t *request) 587 587 { 588 dev _handle_t dev_handle = (dev_handle_t) IPC_GET_ARG1(*request);588 devmap_handle_t devmap_handle = (devmap_handle_t) IPC_GET_ARG1(*request); 589 589 fs_index_t index = (fs_index_t) IPC_GET_ARG2(*request); 590 590 aoff64_t pos = … … 596 596 link_t *hlp; 597 597 unsigned long key[] = { 598 [NODES_KEY_DEV] = dev _handle,598 [NODES_KEY_DEV] = devmap_handle, 599 599 [NODES_KEY_INDEX] = index 600 600 }; … … 651 651 void tmpfs_truncate(ipc_callid_t rid, ipc_call_t *request) 652 652 { 653 dev _handle_t dev_handle = (dev_handle_t) IPC_GET_ARG1(*request);653 devmap_handle_t devmap_handle = (devmap_handle_t) IPC_GET_ARG1(*request); 654 654 fs_index_t index = (fs_index_t) IPC_GET_ARG2(*request); 655 655 aoff64_t size = … … 660 660 */ 661 661 unsigned long key[] = { 662 [NODES_KEY_DEV] = dev _handle,662 [NODES_KEY_DEV] = devmap_handle, 663 663 [NODES_KEY_INDEX] = index 664 664 }; … … 704 704 void tmpfs_destroy(ipc_callid_t rid, ipc_call_t *request) 705 705 { 706 dev _handle_t dev_handle = (dev_handle_t)IPC_GET_ARG1(*request);706 devmap_handle_t devmap_handle = (devmap_handle_t)IPC_GET_ARG1(*request); 707 707 fs_index_t index = (fs_index_t)IPC_GET_ARG2(*request); 708 708 int rc; … … 710 710 link_t *hlp; 711 711 unsigned long key[] = { 712 [NODES_KEY_DEV] = dev _handle,712 [NODES_KEY_DEV] = devmap_handle, 713 713 [NODES_KEY_INDEX] = index 714 714 };
Note:
See TracChangeset
for help on using the changeset viewer.