Changeset c028b22 in mainline for uspace/srv/fs/tmpfs
- Timestamp:
- 2011-07-08T17:01:01Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- cc1a727
- Parents:
- 4e36219 (diff), 026793d (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. - Location:
- uspace/srv/fs/tmpfs
- Files:
-
- 4 edited
-
tmpfs.c (modified) (7 diffs)
-
tmpfs.h (modified) (1 diff)
-
tmpfs_dump.c (modified) (1 diff)
-
tmpfs_ops.c (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/tmpfs/tmpfs.c
r4e36219 rc028b22 30 30 /** @addtogroup fs 31 31 * @{ 32 */ 32 */ 33 33 34 34 /** … … 43 43 #include "tmpfs.h" 44 44 #include <ipc/services.h> 45 #include < ipc/ns.h>45 #include <ns.h> 46 46 #include <async.h> 47 47 #include <errno.h> … … 82 82 * request has been completed. 83 83 */ 84 static void tmpfs_connection(ipc_callid_t iid, ipc_call_t *icall )84 static void tmpfs_connection(ipc_callid_t iid, ipc_call_t *icall, void *arg) 85 85 { 86 86 if (iid) { … … 94 94 95 95 dprintf(NAME ": connection opened\n"); 96 while (1) {97 ipc_callid_t callid;96 97 while (true) { 98 98 ipc_call_t call; 99 100 callid = async_get_call(&call); 101 switch (IPC_GET_IMETHOD(call)) { 102 case IPC_M_PHONE_HUNGUP: 99 ipc_callid_t callid = async_get_call(&call); 100 101 if (!IPC_GET_IMETHOD(call)) 103 102 return; 103 104 switch (IPC_GET_IMETHOD(call)) { 104 105 case VFS_OUT_MOUNTED: 105 106 tmpfs_mounted(callid, &call); … … 151 152 { 152 153 printf(NAME ": HelenOS TMPFS file system server\n"); 153 154 154 155 if (!tmpfs_init()) { 155 156 printf(NAME ": failed to initialize TMPFS\n"); 156 157 return -1; 157 158 } 158 159 int vfs_phone = service_connect_blocking(SERVICE_VFS, 0, 0); 160 if (vfs_phone < EOK) { 159 160 async_sess_t *vfs_sess = service_connect_blocking(EXCHANGE_SERIALIZE, 161 SERVICE_VFS, 0, 0); 162 if (!vfs_sess) { 161 163 printf(NAME ": Unable to connect to VFS\n"); 162 164 return -1; 163 165 } 164 165 int rc = fs_register(vfs_ phone, &tmpfs_reg, &tmpfs_vfs_info,166 167 int rc = fs_register(vfs_sess, &tmpfs_reg, &tmpfs_vfs_info, 166 168 tmpfs_connection); 167 169 if (rc != EOK) { … … 169 171 return rc; 170 172 } 171 173 172 174 printf(NAME ": Accepting connections\n"); 173 175 task_retval(0); 174 176 async_manager(); 175 /* not reached */ 177 178 /* Not reached */ 176 179 return 0; 177 180 } … … 179 182 /** 180 183 * @} 181 */ 184 */ -
uspace/srv/fs/tmpfs/tmpfs.h
r4e36219 rc028b22 67 67 size_t size; /**< File size if type is TMPFS_FILE. */ 68 68 void *data; /**< File content's if type is TMPFS_FILE. */ 69 li nk_t cs_head; /**< Head of child's siblings list. */69 list_t cs_list; /**< Child's siblings list. */ 70 70 } tmpfs_node_t; 71 71 -
uspace/srv/fs/tmpfs/tmpfs_dump.c
r4e36219 rc028b22 167 167 int rc; 168 168 169 rc = block_init( dev, TMPFS_COMM_SIZE);169 rc = block_init(EXCHANGE_SERIALIZE, dev, TMPFS_COMM_SIZE); 170 170 if (rc != EOK) 171 171 return false; -
uspace/srv/fs/tmpfs/tmpfs_ops.c
r4e36219 rc028b22 85 85 static int tmpfs_has_children(bool *has_children, fs_node_t *fn) 86 86 { 87 *has_children = !list_empty(&TMPFS_NODE(fn)->cs_ head);87 *has_children = !list_empty(&TMPFS_NODE(fn)->cs_list); 88 88 return EOK; 89 89 } … … 180 180 nh_link); 181 181 182 while (!list_empty(&nodep->cs_ head)) {183 tmpfs_dentry_t *dentryp = list_get_instance( nodep->cs_head.next,184 tmpfs_dentry_t, link);182 while (!list_empty(&nodep->cs_list)) { 183 tmpfs_dentry_t *dentryp = list_get_instance( 184 list_first(&nodep->cs_list), tmpfs_dentry_t, link); 185 185 186 186 assert(nodep->type == TMPFS_DIRECTORY); … … 214 214 nodep->data = NULL; 215 215 link_initialize(&nodep->nh_link); 216 list_initialize(&nodep->cs_ head);216 list_initialize(&nodep->cs_list); 217 217 } 218 218 … … 262 262 { 263 263 tmpfs_node_t *parentp = TMPFS_NODE(pfn); 264 link_t *lnk; 265 266 for (lnk = parentp->cs_head.next; lnk != &parentp->cs_head; 267 lnk = lnk->next) { 264 265 list_foreach(parentp->cs_list, lnk) { 268 266 tmpfs_dentry_t *dentryp; 269 267 dentryp = list_get_instance(lnk, tmpfs_dentry_t, link); … … 353 351 354 352 assert(!nodep->lnkcnt); 355 assert(list_empty(&nodep->cs_ head));353 assert(list_empty(&nodep->cs_list)); 356 354 357 355 unsigned long key[] = { … … 373 371 tmpfs_node_t *childp = TMPFS_NODE(cfn); 374 372 tmpfs_dentry_t *dentryp; 375 link_t *lnk;376 373 377 374 assert(parentp->type == TMPFS_DIRECTORY); 378 375 379 376 /* Check for duplicit entries. */ 380 for (lnk = parentp->cs_head.next; lnk != &parentp->cs_head; 381 lnk = lnk->next) { 377 list_foreach(parentp->cs_list, lnk) { 382 378 dentryp = list_get_instance(lnk, tmpfs_dentry_t, link); 383 379 if (!str_cmp(dentryp->name, nm)) … … 401 397 dentryp->node = childp; 402 398 childp->lnkcnt++; 403 list_append(&dentryp->link, &parentp->cs_ head);399 list_append(&dentryp->link, &parentp->cs_list); 404 400 405 401 return EOK; … … 411 407 tmpfs_node_t *childp = NULL; 412 408 tmpfs_dentry_t *dentryp; 413 link_t *lnk;414 409 415 410 if (!parentp) 416 411 return EBUSY; 417 412 418 for (lnk = parentp->cs_head.next; lnk != &parentp->cs_head; 419 lnk = lnk->next) { 413 list_foreach(parentp->cs_list, lnk) { 420 414 dentryp = list_get_instance(lnk, tmpfs_dentry_t, link); 421 415 if (!str_cmp(dentryp->name, nm)) { … … 423 417 assert(FS_NODE(childp) == cfn); 424 418 break; 425 } 419 } 426 420 } 427 421 … … 429 423 return ENOENT; 430 424 431 if ((childp->lnkcnt == 1) && !list_empty(&childp->cs_ head))425 if ((childp->lnkcnt == 1) && !list_empty(&childp->cs_list)) 432 426 return ENOTEMPTY; 433 427 … … 550 544 tmpfs_dentry_t *dentryp; 551 545 link_t *lnk; 552 aoff64_t i;553 546 554 547 assert(nodep->type == TMPFS_DIRECTORY); … … 559 552 * hash table. 560 553 */ 561 for (i = 0, lnk = nodep->cs_head.next; 562 (i < pos) && (lnk != &nodep->cs_head); 563 i++, lnk = lnk->next) 564 ; 565 566 if (lnk == &nodep->cs_head) { 554 lnk = list_nth(&nodep->cs_list, pos); 555 556 if (lnk == NULL) { 567 557 async_answer_0(callid, ENOENT); 568 558 async_answer_1(rid, ENOENT, 0);
Note:
See TracChangeset
for help on using the changeset viewer.
