Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 50601ef in mainline


Ignore:
Timestamp:
2012-02-08T19:38:26Z (8 years ago)
Author:
Frantisek Princ <frantisek.princ@…>
Branches:
master
Children:
03934c9e
Parents:
565b6ff
Message:

small code modification / reorganization

File:
1 edited

Legend:

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

    r565b6ff r50601ef  
    313313
    314314        // Linear algorithm
    315         uint16_t required_len = 8 + name_len + (4 - name_len % 4);
    316315
    317316        ext4_directory_iterator_t it;
     
    322321
    323322        uint32_t block_size = ext4_superblock_get_block_size(fs->superblock);
     323        uint16_t required_len = 8 + name_len + (4 - name_len % 4);
    324324
    325325        while (it.current != NULL) {
     
    328328
    329329                if ((entry_inode == 0) && (rec_len >= required_len)) {
    330 
    331330
    332331                        ext4_directory_write_entry(fs->superblock, it.current, rec_len,
     
    349348
    350349                        if (free_space >= required_len) {
    351                                 uint16_t used_len = rec_len - free_space;
    352350
    353351                                // Cut tail of current entry
    354                                 ext4_directory_entry_ll_set_entry_length(it.current, used_len);
     352                                ext4_directory_entry_ll_set_entry_length(it.current, used_space);
    355353
    356354                                // SEEK manually
    357355                                uint32_t local_offset = (it.current_offset % block_size);
    358                                 local_offset += used_len;
     356                                local_offset += used_space;
    359357                                ext4_directory_entry_ll_t *new_entry = it.current_block->data + local_offset;
    360358
     
    375373                }
    376374        }
     375
     376        EXT4FS_DBG("NO FREE SPACE - needed to allocate block");
    377377
    378378        // Save position and destroy iterator
Note: See TracChangeset for help on using the changeset viewer.