summaryrefslogtreecommitdiff
path: root/lib/sqfs/xattr
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2021-03-07 01:14:13 +0100
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2021-03-07 01:18:03 +0100
commit257a5737d708b706be29526050f61ded9793d0ab (patch)
treeb7b5789e63a85187c0cbffb965c9c7233bb26249 /lib/sqfs/xattr
parent5cc1d55d769e278f51eeb057b08d04afd6bb0c44 (diff)
Rewrite the str_table to internally use the more opimized hash_table
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/sqfs/xattr')
-rw-r--r--lib/sqfs/xattr/xattr_writer.c4
-rw-r--r--lib/sqfs/xattr/xattr_writer.h2
-rw-r--r--lib/sqfs/xattr/xattr_writer_flush.c4
3 files changed, 4 insertions, 6 deletions
diff --git a/lib/sqfs/xattr/xattr_writer.c b/lib/sqfs/xattr/xattr_writer.c
index e38c2be..c49aaf1 100644
--- a/lib/sqfs/xattr/xattr_writer.c
+++ b/lib/sqfs/xattr/xattr_writer.c
@@ -95,10 +95,10 @@ sqfs_xattr_writer_t *sqfs_xattr_writer_create(sqfs_u32 flags)
if (xwr == NULL)
return NULL;
- if (str_table_init(&xwr->keys, XATTR_KEY_BUCKETS))
+ if (str_table_init(&xwr->keys))
goto fail_keys;
- if (str_table_init(&xwr->values, XATTR_VALUE_BUCKETS))
+ if (str_table_init(&xwr->values))
goto fail_values;
if (array_init(&xwr->kv_pairs, sizeof(sqfs_u64),
diff --git a/lib/sqfs/xattr/xattr_writer.h b/lib/sqfs/xattr/xattr_writer.h
index ff8479a..6f414b8 100644
--- a/lib/sqfs/xattr/xattr_writer.h
+++ b/lib/sqfs/xattr/xattr_writer.h
@@ -28,8 +28,6 @@
#include <assert.h>
-#define XATTR_KEY_BUCKETS 31
-#define XATTR_VALUE_BUCKETS 511
#define XATTR_INITIAL_PAIR_CAP 128
#define MK_PAIR(key, value) (((sqfs_u64)(key) << 32UL) | (sqfs_u64)(value))
diff --git a/lib/sqfs/xattr/xattr_writer_flush.c b/lib/sqfs/xattr/xattr_writer_flush.c
index 85ec724..98d2619 100644
--- a/lib/sqfs/xattr/xattr_writer_flush.c
+++ b/lib/sqfs/xattr/xattr_writer_flush.c
@@ -200,11 +200,11 @@ static int write_kv_pairs(const sqfs_xattr_writer_t *xwr,
size_t i;
ool_locations = alloc_array(sizeof(ool_locations[0]),
- xwr->values.num_strings);
+ str_table_count(&xwr->values));
if (ool_locations == NULL)
return SQFS_ERROR_ALLOC;
- for (i = 0; i < xwr->values.num_strings; ++i)
+ for (i = 0; i < str_table_count(&xwr->values); ++i)
ool_locations[i] = 0xFFFFFFFFFFFFFFFFUL;
for (blk = xwr->kv_block_first; blk != NULL; blk = blk->next) {