Changeset 668f1949 in mainline
- Timestamp:
- 2011-04-09T15:37:20Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- d0f3692
- Parents:
- e666ddc
- Location:
- uspace/srv/fs/minixfs
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/minixfs/mfs.c
re666ddc r668f1949 99 99 return; 100 100 case VFS_OUT_MOUNTED: 101 mfsdebug("Mount request received\n");102 101 mfs_mounted(callid, &call); 103 102 break; … … 109 108 break; 110 109 case VFS_OUT_LOOKUP: 111 mfsdebug("lookup called\n");112 110 mfs_lookup(callid, &call); 111 break; 112 case VFS_OUT_READ: 113 mfs_read(callid, &call); 113 114 break; 114 115 default: -
uspace/srv/fs/minixfs/mfs.h
re666ddc r668f1949 35 35 36 36 #include <minix.h> 37 #include <macros.h> 37 38 #include <libblock.h> 38 39 #include <libfs.h> … … 153 154 extern void mfs_stat(ipc_callid_t rid, ipc_call_t *request); 154 155 156 extern void 157 mfs_read(ipc_callid_t rid, ipc_call_t *request); 158 159 155 160 /*mfs_inode.c*/ 156 161 int -
uspace/srv/fs/minixfs/mfs_ops.c
re666ddc r668f1949 59 59 static int mfs_link(fs_node_t *pfn, fs_node_t *cfn, const char *name); 60 60 61 static 62 int mfs_node_get(fs_node_t **rfn, devmap_handle_t devmap_handle, 61 static int mfs_node_get(fs_node_t **rfn, devmap_handle_t devmap_handle, 63 62 fs_index_t index); 64 63 … … 381 380 assert(mnode->ino_i); 382 381 383 mfsdebug("inode links = %d\n", (int) mnode->ino_i->i_nlinks);384 mfsdebug("inode size is %d\n", (int) mnode->ino_i->i_size);385 386 382 return mnode->ino_i->i_size; 387 383 } … … 399 395 struct mfs_instance *instance; 400 396 401 mfsdebug("mfs_node_get()\n");402 403 397 rc = mfs_instance_get(devmap_handle, &instance); 404 398 … … 412 406 { 413 407 struct mfs_node *mnode = fsnode->data; 414 415 mfsdebug("mfs_node_put()\n");416 408 417 409 put_inode(mnode); … … 435 427 struct mfs_node *mnode = fsnode->data; 436 428 437 mfsdebug("mfs_index_get()\n");438 439 429 assert(mnode->ino_i); 440 430 return mnode->ino_i->index; … … 450 440 451 441 rc = mnode->ino_i->i_nlinks; 452 mfsdebug("mfs_lnkcnt_get(): %u\n", rc);453 442 return rc; 454 443 } … … 515 504 { 516 505 int rc = mfs_node_get(rfn, handle, MFS_ROOT_INO); 517 518 mfsdebug("mfs_root_get %s\n", rc == EOK ? "OK" : "FAIL");519 506 return rc; 520 507 } … … 577 564 } 578 565 579 /* 580 * Find a filesystem instance given the devmap handle 581 */ 566 void 567 mfs_read(ipc_callid_t rid, ipc_call_t *request) 568 { 569 int rc; 570 devmap_handle_t handle = (devmap_handle_t) IPC_GET_ARG1(*request); 571 fs_index_t index = (fs_index_t) IPC_GET_ARG2(*request); 572 aoff64_t pos = (aoff64_t) MERGE_LOUP32(IPC_GET_ARG3(*request), 573 IPC_GET_ARG4(*request)); 574 fs_node_t *fn; 575 576 rc = mfs_node_get(&fn, handle, index); 577 if (rc != EOK) { 578 async_answer_0(rid, rc); 579 return; 580 } 581 if (!fn) { 582 async_answer_0(rid, ENOENT); 583 return; 584 } 585 586 struct mfs_node *mnode; 587 struct mfs_ino_info *ino_i; 588 size_t len, bytes = 0; 589 ipc_callid_t callid; 590 591 mnode = fn->data; 592 ino_i = mnode->ino_i; 593 594 if (!async_data_read_receive(&callid, &len)) { 595 mfs_node_put(fn); 596 async_answer_0(callid, EINVAL); 597 async_answer_0(rid, EINVAL); 598 return; 599 } 600 601 if (S_ISDIR(ino_i->i_mode)) { 602 aoff64_t spos = pos; 603 struct mfs_dentry_info *d_info; 604 605 while (1) { 606 d_info = read_directory_entry(mnode, pos); 607 if (!d_info) { 608 /*Reached the end of the dentries list*/ 609 break; 610 } 611 612 if (d_info->d_inum) { 613 /*Dentry found!*/ 614 mfsdebug("DENTRY FOUND %s!!\n", d_info->d_name); 615 goto found; 616 } 617 618 free(d_info); 619 pos++; 620 } 621 622 rc = mfs_node_put(fn); 623 async_answer_0(callid, rc != EOK ? rc : ENOENT); 624 async_answer_1(rid, rc != EOK ? rc : ENOENT, 0); 625 return; 626 found: 627 async_data_read_finalize(callid, d_info->d_name, 628 str_size(d_info->d_name) + 1); 629 bytes = ((pos - spos) + 1); 630 } 631 632 rc = mfs_node_put(fn); 633 async_answer_1(rid, rc, (sysarg_t)bytes); 634 } 635 582 636 int mfs_instance_get(devmap_handle_t handle, struct mfs_instance **instance) 583 637 {
Note:
See TracChangeset
for help on using the changeset viewer.