Changes in / [ff4f073:5c96b2a] in mainline


Ignore:
Location:
uspace
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified uspace/app/ext2info/ext2info.c

    rff4f073 r5c96b2a  
    586586        ext2_directory_iterator_t it;
    587587        size_t name_size;
    588         uint32_t inode;
    589588       
    590589        printf("  Directory contents:\n");
     
    601600                printf("    ");
    602601                print_data(&it.current->name, name_size);
    603                
    604                 inode = ext2_directory_entry_ll_get_inode(it.current);
    605                 printf(" --> %u\n", inode);
     602                printf(" --> %u\n", it.current->inode);
    606603               
    607604                rc = ext2_directory_iterator_next(&it);
  • TabularUnified uspace/lib/ext2/libext2_directory.c

    rff4f073 r5c96b2a  
    4040#include <assert.h>
    4141
    42 static int ext2_directory_iterator_set(ext2_directory_iterator_t *it,
    43     uint32_t block_size);
    44 
    4542/**
    4643 * Get inode number for the directory entry
     
    9390        int rc;
    9491        uint32_t block_id;
    95         uint32_t block_size;
    96        
    9792        it->inode_ref = inode_ref;
    9893        it->fs = fs;
     
    110105        }
    111106       
    112         block_size = ext2_superblock_get_block_size(fs->superblock);
    113        
    114         it->current_offset = 0;
    115         return ext2_directory_iterator_set(it, block_size);
     107        it->current = it->current_block->data;
     108        it->current_offset = 0;
     109       
     110        return EOK;
    116111}
    117112
     
    131126        uint32_t next_block_phys_idx;
    132127        uint32_t block_size;
     128        uint32_t offset_in_block;
    133129       
    134130        assert(it->current != NULL);
     
    179175        }
    180176       
    181         it->current_offset += skip;
    182         return ext2_directory_iterator_set(it, block_size);
    183 }
    184 
    185 static int ext2_directory_iterator_set(ext2_directory_iterator_t *it,
    186     uint32_t block_size)
    187 {
    188         uint32_t offset_in_block = it->current_offset % block_size;
    189        
    190         it->current = NULL;
     177        offset_in_block = (it->current_offset + skip) % block_size;
    191178       
    192179        /* Ensure proper alignment */
    193180        if ((offset_in_block % 4) != 0) {
     181                it->current = NULL;
    194182                return EIO;
    195183        }
     
    197185        /* Ensure that the core of the entry does not overflow the block */
    198186        if (offset_in_block > block_size - 8) {
    199                 return EIO;
    200         }
    201        
    202         ext2_directory_entry_ll_t *entry = it->current_block->data + offset_in_block;
     187                it->current = NULL;
     188                return EIO;
     189        }
     190               
     191        it->current = it->current_block->data + offset_in_block;
     192        it->current_offset += skip;
    203193       
    204194        /* Ensure that the whole entry does not overflow the block */
    205         uint16_t length = ext2_directory_entry_ll_get_entry_length(entry);
    206         if (offset_in_block + length > block_size) {
     195        skip = ext2_directory_entry_ll_get_entry_length(it->current);
     196        if (offset_in_block + skip > block_size) {
     197                it->current = NULL;
    207198                return EIO;
    208199        }
     
    210201        /* Ensure the name length is not too large */
    211202        if (ext2_directory_entry_ll_get_name_length(it->fs->superblock,
    212             entry) > length-8) {
    213                 return EIO;
    214         }
    215        
    216         it->current = entry;
     203            it->current) > skip-8) {
     204                it->current = NULL;
     205                return EIO;
     206        }
     207       
    217208        return EOK;
    218209}
  • TabularUnified uspace/lib/ext2/libext2_filesystem.c

    rff4f073 r5c96b2a  
    4242#include <malloc.h>
    4343#include <assert.h>
    44 #include <byteorder.h>
    4544
    4645/**
     
    370369               
    371370                assert(offset_in_block < block_ids_per_block);
    372                 current_block = uint32_t_le2host(((uint32_t*)block->data)[offset_in_block]);
     371                current_block = ((uint32_t*)block->data)[offset_in_block];
    373372               
    374373                rc = block_put(block);
  • TabularUnified uspace/lib/ext2/libext2_superblock.c

    rff4f073 r5c96b2a  
    184184                return EXT2_REV0_INODE_SIZE;
    185185        }
    186         return uint16_t_le2host(sb->inode_size);
     186        return uint32_t_le2host(sb->inode_size);
    187187}
    188188
  • TabularUnified uspace/srv/fs/ext2fs/ext2fs_ops.c

    rff4f073 r5c96b2a  
    232232        size_t component_size;
    233233        bool found = false;
    234         uint32_t inode;
    235234       
    236235        fs = eparent->instance->filesystem;
     
    255254       
    256255        while (it.current != NULL) {
    257                 inode = ext2_directory_entry_ll_get_inode(it.current);
    258                
    259256                /* ignore empty directory entries */
    260                 if (inode != 0) {
     257                if (it.current->inode != 0) {
    261258                        name_size = ext2_directory_entry_ll_get_name_length(fs->superblock,
    262259                                it.current);
     
    265262                                    name_size) == 0) {
    266263                                rc = ext2fs_node_get_core(rfn, eparent->instance,
    267                                         inode);
     264                                        it.current->inode);
    268265                                if (rc != EOK) {
    269266                                        ext2_directory_iterator_fini(&it);
Note: See TracChangeset for help on using the changeset viewer.