Changeset ca3d77a in mainline for uspace/lib/ext4


Ignore:
Timestamp:
2012-01-28T10:51:56Z (13 years ago)
Author:
Frantisek Princ <frantisek.princ@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7c506ced
Parents:
fe56c08a
Message:

some TODO's solved + removed debugging messages

Location:
uspace/lib/ext4
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/ext4/libext4_directory.c

    rfe56c08a rca3d77a  
    263263                const char *entry_name, ext4_inode_ref_t *child)
    264264{
    265         EXT4FS_DBG("adding dentry \%s to child inode \%u to directory \%u", entry_name, child->index, inode_ref->index);
    266 
    267265        int rc;
    268266
     
    281279                uint32_t entry_inode = ext4_directory_entry_ll_get_inode(it.current);
    282280                uint16_t rec_len = ext4_directory_entry_ll_get_entry_length(it.current);
    283 
    284                 EXT4FS_DBG("inode = \%u, rec_len == \%u, required_len = \%u", entry_inode, rec_len, required_len);
    285281
    286282                if ((entry_inode == 0) && (rec_len >= required_len)) {
     
    377373        }
    378374
     375        // Fill block with zeroes
     376        memset(new_block->data, 0, block_size);
     377
    379378        ext4_directory_entry_ll_t *block_entry = new_block->data;
    380379
  • uspace/lib/ext4/libext4_filesystem.c

    rfe56c08a rca3d77a  
    284284
    285285        // TODO extents, dir_index etc...
     286
    286287        rc = ext4_filesystem_get_inode_ref(fs, index, inode_ref);
    287288        if (rc != EOK) {
     
    325326        int rc;
    326327
    327         // release all indirect blocks
     328        // release all indirect (no data) blocks
    328329
    329330        // 1) Single indirect
     
    332333                rc = ext4_balloc_free_block(fs, inode_ref, fblock);
    333334                if (rc != EOK) {
    334                         // TODO error
     335                        return rc;
    335336                }
    336337
     
    443444                ext4_inode_ref_t *inode_ref, aoff64_t new_size)
    444445{
     446        int rc;
     447
    445448        if (! ext4_inode_can_truncate(fs->superblock, inode_ref->inode)) {
    446449                // Unable to truncate
     
    454457        }
    455458
     459        // It's not suppported to make the larger file
    456460        if (old_size < new_size) {
    457                 // Currently not supported to expand the file
    458                 // TODO
    459                 EXT4FS_DBG("trying to expand the file");
    460461                return EINVAL;
    461462        }
     
    463464        aoff64_t size_diff = old_size - new_size;
    464465        uint32_t block_size  = ext4_superblock_get_block_size(fs->superblock);
    465         uint32_t blocks_count = size_diff / block_size;
     466        uint32_t diff_blocks_count = size_diff / block_size;
    466467        if (size_diff % block_size != 0) {
    467                 blocks_count++;
    468         }
    469 
    470         uint32_t total_blocks = old_size / block_size;
     468                diff_blocks_count++;
     469        }
     470
     471        uint32_t old_blocks_count = old_size / block_size;
    471472        if (old_size % block_size != 0) {
    472                 total_blocks++;
     473                old_blocks_count++;
    473474        }
    474475
    475476        // starting from 1 because of logical blocks are numbered from 0
    476         for (uint32_t i = 1; i <= blocks_count; ++i) {
    477                 // TODO check retval
    478                 ext4_filesystem_release_inode_block(fs, inode_ref, total_blocks - i);
     477        for (uint32_t i = 1; i <= diff_blocks_count; ++i) {
     478                rc = ext4_filesystem_release_inode_block(fs, inode_ref, old_blocks_count - i);
     479                if (rc != EOK) {
     480                        return rc;
     481                }
    479482        }
    480483
Note: See TracChangeset for help on using the changeset viewer.