Changeset 12f55220 in mainline


Ignore:
Timestamp:
2011-10-18T06:29:00Z (13 years ago)
Author:
Frantisek Princ <frantisek.princ@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7bc4508
Parents:
22ceff3a
Message:

first structures for reading indexed directories

Location:
uspace
Files:
2 edited

Legend:

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

    r22ceff3a r12f55220  
    3737#include "libext4_inode.h"
    3838
    39 #define EXT4_FILENAME_LEN       255
     39#define EXT4_DIRECTORY_FILENAME_LEN     255
    4040
    4141/**
     
    5050                uint8_t inode_type; // Type of referenced inode (in rev >= 0.5)
    5151        } __attribute__ ((packed));
    52         uint8_t name[EXT4_FILENAME_LEN]; // Entry name
     52        uint8_t name[EXT4_DIRECTORY_FILENAME_LEN]; // Entry name
    5353} __attribute__ ((packed)) ext4_directory_entry_ll_t;
    5454
     
    6060        ext4_directory_entry_ll_t *current;
    6161} ext4_directory_iterator_t;
     62
     63
     64/* Structures for indexed directory */
     65
     66typedef struct ext4_directory_dx_dot_entry {
     67        uint32_t inode;
     68        uint16_t entry_length;
     69    uint8_t name_length;
     70    uint8_t inode_type;
     71    uint8_t name[4];
     72} ext4_directory_dx_dot_entry_t;
     73
     74typedef struct ext4_directory_dx_root_info {
     75        uint32_t reserved_zero;
     76        uint8_t hash_version;
     77        uint8_t info_length;
     78        uint8_t indirect_levels;
     79        uint8_t unused_flags;
     80} ext4_directory_dx_root_info_t;
     81
     82typedef struct ext4_directory_dx_entry {
     83        uint32_t hash;
     84        uint32_t block;
     85} ext4_directory_dx_entry_t;
     86
     87typedef struct ext4_directory_dx_root {
     88                ext4_directory_dx_dot_entry_t dots[2];
     89                // TODO insert root info items instead of special datatype
     90                ext4_directory_dx_root_info_t info;
     91                ext4_directory_dx_entry_t *entries;
     92} ext4_directory_dx_root_t;
     93
     94
     95#define EXT4_DIRECTORY_HTREE_EOF  0x7fffffff
     96
    6297
    6398extern uint32_t ext4_directory_entry_ll_get_inode(ext4_directory_entry_ll_t *);
  • uspace/srv/fs/ext4fs/ext4fs_ops.c

    r22ceff3a r12f55220  
    7575static int ext4fs_read_directory(ipc_callid_t, aoff64_t, size_t,
    7676    ext4fs_instance_t *, ext4_inode_ref_t *, size_t *);
     77static int ext4fs_read_dx_directory(ipc_callid_t, aoff64_t, size_t,
     78    ext4fs_instance_t *, ext4_inode_ref_t *, size_t *);
    7779static int ext4fs_read_file(ipc_callid_t, aoff64_t, size_t, ext4fs_instance_t *,
    7880    ext4_inode_ref_t *, size_t *);
     
    746748        bool found = false;
    747749
    748         // TODO check if directory uses HTree
     750        // TODO check super block COMPAT FEATURES
    749751        if (ext4_inode_has_flag(inode_ref->inode, EXT4_INODE_FLAG_INDEX)) {
    750                 EXT4FS_DBG("Directory using HTree");
     752                rc = ext4fs_read_dx_directory(callid, pos, size, inst, inode_ref, rbytes);
     753                // TODO return...
     754                // return rc;
    751755        }
    752756
     
    821825                return ENOENT;
    822826        }
     827}
     828
     829int ext4fs_read_dx_directory(ipc_callid_t callid, aoff64_t pos, size_t size,
     830    ext4fs_instance_t *inst, ext4_inode_ref_t *inode_ref, size_t *rbytes)
     831{
     832        EXT4FS_DBG("Directory using HTree index");
     833        return ENOTSUP;
    823834}
    824835
Note: See TracChangeset for help on using the changeset viewer.