Changeset f2ec8c8 in mainline
- Timestamp:
- 2008-03-11T20:33:53Z (17 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 923c39e
- Parents:
- 8ad8e49
- Location:
- uspace
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/libfs/libfs.c
r8ad8e49 rf2ec8c8 135 135 * @param request VFS_LOOKUP request data itself. 136 136 */ 137 void libfs_lookup(libfs_ops_t *ops, int fs_handle, ipc_callid_t rid,137 void libfs_lookup(libfs_ops_t *ops, fs_handle_t fs_handle, ipc_callid_t rid, 138 138 ipc_call_t *request) 139 139 { 140 140 unsigned next = IPC_GET_ARG1(*request); 141 141 unsigned last = IPC_GET_ARG2(*request); 142 int dev_handle = IPC_GET_ARG3(*request);142 dev_handle_t dev_handle = IPC_GET_ARG3(*request); 143 143 int lflag = IPC_GET_ARG4(*request); 144 int index = IPC_GET_ARG5(*request); /* when L_LINK specified */144 fs_index_t index = IPC_GET_ARG5(*request); /* when L_LINK specified */ 145 145 146 146 if (last < next) -
uspace/lib/libfs/libfs.h
r8ad8e49 rf2ec8c8 44 44 typedef struct { 45 45 bool (* match)(void *, void *, const char *); 46 void * (* node_get)( int, int, unsigned long);46 void * (* node_get)(fs_handle_t, dev_handle_t, fs_index_t); 47 47 void * (* create)(int); 48 48 void (* destroy)(void *); 49 49 bool (* link)(void *, void *, const char *); 50 50 int (* unlink)(void *, void *); 51 unsigned long(* index_get)(void *);52 unsigned long(* size_get)(void *);51 fs_index_t (* index_get)(void *); 52 size_t (* size_get)(void *); 53 53 unsigned (* lnkcnt_get)(void *); 54 54 void *(* child_get)(void *); … … 75 75 extern bool node_is_mp(int, unsigned long); 76 76 77 extern void libfs_lookup(libfs_ops_t *, int, ipc_callid_t, ipc_call_t *);77 extern void libfs_lookup(libfs_ops_t *, fs_handle_t, ipc_callid_t, ipc_call_t *); 78 78 79 79 #endif -
uspace/srv/fs/tmpfs/tmpfs.h
r8ad8e49 rf2ec8c8 44 44 45 45 typedef struct tmpfs_dentry { 46 unsigned longindex; /**< TMPFS node index. */46 fs_index_t index; /**< TMPFS node index. */ 47 47 link_t dh_link; /**< Dentries hash table link. */ 48 48 struct tmpfs_dentry *sibling; -
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); -
uspace/srv/vfs/vfs.h
r8ad8e49 rf2ec8c8 47 47 #define IPC_METHOD_TO_VFS_OP(m) ((m) - VFS_FIRST) 48 48 49 /* Basic types. */ 50 typedef int16_t fs_handle_t; 51 typedef int16_t dev_handle_t; 52 typedef uint32_t fs_index_t; 53 49 54 typedef enum { 50 55 VFS_READ = VFS_FIRST, … … 107 112 link_t fs_link; 108 113 vfs_info_t vfs_info; 109 int fs_handle;114 fs_handle_t fs_handle; 110 115 futex_t phone_futex; /**< Phone serializing futex. */ 111 116 ipcarg_t phone; … … 115 120 * VFS_PAIR uniquely represents a file system instance. 116 121 */ 117 #define VFS_PAIR \118 int fs_handle; \119 int dev_handle;122 #define VFS_PAIR \ 123 fs_handle_t fs_handle; \ 124 dev_handle_t dev_handle; 120 125 121 126 /** … … 128 133 #define VFS_TRIPLET \ 129 134 VFS_PAIR; \ 130 uint64_t index;135 fs_index_t index; 131 136 132 137 typedef struct { … … 257 262 extern rwlock_t namespace_rwlock; 258 263 259 extern int vfs_grab_phone( int);264 extern int vfs_grab_phone(fs_handle_t); 260 265 extern void vfs_release_phone(int); 261 266 262 extern int fs_name_to_handle(char *, bool);267 extern fs_handle_t fs_name_to_handle(char *, bool); 263 268 264 269 extern int vfs_lookup_internal(char *, int, vfs_lookup_res_t *, vfs_pair_t *, -
uspace/srv/vfs/vfs_lookup.c
r8ad8e49 rf2ec8c8 83 83 return EINVAL; 84 84 85 uint64_t index = 0;85 fs_index_t index = 0; 86 86 if (lflag & L_LINK) { 87 87 va_list ap; 88 88 89 89 va_start(ap, altroot); 90 index = va_arg(ap, uint64_t);90 index = va_arg(ap, fs_index_t); 91 91 va_end(ap); 92 92 } … … 178 178 179 179 if ((rc == EOK) && result) { 180 result->triplet.fs_handle = ( int) IPC_GET_ARG1(answer);181 result->triplet.dev_handle = ( int) IPC_GET_ARG2(answer);182 result->triplet.index = ( uint64_t) IPC_GET_ARG3(answer);180 result->triplet.fs_handle = (fs_handle_t) IPC_GET_ARG1(answer); 181 result->triplet.dev_handle = (dev_handle_t) IPC_GET_ARG2(answer); 182 result->triplet.index = (fs_index_t) IPC_GET_ARG3(answer); 183 183 result->size = (size_t) IPC_GET_ARG4(answer); 184 184 result->lnkcnt = (unsigned) IPC_GET_ARG5(answer); -
uspace/srv/vfs/vfs_ops.c
r8ad8e49 rf2ec8c8 54 54 55 55 /* Forward declarations of static functions. */ 56 static int vfs_truncate_internal( int, int, unsigned long, size_t);56 static int vfs_truncate_internal(fs_handle_t, dev_handle_t, fs_index_t, size_t); 57 57 58 58 /** … … 69 69 }; 70 70 71 static int lookup_root(int fs_handle, int dev_handle, vfs_lookup_res_t *result) 71 static int 72 lookup_root(fs_handle_t fs_handle, dev_handle_t dev_handle, 73 vfs_lookup_res_t *result) 72 74 { 73 75 vfs_pair_t altroot = { … … 81 83 void vfs_mount(ipc_callid_t rid, ipc_call_t *request) 82 84 { 83 int dev_handle;85 dev_handle_t dev_handle; 84 86 vfs_node_t *mp_node = NULL; 85 87 … … 89 91 * in the request. 90 92 */ 91 dev_handle = IPC_GET_ARG1(*request);93 dev_handle = (dev_handle_t)IPC_GET_ARG1(*request); 92 94 93 95 /* … … 128 130 * This will also give us its file system handle. 129 131 */ 130 int fs_handle = fs_name_to_handle(fs_name, true);132 fs_handle_t fs_handle = fs_name_to_handle(fs_name, true); 131 133 if (!fs_handle) { 132 134 ipc_answer_0(rid, ENOENT); … … 572 574 } 573 575 574 int vfs_truncate_internal(int fs_handle, int dev_handle, unsigned long index, 575 size_t size) 576 int 577 vfs_truncate_internal(fs_handle_t fs_handle, dev_handle_t dev_handle, 578 fs_index_t index, size_t size) 576 579 { 577 580 ipcarg_t rc; -
uspace/srv/vfs/vfs_register.c
r8ad8e49 rf2ec8c8 295 295 * system a global file system handle. 296 296 */ 297 fs_info->fs_handle = ( int) atomic_postinc(&fs_handle_next);297 fs_info->fs_handle = (fs_handle_t) atomic_postinc(&fs_handle_next); 298 298 ipc_answer_1(rid, EOK, (ipcarg_t) fs_info->fs_handle); 299 299 … … 312 312 * sent. Return 0 if no phone was found. 313 313 */ 314 int vfs_grab_phone( int handle)314 int vfs_grab_phone(fs_handle_t handle) 315 315 { 316 316 /* … … 387 387 * @return File system handle or zero if file system not found. 388 388 */ 389 int fs_name_to_handle(char *name, bool lock)389 fs_handle_t fs_name_to_handle(char *name, bool lock) 390 390 { 391 391 int handle = 0;
Note:
See TracChangeset
for help on using the changeset viewer.