Changeset e80c2ff in mainline for uspace/srv/fs/minixfs/mfs_ops.c
- Timestamp:
- 2011-07-06T19:56:57Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b89281b
- Parents:
- 70ac0af
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/minixfs/mfs_ops.c
r70ac0af re80c2ff 335 335 struct mfs_node *mnode = pfn->data; 336 336 struct mfs_ino_info *ino_i = mnode->ino_i; 337 struct mfs_dentry_info *d_info;337 struct mfs_dentry_info d_info; 338 338 int r; 339 339 … … 344 344 const size_t comp_size = str_size(component); 345 345 346 int i = 2;347 while (1) {348 r = read_directory_entry(mnode, &d_info, i ++);346 unsigned i; 347 for (i = 0; i < mnode->ino_i->i_size / sbi->dirsize; ++i) { 348 r = read_directory_entry(mnode, &d_info, i); 349 349 on_error(r, return r); 350 350 351 if (!d_info) { 352 /*Reached the end of the directory entry list*/ 353 break; 354 } 355 356 if (!d_info->d_inum) { 351 if (!d_info.d_inum) { 357 352 /*This entry is not used*/ 358 free(d_info);359 353 continue; 360 354 } 361 355 362 if (!bcmp(component, d_info ->d_name, min(sbi->max_name_len,356 if (!bcmp(component, d_info.d_name, min(sbi->max_name_len, 363 357 comp_size))) { 364 358 /*Hit!*/ 365 359 mfs_node_core_get(rfn, mnode->instance, 366 d_info->d_inum); 367 free(d_info); 360 d_info.d_inum); 368 361 goto found; 369 362 } 370 free(d_info);371 363 } 372 364 *rfn = NULL; … … 566 558 { 567 559 struct mfs_node *mnode = fsnode->data; 560 struct mfs_sb_info *sbi = mnode->instance->sbi; 568 561 int r; 569 562 … … 573 566 goto out; 574 567 575 struct mfs_dentry_info *d_info;568 struct mfs_dentry_info d_info; 576 569 577 570 /* The first two dentries are always . and .. */ 578 int i = 2;579 while (1) {580 r = read_directory_entry(mnode, &d_info, i ++);571 unsigned i; 572 for (i = 0; i < mnode->ino_i->i_size / sbi->dirsize; ++i) { 573 r = read_directory_entry(mnode, &d_info, i); 581 574 on_error(r, return r); 582 575 583 if (!d_info) { 584 /*Reached the end of the dentries list*/ 576 if (d_info.d_inum) { 577 /*A valid entry has been found*/ 578 *has_children = true; 585 579 break; 586 580 } 587 588 if (d_info->d_inum) { 589 /*A valid entry has been found*/ 590 *has_children = true; 591 free(d_info); 592 break; 593 } 594 595 free(d_info); 596 } 597 581 } 598 582 out: 599 583 … … 636 620 if (S_ISDIR(ino_i->i_mode)) { 637 621 aoff64_t spos = pos; 638 struct mfs_dentry_info *d_info; 639 640 while (1) { 622 struct mfs_dentry_info d_info; 623 struct mfs_sb_info *sbi = mnode->instance->sbi; 624 625 unsigned i; 626 for (i = pos; i < mnode->ino_i->i_size / sbi->dirsize; ++i) { 641 627 rc = read_directory_entry(mnode, &d_info, pos); 642 628 on_error(rc, goto out_error); 643 629 644 if (!d_info) { 645 /*Reached the end of the dentries list*/ 646 break; 647 } 648 649 if (d_info->d_inum) { 630 if (d_info.d_inum) { 650 631 /*Dentry found!*/ 651 632 goto found; 652 633 } 653 654 free(d_info);655 634 pos++; 656 635 } … … 661 640 return; 662 641 found: 663 async_data_read_finalize(callid, d_info ->d_name,664 str_size(d_info ->d_name) + 1);642 async_data_read_finalize(callid, d_info.d_name, 643 str_size(d_info.d_name) + 1); 665 644 bytes = ((pos - spos) + 1); 666 645 } else {
Note:
See TracChangeset
for help on using the changeset viewer.