summaryrefslogtreecommitdiff
path: root/lib/sqfshelper/write_xattr.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-09-27 18:15:40 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-09-27 18:15:40 +0200
commit40232f4bd4d7e8e001f7d1e8f120606f59b2c147 (patch)
tree5d763f4f22a487fd2e669efe0970615096f1f5fd /lib/sqfshelper/write_xattr.c
parentf6904a98bffe0bce5fc6aac408c141a25c0e05ab (diff)
Cleanup: replace fixed with data types with typedefs
This is a fully automated search and replace, i.e. I ran this: git grep -l uint8_t | xargs sed -i 's/uint8_t/sqfs_u8/g' git grep -l uint16_t | xargs sed -i 's/uint16_t/sqfs_u16/g' git grep -l uint32_t | xargs sed -i 's/uint32_t/sqfs_u32/g' git grep -l uint64_t | xargs sed -i 's/uint64_t/sqfs_u64/g' git grep -l int8_t | xargs sed -i 's/int8_t/sqfs_s8/g' git grep -l int16_t | xargs sed -i 's/int16_t/sqfs_s16/g' git grep -l int32_t | xargs sed -i 's/int32_t/sqfs_s32/g' git grep -l int64_t | xargs sed -i 's/int64_t/sqfs_s64/g' and than added the appropriate definitions to sqfs/predef.h The whole point being better compatibillity with platforms that may not have an stdint.h with the propper definitions. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/sqfshelper/write_xattr.c')
-rw-r--r--lib/sqfshelper/write_xattr.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/lib/sqfshelper/write_xattr.c b/lib/sqfshelper/write_xattr.c
index 8faa9ff..a3f5170 100644
--- a/lib/sqfshelper/write_xattr.c
+++ b/lib/sqfshelper/write_xattr.c
@@ -48,11 +48,11 @@ static int write_key(sqfs_meta_writer_t *mw, const char *key,
}
static int write_value(sqfs_meta_writer_t *mw, const char *value,
- tree_xattr_t *xattr, uint64_t *value_ref_out)
+ tree_xattr_t *xattr, sqfs_u64 *value_ref_out)
{
sqfs_xattr_value_t vent;
- uint32_t offset;
- uint64_t block;
+ sqfs_u32 offset;
+ sqfs_u64 block;
sqfs_meta_writer_get_position(mw, &block, &offset);
*value_ref_out = (block << 16) | (offset & 0xFFFF);
@@ -69,11 +69,11 @@ static int write_value(sqfs_meta_writer_t *mw, const char *value,
return 0;
}
-static int write_value_ool(sqfs_meta_writer_t *mw, uint64_t location,
+static int write_value_ool(sqfs_meta_writer_t *mw, sqfs_u64 location,
tree_xattr_t *xattr)
{
sqfs_xattr_value_t vent;
- uint64_t ref;
+ sqfs_u64 ref;
vent.size = htole32(sizeof(location));
if (sqfs_meta_writer_append(mw, &vent, sizeof(vent)))
@@ -109,15 +109,15 @@ static bool should_store_ool(fstree_t *fs, const char *value, size_t index)
Note that this only holds iff refcount - 1 != 0, i.e. refcount > 1,
otherwise we would be dividing by 0 in the 3rd step.
*/
- return strlen(value) > sizeof(uint64_t);
+ return strlen(value) > sizeof(sqfs_u64);
}
static int write_kv_pairs(fstree_t *fs, sqfs_meta_writer_t *mw,
- tree_xattr_t *xattr, uint64_t *ool_locations)
+ tree_xattr_t *xattr, sqfs_u64 *ool_locations)
{
- uint32_t key_idx, val_idx;
+ sqfs_u32 key_idx, val_idx;
const char *key, *value;
- uint64_t ref;
+ sqfs_u64 ref;
size_t i;
for (i = 0; i < xattr->num_attr; ++i) {
@@ -148,12 +148,12 @@ static int write_kv_pairs(fstree_t *fs, sqfs_meta_writer_t *mw,
return 0;
}
-static uint64_t *create_ool_locations_table(fstree_t *fs)
+static sqfs_u64 *create_ool_locations_table(fstree_t *fs)
{
- uint64_t *table;
+ sqfs_u64 *table;
size_t i;
- table = alloc_array(sizeof(uint64_t), fs->xattr_values.num_strings);
+ table = alloc_array(sizeof(sqfs_u64), fs->xattr_values.num_strings);
if (table == NULL) {
perror("allocating Xattr OOL locations table");
@@ -170,13 +170,13 @@ static uint64_t *create_ool_locations_table(fstree_t *fs)
int write_xattr(sqfs_file_t *file, fstree_t *fs, sqfs_super_t *super,
sqfs_compressor_t *cmp)
{
- uint64_t kv_start, id_start, block, off, *tbl, *ool_locations;
+ sqfs_u64 kv_start, id_start, block, off, *tbl, *ool_locations;
size_t i = 0, count = 0, blocks;
sqfs_xattr_id_table_t idtbl;
sqfs_xattr_id_t id_ent;
sqfs_meta_writer_t *mw;
tree_xattr_t *it;
- uint32_t offset;
+ sqfs_u32 offset;
if (fs->xattr == NULL)
return 0;
@@ -213,7 +213,7 @@ int write_xattr(sqfs_file_t *file, fstree_t *fs, sqfs_super_t *super,
if ((count * sizeof(id_ent)) % SQFS_META_BLOCK_SIZE)
++blocks;
- tbl = alloc_array(sizeof(uint64_t), blocks);
+ tbl = alloc_array(sizeof(sqfs_u64), blocks);
if (tbl == NULL) {
perror("generating xattr ID table");