struct hash_entry {
ext2_dirhash_t hash;
ext2_dirhash_t minor_hash;
+ ino_t ino;
struct ext2_dir_entry *dir;
};
ent = fd->harray + fd->num_array++;
ent->dir = dirent;
fd->dir_size += EXT2_DIR_REC_LEN(dirent->name_len & 0xFF);
+ ent->ino = dirent->inode;
if (fd->compress)
ent->hash = ent->minor_hash = 0;
else {
}
/* Used for sorting the hash entry */
+static EXT2_QSORT_TYPE ino_cmp(const void *a, const void *b)
+{
+ const struct hash_entry *he_a = (const struct hash_entry *) a;
+ const struct hash_entry *he_b = (const struct hash_entry *) b;
+
+ return (he_a->ino - he_b->ino);
+}
+
+/* Used for sorting the hash entry */
static EXT2_QSORT_TYPE name_cmp(const void *a, const void *b)
{
const struct hash_entry *he_a = (const struct hash_entry *) a;
resort:
if (fd.compress)
qsort(fd.harray+2, fd.num_array-2,
- sizeof(struct hash_entry), name_cmp);
+ sizeof(struct hash_entry), ino_cmp);
else
qsort(fd.harray, fd.num_array,
sizeof(struct hash_entry), hash_cmp);