Changeset 82d7816 in mainline
- Timestamp:
- 2011-11-24T21:16:11Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 14e9272
- Parents:
- 3d4fd2c
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/fs/ext4fs/ext4fs_ops.c
r3d4fd2c r82d7816 382 382 int ext4fs_destroy_node(fs_node_t *fn) 383 383 { 384 EXT4FS_DBG(""); 385 384 386 int rc; 385 387 … … 443 445 rc = ext4fs_has_children(&has_children, cfn); 444 446 if (rc != EOK) { 447 EXT4FS_DBG("\%s error: \%u", name, rc); 445 448 return rc; 446 449 } … … 448 451 // Cannot unlink non-empty node 449 452 if (has_children) { 453 EXT4FS_DBG("\%s is not empty", name); 450 454 return ENOTEMPTY; 451 455 } … … 456 460 rc = ext4_directory_remove_entry(fs, parent, name); 457 461 if (rc != EOK) { 462 EXT4FS_DBG("\%s removing entry failed: \%u", name, rc); 458 463 return rc; 459 464 } … … 463 468 464 469 uint32_t lnk_count = ext4_inode_get_links_count(child_inode_ref->inode); 470 EXT4FS_DBG("link count before == \%u", lnk_count); 465 471 lnk_count--; 466 ext4_inode_set_links_count(child_inode_ref->inode, lnk_count); 467 468 child_inode_ref->dirty = true; 469 470 // EXT4FS_DBG("links count = \%u", lnk_count); 472 471 473 472 474 // If directory - handle links from parent 473 475 if (lnk_count <= 1 && ext4fs_is_directory(cfn)) { 474 476 475 // EXT4FS_DBG("directory will be removed, lnlk_count = \%u", lnk_count);476 477 477 if (lnk_count) { 478 lnk_count = ext4_inode_get_links_count(child_inode_ref->inode);479 478 lnk_count--; 480 ext4_inode_set_links_count(child_inode_ref->inode, lnk_count); 481 } 482 483 // ext4_inode_ref_t *parent_inode_ref = EXT4FS_NODE(pfn)->inode_ref; 484 // uint32_t parent_lnk_count = ext4_inode_get_links_count( 485 // parent_inode_ref->inode); 486 // 487 // EXT4FS_DBG("directory will be removed, parent link count = \%u", parent_lnk_count); 488 // 489 // parent_lnk_count--; 490 // ext4_inode_set_links_count(parent_inode_ref->inode, parent_lnk_count); 491 // 492 // parent_inode_ref->dirty = true; 493 } 479 } 480 481 ext4_inode_ref_t *parent_inode_ref = EXT4FS_NODE(pfn)->inode_ref; 482 483 EXT4FS_DBG("parent index = \%u", parent_inode_ref->index); 484 485 uint32_t parent_lnk_count = ext4_inode_get_links_count( 486 parent_inode_ref->inode); 487 488 EXT4FS_DBG("directory will be removed, parent link count = \%u", parent_lnk_count); 489 490 parent_lnk_count--; 491 ext4_inode_set_links_count(parent_inode_ref->inode, parent_lnk_count); 492 493 parent_inode_ref->dirty = true; 494 } 495 496 ext4_inode_set_links_count(child_inode_ref->inode, lnk_count); 497 child_inode_ref->dirty = true; 498 499 EXT4FS_DBG("link count after == \%u", lnk_count); 494 500 495 501 return EOK; … … 567 573 { 568 574 ext4fs_node_t *enode = EXT4FS_NODE(fn); 569 unsigned count = ext4_inode_get_links_count(enode->inode_ref->inode); 570 return count; 575 return ext4_inode_get_links_count(enode->inode_ref->inode); 571 576 } 572 577 … … 1074 1079 int rc; 1075 1080 fs_node_t *fn; 1076 // aoff64_t old_size;1077 // aoff64_t size_diff;1078 1081 1079 1082 rc = ext4fs_node_get(&fn, service_id, index); … … 1090 1093 1091 1094 return rc; 1092 1093 // if (! ext4_inode_can_truncate(fs->superblock, inode_ref->inode)) {1094 // // Unable to truncate1095 // ext4fs_node_put(fn);1096 // return EINVAL;1097 // }1098 //1099 // old_size = ext4_inode_get_size(fs->superblock, inode_ref->inode);1100 //1101 // if (old_size == new_size) {1102 // ext4fs_node_put(fn);1103 // return EOK;1104 // } else {1105 //1106 // uint32_t block_size;1107 // uint32_t blocks_count, total_blocks;1108 // uint32_t i;1109 //1110 // block_size = ext4_superblock_get_block_size(fs->superblock);1111 //1112 // if (old_size < new_size) {1113 // // Currently not supported to expand the file1114 // // TODO1115 // EXT4FS_DBG("trying to expand the file");1116 // ext4fs_node_put(fn);1117 // return EINVAL;1118 // }1119 //1120 // size_diff = old_size - new_size;1121 // blocks_count = size_diff / block_size;1122 // if (size_diff % block_size != 0) {1123 // blocks_count++;1124 // }1125 //1126 // total_blocks = old_size / block_size;1127 // if (old_size % block_size != 0) {1128 // total_blocks++;1129 // }1130 //1131 // // starting from 1 because of logical blocks are numbered from 01132 // for (i = 1; i <= blocks_count; ++i) {1133 // // TODO check retval1134 // // TODO decrement inode->blocks_count1135 //1136 // ext4_filesystem_release_inode_block(fs, inode_ref, total_blocks - i);1137 // }1138 //1139 // ext4_inode_set_size(inode_ref->inode, new_size);1140 //1141 // inode_ref->dirty = true;1142 //1143 // }1144 //1145 // ext4fs_node_put(fn);1146 //1147 // return EOK;1148 1095 } 1149 1096
Note:
See TracChangeset
for help on using the changeset viewer.