Changes in uspace/srv/fs/mfs/mfs_ops.c [9d58539:df3caec5] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/mfs/mfs_ops.c
r9d58539 rdf3caec5 384 384 if (flags & L_DIRECTORY) { 385 385 ino_i->i_mode = S_IFDIR; 386 ino_i->i_nlinks = 1; /* This accounts for the '.' dentry */387 } else 386 ino_i->i_nlinks = 2; /* This accounts for the '.' dentry */ 387 } else { 388 388 ino_i->i_mode = S_IFREG; 389 ino_i->i_nlinks = 1; 390 } 389 391 390 392 ino_i->i_uid = 0; … … 664 666 struct mfs_node *child = cfn->data; 665 667 struct mfs_sb_info *sbi = parent->instance->sbi; 666 bool destroy_dentry = false;667 668 668 669 mfsdebug("%s()\n", __FUNCTION__); … … 673 674 int r = mfs_insert_dentry(parent, name, child->ino_i->index); 674 675 if (r != EOK) 675 returnr;676 goto exit_error; 676 677 677 678 if (S_ISDIR(child->ino_i->i_mode)) { 678 if (child->ino_i->i_nlinks != 1) {679 /* It's not possible to hardlink directories in MFS */680 destroy_dentry = true;681 r = EMLINK;682 goto exit;683 }684 679 r = mfs_insert_dentry(child, ".", child->ino_i->index); 685 if (r != EOK) { 686 destroy_dentry = true; 687 goto exit; 688 } 680 if (r != EOK) 681 goto exit_error; 689 682 690 683 r = mfs_insert_dentry(child, "..", parent->ino_i->index); 691 if (r != EOK) { 692 destroy_dentry = true; 693 goto exit; 694 } 684 if (r != EOK) 685 goto exit_error; 695 686 696 687 parent->ino_i->i_nlinks++; … … 698 689 } 699 690 700 exit: 701 if (destroy_dentry) { 702 int r2 = mfs_remove_dentry(parent, name); 703 if (r2 != EOK) 704 r = r2; 705 } else { 706 child->ino_i->i_nlinks++; 707 child->ino_i->dirty = true; 708 } 691 exit_error: 709 692 return r; 710 693 } … … 837 820 found: 838 821 async_data_read_finalize(callid, d_info.d_name, 839 822 str_size(d_info.d_name) + 1); 840 823 bytes = ((pos - spos) + 1); 841 824 } else {
Note:
See TracChangeset
for help on using the changeset viewer.