summaryrefslogtreecommitdiff
path: root/lib/sqfs/readdir.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-07-07 01:32:19 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-07-07 01:32:19 +0200
commita295f58338b1e0d5dfb2eed57026cafacf266d7d (patch)
tree69ec8bb3a0b5e4045c31e1b1afd4b24c6a567960 /lib/sqfs/readdir.c
parentb2598623d8a4e3d3e83ee28da3ecdb0d4479a8f8 (diff)
Actually encode/decode directory inode difference as signed
The directory listing stores a signed difference of the inode number. Actually treating it as signed saves emitting extra headers if hard links or file deduplication are finally implemented. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/sqfs/readdir.c')
-rw-r--r--lib/sqfs/readdir.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/sqfs/readdir.c b/lib/sqfs/readdir.c
index 142bafb..71beedc 100644
--- a/lib/sqfs/readdir.c
+++ b/lib/sqfs/readdir.c
@@ -19,12 +19,15 @@ int meta_reader_read_dir_header(meta_reader_t *m, sqfs_dir_header_t *hdr)
sqfs_dir_entry_t *meta_reader_read_dir_ent(meta_reader_t *m)
{
sqfs_dir_entry_t ent, *out;
+ uint16_t *diff_u16;
if (meta_reader_read(m, &ent, sizeof(ent)))
return NULL;
+ diff_u16 = (uint16_t *)&ent.inode_diff;
+ *diff_u16 = le16toh(*diff_u16);
+
ent.offset = le16toh(ent.offset);
- ent.inode_number = le16toh(ent.inode_number);
ent.type = le16toh(ent.type);
ent.size = le16toh(ent.size);