Changeset ab77928 in mainline for uspace/lib/ext4/libext4_hash.c


Ignore:
Timestamp:
2011-10-26T09:27:01Z (14 years ago)
Author:
Frantisek Princ <frantisek.princ@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0dc91833
Parents:
aaedaba
Message:

complete directory index reading (it runs) - many TODOs remaining

File:
1 edited

Legend:

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

    raaedaba rab77928  
    4949#define H(x, y, z) ((x) ^ (y) ^ (z))
    5050
     51
    5152/*
    5253 * The generic round function.  The application is so specific that
     
    6263
    6364
    64 static void tea_transform(uint32_t buf[4],uint32_t const in[])
     65static void tea_transform(uint32_t buf[4], uint32_t const in[])
    6566{
    6667        uint32_t sum = 0;
     
    233234    int i;
    234235    uint32_t in[8], buf[4];
    235     bool unsigned_version = false;
     236    void (*str2hashbuf)(const char *, int, uint32_t *, int) = str2hashbuf_signed;
     237
     238    /*
     239    for (i = 0; i < 8; ++i) {
     240        in[i] = 0;
     241    }
     242    */
    236243
    237244    /* Initialize the default seed for the hash checksum functions */
     
    247254                break;
    248255                        }
    249                         if (i < 4) {
    250                                 memcpy(buf, hinfo->seed, sizeof(buf));
    251                         }
     256                }
     257                if (i < 4) {
     258                        memcpy(buf, hinfo->seed, sizeof(buf));
    252259                }
    253260    }
     
    264271
    265272                case EXT4_HASH_VERSION_HALF_MD4_UNSIGNED:
    266                         unsigned_version = true;
     273                        str2hashbuf = str2hashbuf_unsigned;
    267274
    268275                case EXT4_HASH_VERSION_HALF_MD4:
    269276                        p = name;
    270277                        while (len > 0) {
    271                                 if (unsigned_version) {
    272                                         str2hashbuf_unsigned(p, len, in, 8);
    273                                 } else {
    274                                         str2hashbuf_signed(p, len, in, 8);
    275                                 }
     278                                (*str2hashbuf)(p, len, in, 8);
    276279                                half_md4_transform(buf, in);
    277280                                len -= 32;
     
    284287
    285288                case EXT4_HASH_VERSION_TEA_UNSIGNED:
    286                         unsigned_version = true;
     289                        str2hashbuf = str2hashbuf_unsigned;
    287290
    288291                case EXT4_HASH_VERSION_TEA:
    289292                        p = name;
    290293                        while (len > 0) {
    291                                 if (unsigned_version) {
    292                                         str2hashbuf_unsigned(p, len, in, 4);
    293                                 } else {
    294                                         str2hashbuf_signed(p, len, in, 4);
    295                                 }
     294                                (*str2hashbuf)(p, len, in, 4);
    296295                                tea_transform(buf, in);
    297296                                len -= 16;
     
    311310                hash = (EXT4_DIRECTORY_HTREE_EOF-1) << 1;
    312311        }
     312
    313313        hinfo->hash = hash;
    314314        hinfo->minor_hash = minor_hash;
Note: See TracChangeset for help on using the changeset viewer.