Changeset f2ec8c8 in mainline for uspace/srv/fs/tmpfs/tmpfs_ops.c
- Timestamp:
- 2008-03-11T20:33:53Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 923c39e
- Parents:
- 8ad8e49
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/tmpfs/tmpfs_ops.c
r8ad8e49 rf2ec8c8 71 71 /* Forward declarations of static functions. */ 72 72 static bool tmpfs_match(void *, void *, const char *); 73 static void *tmpfs_node_get( int, int, unsigned long);73 static void *tmpfs_node_get(fs_handle_t, dev_handle_t, fs_index_t); 74 74 static void *tmpfs_create_node(int); 75 75 static bool tmpfs_link_node(void *, void *, const char *); … … 78 78 79 79 /* Implementation of helper functions. */ 80 static unsigned longtmpfs_index_get(void *nodep)80 static fs_index_t tmpfs_index_get(void *nodep) 81 81 { 82 82 return ((tmpfs_dentry_t *) nodep)->index; 83 83 } 84 84 85 static unsigned longtmpfs_size_get(void *nodep)85 static size_t tmpfs_size_get(void *nodep) 86 86 { 87 87 return ((tmpfs_dentry_t *) nodep)->size; … … 170 170 }; 171 171 172 unsignedtmpfs_next_index = 1;172 fs_index_t tmpfs_next_index = 1; 173 173 174 174 typedef struct { … … 263 263 } 264 264 265 void *tmpfs_node_get(int fs_handle, int dev_handle, unsigned long index) 266 { 267 link_t *lnk = hash_table_find(&dentries, &index); 265 void * 266 tmpfs_node_get(fs_handle_t fs_handle, dev_handle_t dev_handle, fs_index_t index) 267 { 268 unsigned long key = index; 269 link_t *lnk = hash_table_find(&dentries, &key); 268 270 if (!lnk) 269 271 return NULL; … … 290 292 291 293 /* Insert the new node into the dentry hash table. */ 292 hash_table_insert(&dentries, &node->index, &node->dh_link); 294 unsigned long key = node->index; 295 hash_table_insert(&dentries, &key, &node->dh_link); 293 296 return (void *) node; 294 297 } … … 370 373 assert(!dentry->sibling); 371 374 372 unsigned long index= dentry->index;373 hash_table_remove(&dentries, & index, 1);375 unsigned long key = dentry->index; 376 hash_table_remove(&dentries, &key, 1); 374 377 375 378 hash_table_destroy(&dentry->names); … … 392 395 void tmpfs_read(ipc_callid_t rid, ipc_call_t *request) 393 396 { 394 int dev_handle =IPC_GET_ARG1(*request);395 unsigned long index =IPC_GET_ARG2(*request);396 off_t pos = IPC_GET_ARG3(*request);397 dev_handle_t dev_handle = (dev_handle_t)IPC_GET_ARG1(*request); 398 fs_index_t index = (fs_index_t)IPC_GET_ARG2(*request); 399 off_t pos = (off_t)IPC_GET_ARG3(*request); 397 400 398 401 /* … … 400 403 */ 401 404 link_t *hlp; 402 hlp = hash_table_find(&dentries, &index); 405 unsigned long key = index; 406 hlp = hash_table_find(&dentries, &key); 403 407 if (!hlp) { 404 408 ipc_answer_0(rid, ENOENT); … … 464 468 void tmpfs_write(ipc_callid_t rid, ipc_call_t *request) 465 469 { 466 int dev_handle =IPC_GET_ARG1(*request);467 unsigned long index =IPC_GET_ARG2(*request);468 off_t pos = IPC_GET_ARG3(*request);470 dev_handle_t dev_handle = (dev_handle_t)IPC_GET_ARG1(*request); 471 fs_index_t index = (fs_index_t)IPC_GET_ARG2(*request); 472 off_t pos = (off_t)IPC_GET_ARG3(*request); 469 473 470 474 /* … … 472 476 */ 473 477 link_t *hlp; 474 hlp = hash_table_find(&dentries, &index); 478 unsigned long key = index; 479 hlp = hash_table_find(&dentries, &key); 475 480 if (!hlp) { 476 481 ipc_answer_0(rid, ENOENT); … … 524 529 void tmpfs_truncate(ipc_callid_t rid, ipc_call_t *request) 525 530 { 526 int dev_handle =IPC_GET_ARG1(*request);527 unsigned long index =IPC_GET_ARG2(*request);528 size_t size = IPC_GET_ARG3(*request);531 dev_handle_t dev_handle = (dev_handle_t)IPC_GET_ARG1(*request); 532 fs_index_t index = (fs_index_t)IPC_GET_ARG2(*request); 533 size_t size = (off_t)IPC_GET_ARG3(*request); 529 534 530 535 /* … … 532 537 */ 533 538 link_t *hlp; 534 hlp = hash_table_find(&dentries, &index); 539 unsigned long key = index; 540 hlp = hash_table_find(&dentries, &key); 535 541 if (!hlp) { 536 542 ipc_answer_0(rid, ENOENT); … … 561 567 void tmpfs_destroy(ipc_callid_t rid, ipc_call_t *request) 562 568 { 563 int dev_handle =IPC_GET_ARG1(*request);564 unsigned long index =IPC_GET_ARG2(*request);569 dev_handle_t dev_handle = (dev_handle_t)IPC_GET_ARG1(*request); 570 fs_index_t index = (fs_index_t)IPC_GET_ARG2(*request); 565 571 566 572 link_t *hlp; 567 hlp = hash_table_find(&dentries, &index); 573 unsigned long key = index; 574 hlp = hash_table_find(&dentries, &key); 568 575 if (!hlp) { 569 576 ipc_answer_0(rid, ENOENT);
Note:
See TracChangeset
for help on using the changeset viewer.