Changeset e8d054a in mainline
- Timestamp:
- 2012-03-05T10:40:06Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 2f619d5
- Parents:
- e63ce679
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/ext4/libext4_directory_index.c
re63ce679 re8d054a 383 383 result->block = leaf_block; 384 384 result->dentry = res_dentry; 385 return EOK;385 goto cleanup; 386 386 } 387 387 … … 400 400 } while (rc == 1); 401 401 402 r eturnENOENT;402 rc = ENOENT; 403 403 404 404 cleanup: … … 464 464 int rc = EOK; 465 465 466 // Allocate buffer for directory entries 466 467 uint32_t block_size = ext4_superblock_get_block_size(fs->superblock); 467 468 void *entry_buffer = malloc(block_size); … … 470 471 } 471 472 472 // Copy data to buffer473 memcpy(entry_buffer, old_data_block->data, block_size);474 475 473 // dot entry has the smallest size available 476 474 uint32_t max_entry_count = block_size / sizeof(ext4_directory_dx_dot_entry_t); 477 475 476 // Allocate sort entry 478 477 ext4_dx_sort_entry_t *sort_array = malloc(max_entry_count * sizeof(ext4_dx_sort_entry_t)); 479 478 if (sort_array == NULL) { … … 482 481 } 483 482 484 ext4_directory_entry_ll_t *dentry = old_data_block->data;485 486 483 uint32_t idx = 0; 487 484 uint32_t real_size = 0; 488 void *entry_buffer_ptr = entry_buffer; 489 485 486 // Initialize hinfo 490 487 ext4_hash_info_t tmp_hinfo; 491 488 memcpy(&tmp_hinfo, hinfo, sizeof(ext4_hash_info_t)); 492 489 490 // Load all valid entries to the buffer 491 ext4_directory_entry_ll_t *dentry = old_data_block->data; 492 void *entry_buffer_ptr = entry_buffer; 493 493 while ((void *)dentry < old_data_block->data + block_size) { 494 494 495 495 // Read only valid entries 496 496 if (ext4_directory_entry_ll_get_inode(dentry) != 0) { 497 char *name = (char *)dentry->name;498 497 499 498 uint8_t len = ext4_directory_entry_ll_get_name_length(fs->superblock, dentry); 500 ext4_hash_string(&tmp_hinfo, len, name);499 ext4_hash_string(&tmp_hinfo, len, (char *)dentry->name); 501 500 502 501 uint32_t rec_len = 8 + len; … … 788 787 } 789 788 790 if (rc != EOK) {791 goto terminate;792 }793 794 795 789 // TODO check rc handling 796 terminate:797 790 rc = block_put(new_block); 798 791 if (rc != EOK) { … … 807 800 rc = block_put(target_block); 808 801 if (rc != EOK) { 809 return rc; 802 EXT4FS_DBG("error writing target block"); 803 // return rc; 810 804 } 811 805 … … 814 808 815 809 while (dx_it <= dx_block) { 810 EXT4FS_DBG("dirty = \%s, refcount = \%u", dx_it->block->dirty ? "true" : "false", dx_it->block->refcnt); 816 811 rc = block_put(dx_it->block); 817 812 if (rc != EOK) { 818 return rc; 813 EXT4FS_DBG("error writing index block"); 814 // return rc; 819 815 } 820 816 dx_it++;
Note:
See TracChangeset
for help on using the changeset viewer.