summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-06-09 06:51:31 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-06-09 06:51:31 +0200
commitec5ba7eb521626a85d2ab22e97eb1298b2ff6f55 (patch)
treee23054b1182a8d79172fed5360a6fc26380eb5c5 /lib
parent322f6069de6c5e460a0c3b253d36b90ac30bef70 (diff)
Cleanup: mark sqfs_xattr_writer_flush writer argument as const
It does not make any changes to the writer itself, so mark it as const. This also requires some similar changes to the string table. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib')
-rw-r--r--lib/sqfs/xattr/xattr_writer_flush.c25
-rw-r--r--lib/util/str_table.c6
2 files changed, 18 insertions, 13 deletions
diff --git a/lib/sqfs/xattr/xattr_writer_flush.c b/lib/sqfs/xattr/xattr_writer_flush.c
index 9b3de30..53c3187 100644
--- a/lib/sqfs/xattr/xattr_writer_flush.c
+++ b/lib/sqfs/xattr/xattr_writer_flush.c
@@ -140,8 +140,10 @@ static bool should_store_ool(const char *val_str, size_t refcount)
return (strlen(val_str) / 2) > sizeof(sqfs_u64);
}
-static int write_block_pairs(sqfs_xattr_writer_t *xwr, sqfs_meta_writer_t *mw,
- kv_block_desc_t *blk, sqfs_u64 *ool_locations)
+static int write_block_pairs(const sqfs_xattr_writer_t *xwr,
+ sqfs_meta_writer_t *mw,
+ const kv_block_desc_t *blk,
+ sqfs_u64 *ool_locations)
{
sqfs_u32 key_idx, val_idx;
const char *key_str, *value_str;
@@ -188,7 +190,8 @@ static int write_block_pairs(sqfs_xattr_writer_t *xwr, sqfs_meta_writer_t *mw,
return total;
}
-static int write_kv_pairs(sqfs_xattr_writer_t *xwr, sqfs_meta_writer_t *mw)
+static int write_kv_pairs(const sqfs_xattr_writer_t *xwr,
+ sqfs_meta_writer_t *mw)
{
sqfs_u64 block, *ool_locations;
kv_block_desc_t *blk;
@@ -221,7 +224,8 @@ static int write_kv_pairs(sqfs_xattr_writer_t *xwr, sqfs_meta_writer_t *mw)
return sqfs_meta_writer_flush(mw);
}
-static int write_id_table(sqfs_xattr_writer_t *xwr, sqfs_meta_writer_t *mw,
+static int write_id_table(const sqfs_xattr_writer_t *xwr,
+ sqfs_meta_writer_t *mw,
sqfs_u64 *locations)
{
sqfs_xattr_id_t id_ent;
@@ -251,9 +255,10 @@ static int write_id_table(sqfs_xattr_writer_t *xwr, sqfs_meta_writer_t *mw,
return sqfs_meta_writer_flush(mw);
}
-static int write_location_table(sqfs_xattr_writer_t *xwr, sqfs_u64 kv_start,
- sqfs_file_t *file, const sqfs_super_t *super,
- sqfs_u64 *locations, size_t loc_count)
+static int write_location_table(const sqfs_xattr_writer_t *xwr,
+ sqfs_u64 kv_start, sqfs_file_t *file,
+ const sqfs_super_t *super, sqfs_u64 *locations,
+ size_t loc_count)
{
sqfs_xattr_id_table_t idtbl;
int err;
@@ -271,8 +276,8 @@ static int write_location_table(sqfs_xattr_writer_t *xwr, sqfs_u64 kv_start,
locations, sizeof(locations[0]) * loc_count);
}
-static int alloc_location_table(sqfs_xattr_writer_t *xwr, sqfs_u64 **tbl_out,
- size_t *szout)
+static int alloc_location_table(const sqfs_xattr_writer_t *xwr,
+ sqfs_u64 **tbl_out, size_t *szout)
{
sqfs_u64 *locations;
size_t size, count;
@@ -293,7 +298,7 @@ static int alloc_location_table(sqfs_xattr_writer_t *xwr, sqfs_u64 **tbl_out,
return 0;
}
-int sqfs_xattr_writer_flush(sqfs_xattr_writer_t *xwr, sqfs_file_t *file,
+int sqfs_xattr_writer_flush(const sqfs_xattr_writer_t *xwr, sqfs_file_t *file,
sqfs_super_t *super, sqfs_compressor_t *cmp)
{
sqfs_u64 *locations = NULL, kv_start, id_start;
diff --git a/lib/util/str_table.c b/lib/util/str_table.c
index cea34dc..1463546 100644
--- a/lib/util/str_table.c
+++ b/lib/util/str_table.c
@@ -189,7 +189,7 @@ fail_oom:
return SQFS_ERROR_ALLOC;
}
-const char *str_table_get_string(str_table_t *table, size_t index)
+const char *str_table_get_string(const str_table_t *table, size_t index)
{
if (index >= table->num_strings)
return NULL;
@@ -197,7 +197,7 @@ const char *str_table_get_string(str_table_t *table, size_t index)
return table->strings[index];
}
-static str_bucket_t *bucket_by_index(str_table_t *table, size_t index)
+static str_bucket_t *bucket_by_index(const str_table_t *table, size_t index)
{
str_bucket_t *bucket = NULL;
sqfs_u32 hash;
@@ -229,7 +229,7 @@ void str_table_del_ref(str_table_t *table, size_t index)
bucket->refcount -= 1;
}
-size_t str_table_get_ref_count(str_table_t *table, size_t index)
+size_t str_table_get_ref_count(const str_table_t *table, size_t index)
{
str_bucket_t *bucket = bucket_by_index(table, index);