Changeset 8158db7 in mainline for uspace/lib/ext4


Ignore:
Timestamp:
2011-10-19T11:44:13Z (14 years ago)
Author:
Frantisek Princ <frantisek.princ@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
246a5af
Parents:
7bd2c19
Message:

Hash functions implementation (ported from Linux)

Location:
uspace/lib/ext4
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/ext4/Makefile

    r7bd2c19 r8158db7  
    3737        libext4_extent.c \
    3838        libext4_filesystem.c \
     39        libext4_hash.c \
    3940        libext4_inode.c \
    4041        libext4_superblock.c
  • uspace/lib/ext4/libext4.h

    r7bd2c19 r8158db7  
    3838#include "libext4_extent.h"
    3939#include "libext4_filesystem.h"
     40#include "libext4_hash.h"
    4041#include "libext4_inode.h"
    4142#include "libext4_superblock.h"
  • uspace/lib/ext4/libext4_directory.c

    r7bd2c19 r8158db7  
    246246
    247247int ext4_directory_dx_find_entry(ext4_directory_iterator_t *it,
    248                 ext4_filesystem_t *fs, ext4_inode_ref_t *inode_ref, const char *name)
     248                ext4_filesystem_t *fs, ext4_inode_ref_t *inode_ref, size_t len, const char *name)
    249249{
    250250        int rc;
     
    253253        ext4_directory_dx_root_t *root;
    254254        uint32_t hash;
    255         ext4_directory_dx_hash_info_t hinfo;
     255        ext4_hash_info_t hinfo;
    256256
    257257        // get direct block 0 (index root)
     
    315315
    316316        hinfo.hash_version = ext4_directory_dx_root_info_get_hash_version(&root->info);
    317         if ((hinfo.hash_version <= EXT4_DIRECTORY_DX_HASH_TEA)
     317        if ((hinfo.hash_version <= EXT4_HASH_VERSION_TEA)
    318318                        && (ext4_superblock_has_flag(fs->superblock, EXT4_SUPERBLOCK_FLAGS_UNSIGNED_HASH))) {
    319319                // 3 is magic from ext4 linux implementation
     
    324324        hinfo.hash = 0;
    325325        if (name) {
    326                 ext4_directory_hash(&hinfo, name);
     326                ext4_hash_string(&hinfo, len, name);
    327327        }
    328328
     
    387387}
    388388
    389 void ext4_directory_hash(ext4_directory_dx_hash_info_t *hinfo, const char* name)
    390 {
    391         // TODO
    392 }
    393389
    394390/**
  • uspace/lib/ext4/libext4_directory.h

    r7bd2c19 r8158db7  
    9696} ext4_directory_dx_root_t;
    9797
    98 typedef struct ext4_directory_dx_hash_info {
    99         uint32_t hash;
    100         uint32_t minor_hash;
    101         uint32_t hash_version;
    102         uint32_t *seed;
    103 } ext4_directory_dx_hash_info_t;
    104 
    10598
    10699#define EXT4_ERR_BAD_DX_DIR                     (-75000)
    107 
    108 #define EXT4_DIRECTORY_DX_HASH_LEGACY                           0
    109 #define EXT4_DIRECTORY_DX_HASH_HALF_MD4                         1
    110 #define EXT4_DIRECTORY_DX_HASH_TEA                                      2
    111 #define EXT4_DIRECTORY_DX_HASH_LEGACY_UNSIGNED          3
    112 #define EXT4_DIRECTORY_DX_HASH_HALF_MD4_UNSIGNED        4
    113 #define EXT4_DIRECTORY_DX_HASH_TEA_UNSIGNED                     5
    114 
    115 #define EXT4_DIRECTORY_HTREE_EOF        0x7fffffff
     100#define EXT4_DIRECTORY_HTREE_EOF        (uint32_t)0x7fffffff
    116101
    117102
     
    138123extern int ext4_directory_iterator_fini(ext4_directory_iterator_t *);
    139124extern int ext4_directory_dx_find_entry(ext4_directory_iterator_t *,
    140                 ext4_filesystem_t *, ext4_inode_ref_t *, const char *);
    141 
    142 extern void ext4_directory_hash(ext4_directory_dx_hash_info_t *, const char* name);
     125                ext4_filesystem_t *, ext4_inode_ref_t *, size_t, const char *);
    143126
    144127#endif
Note: See TracChangeset for help on using the changeset viewer.