Changeset 1ac1ab4 in mainline for uspace/lib/ext4/libext4_directory_index.c
- Timestamp:
- 2012-03-31T20:00:15Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a2fa350
- Parents:
- 38384ae
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/ext4/libext4_directory_index.c
r38384ae r1ac1ab4 189 189 190 190 static int ext4_directory_dx_get_leaf(ext4_hash_info_t *hinfo, 191 ext4_ filesystem_t *fs, ext4_inode_ref_t *inode_ref, block_t *root_block,191 ext4_inode_ref_t *inode_ref, block_t *root_block, 192 192 ext4_directory_dx_block_t **dx_block, ext4_directory_dx_block_t *dx_blocks) 193 193 { … … 239 239 240 240 uint32_t fblock; 241 rc = ext4_filesystem_get_inode_data_block_index(fs, inode_ref, next_block, &fblock); 241 rc = ext4_filesystem_get_inode_data_block_index( 242 inode_ref, next_block, &fblock); 242 243 if (rc != EOK) { 243 244 return rc; 244 245 } 245 246 246 rc = block_get(&tmp_block, fs->device, fblock, BLOCK_FLAGS_NONE);247 rc = block_get(&tmp_block, inode_ref->fs->device, fblock, BLOCK_FLAGS_NONE); 247 248 if (rc != EOK) { 248 249 return rc; … … 250 251 251 252 entries = ((ext4_directory_dx_node_t *) tmp_block->data)->entries; 252 limit = ext4_directory_dx_countlimit_get_limit((ext4_directory_dx_countlimit_t *)entries); 253 254 uint16_t entry_space = ext4_superblock_get_block_size(fs->superblock) 253 limit = ext4_directory_dx_countlimit_get_limit( 254 (ext4_directory_dx_countlimit_t *)entries); 255 256 uint16_t entry_space = ext4_superblock_get_block_size(inode_ref->fs->superblock) 255 257 - sizeof(ext4_directory_dx_dot_entry_t); 256 258 entry_space = entry_space / sizeof(ext4_directory_dx_entry_t); … … 270 272 271 273 272 static int ext4_directory_dx_next_block(ext4_filesystem_t *fs, 273 ext4_inode_ref_t *inode_ref, uint32_t hash, 274 static int ext4_directory_dx_next_block(ext4_inode_ref_t *inode_ref, uint32_t hash, 274 275 ext4_directory_dx_block_t *handle, ext4_directory_dx_block_t *handles) 275 276 { … … 310 311 uint32_t block_idx = ext4_directory_dx_entry_get_block(p->position); 311 312 uint32_t block_addr; 312 rc = ext4_filesystem_get_inode_data_block_index( fs,inode_ref, block_idx, &block_addr);313 rc = ext4_filesystem_get_inode_data_block_index(inode_ref, block_idx, &block_addr); 313 314 if (rc != EOK) { 314 315 return rc; … … 316 317 317 318 block_t *block; 318 rc = block_get(&block, fs->device, block_addr, BLOCK_FLAGS_NONE);319 rc = block_get(&block, inode_ref->fs->device, block_addr, BLOCK_FLAGS_NONE); 319 320 if (rc != EOK) { 320 321 return rc; … … 334 335 335 336 int ext4_directory_dx_find_entry(ext4_directory_search_result_t *result, 336 ext4_ filesystem_t *fs, ext4_inode_ref_t *inode_ref, size_t name_len, const char *name)337 ext4_inode_ref_t *inode_ref, size_t name_len, const char *name) 337 338 { 338 339 int rc; … … 340 341 // get direct block 0 (index root) 341 342 uint32_t root_block_addr; 342 rc = ext4_filesystem_get_inode_data_block_index( fs,inode_ref, 0, &root_block_addr);343 rc = ext4_filesystem_get_inode_data_block_index(inode_ref, 0, &root_block_addr); 343 344 if (rc != EOK) { 344 345 return rc; 345 346 } 347 348 ext4_filesystem_t *fs = inode_ref->fs; 346 349 347 350 block_t *root_block; … … 361 364 ext4_directory_dx_block_t dx_blocks[2]; 362 365 ext4_directory_dx_block_t *dx_block, *tmp; 363 rc = ext4_directory_dx_get_leaf(&hinfo, fs,inode_ref, root_block, &dx_block, dx_blocks);366 rc = ext4_directory_dx_get_leaf(&hinfo, inode_ref, root_block, &dx_block, dx_blocks); 364 367 if (rc != EOK) { 365 368 block_put(root_block); … … 372 375 uint32_t leaf_block_idx = ext4_directory_dx_entry_get_block(dx_block->position); 373 376 uint32_t leaf_block_addr; 374 rc = ext4_filesystem_get_inode_data_block_index( fs,inode_ref, leaf_block_idx, &leaf_block_addr);377 rc = ext4_filesystem_get_inode_data_block_index(inode_ref, leaf_block_idx, &leaf_block_addr); 375 378 if (rc != EOK) { 376 379 goto cleanup; … … 400 403 } 401 404 402 rc = ext4_directory_dx_next_block( fs,inode_ref, hinfo.hash, dx_block, &dx_blocks[0]);405 rc = ext4_directory_dx_next_block(inode_ref, hinfo.hash, dx_block, &dx_blocks[0]); 403 406 if (rc < 0) { 404 407 goto cleanup; … … 524 527 uint32_t new_fblock; 525 528 uint32_t new_iblock; 526 rc = ext4_directory_append_block( fs,inode_ref, &new_fblock, &new_iblock);529 rc = ext4_directory_append_block(inode_ref, &new_fblock, &new_iblock); 527 530 if (rc != EOK) { 528 531 free(sort_array); … … 648 651 uint32_t new_fblock; 649 652 uint32_t new_iblock; 650 rc = ext4_directory_append_block( fs,inode_ref, &new_fblock, &new_iblock);653 rc = ext4_directory_append_block(inode_ref, &new_fblock, &new_iblock); 651 654 if (rc != EOK) { 652 655 return rc; … … 740 743 } 741 744 742 int ext4_directory_dx_add_entry(ext4_ filesystem_t *fs,743 ext4_inode_ref_t * parent, ext4_inode_ref_t *child, const char *name)745 int ext4_directory_dx_add_entry(ext4_inode_ref_t *parent, 746 ext4_inode_ref_t *child, const char *name) 744 747 { 745 748 int rc = EOK; … … 748 751 // get direct block 0 (index root) 749 752 uint32_t root_block_addr; 750 rc = ext4_filesystem_get_inode_data_block_index( fs,parent, 0, &root_block_addr);753 rc = ext4_filesystem_get_inode_data_block_index(parent, 0, &root_block_addr); 751 754 if (rc != EOK) { 752 755 return rc; 753 756 } 757 758 ext4_filesystem_t *fs = parent->fs; 754 759 755 760 block_t *root_block; … … 770 775 ext4_directory_dx_block_t dx_blocks[2]; 771 776 ext4_directory_dx_block_t *dx_block, *dx_it; 772 rc = ext4_directory_dx_get_leaf(&hinfo, fs,parent, root_block, &dx_block, dx_blocks);777 rc = ext4_directory_dx_get_leaf(&hinfo, parent, root_block, &dx_block, dx_blocks); 773 778 if (rc != EOK) { 774 779 rc = EXT4_ERR_BAD_DX_DIR; … … 780 785 uint32_t leaf_block_idx = ext4_directory_dx_entry_get_block(dx_block->position); 781 786 uint32_t leaf_block_addr; 782 rc = ext4_filesystem_get_inode_data_block_index( fs,parent, leaf_block_idx, &leaf_block_addr);787 rc = ext4_filesystem_get_inode_data_block_index(parent, leaf_block_idx, &leaf_block_addr); 783 788 if (rc != EOK) { 784 789 goto release_index;
Note:
See TracChangeset
for help on using the changeset viewer.