diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/sqfs/xattr.c | 6 | ||||
-rw-r--r-- | lib/sqfs/xattr_reader.c | 35 | ||||
-rw-r--r-- | lib/sqfshelper/deserialize_fstree.c | 12 | ||||
-rw-r--r-- | lib/sqfshelper/write_xattr.c | 2 | ||||
-rw-r--r-- | lib/sqfshelper/xattr_reader.c | 12 |
5 files changed, 34 insertions, 33 deletions
diff --git a/lib/sqfs/xattr.c b/lib/sqfs/xattr.c index fb8cb79..378c53b 100644 --- a/lib/sqfs/xattr.c +++ b/lib/sqfs/xattr.c @@ -13,9 +13,9 @@ static const struct { const char *prefix; E_SQFS_XATTR_TYPE type; } xattr_types[] = { - { "user.", SQUASHFS_XATTR_USER }, - { "trusted.", SQUASHFS_XATTR_TRUSTED }, - { "security.", SQUASHFS_XATTR_SECURITY }, + { "user.", SQFS_XATTR_USER }, + { "trusted.", SQFS_XATTR_TRUSTED }, + { "security.", SQFS_XATTR_SECURITY }, }; int sqfs_get_xattr_prefix_id(const char *key) diff --git a/lib/sqfs/xattr_reader.c b/lib/sqfs/xattr_reader.c index 862f4af..3e74424 100644 --- a/lib/sqfs/xattr_reader.c +++ b/lib/sqfs/xattr_reader.c @@ -15,7 +15,7 @@ #include <stdio.h> #include <errno.h> -struct xattr_reader_t { +struct sqfs_xattr_reader_t { uint64_t xattr_start; size_t num_id_blocks; @@ -28,7 +28,7 @@ struct xattr_reader_t { sqfs_super_t *super; }; -static int get_id_block_locations(xattr_reader_t *xr, int sqfsfd, +static int get_id_block_locations(sqfs_xattr_reader_t *xr, int sqfsfd, sqfs_super_t *super) { sqfs_xattr_id_table_t idtbl; @@ -84,7 +84,7 @@ fail: return -1; } -sqfs_xattr_entry_t *xattr_reader_read_key(xattr_reader_t *xr) +sqfs_xattr_entry_t *sqfs_xattr_reader_read_key(sqfs_xattr_reader_t *xr) { sqfs_xattr_entry_t key, *out; const char *prefix; @@ -96,10 +96,10 @@ sqfs_xattr_entry_t *xattr_reader_read_key(xattr_reader_t *xr) key.type = le16toh(key.type); key.size = le16toh(key.size); - prefix = sqfs_get_xattr_prefix(key.type & SQUASHFS_XATTR_PREFIX_MASK); + prefix = sqfs_get_xattr_prefix(key.type & SQFS_XATTR_PREFIX_MASK); if (prefix == NULL) { fprintf(stderr, "found unknown xattr type %u\n", - key.type & SQUASHFS_XATTR_PREFIX_MASK); + key.type & SQFS_XATTR_PREFIX_MASK); return NULL; } @@ -130,8 +130,8 @@ fail_alloc: return NULL; } -sqfs_xattr_value_t *xattr_reader_read_value(xattr_reader_t *xr, - const sqfs_xattr_entry_t *key) +sqfs_xattr_value_t *sqfs_xattr_reader_read_value(sqfs_xattr_reader_t *xr, + const sqfs_xattr_entry_t *key) { size_t offset, new_offset, size; sqfs_xattr_value_t value, *out; @@ -140,7 +140,7 @@ sqfs_xattr_value_t *xattr_reader_read_value(xattr_reader_t *xr, if (meta_reader_read(xr->kvrd, &value, sizeof(value))) return NULL; - if (key->type & SQUASHFS_XATTR_FLAG_OOL) { + if (key->type & SQFS_XATTR_FLAG_OOL) { if (meta_reader_read(xr->kvrd, &ref, sizeof(ref))) return NULL; @@ -182,7 +182,7 @@ sqfs_xattr_value_t *xattr_reader_read_value(xattr_reader_t *xr, if (meta_reader_read(xr->kvrd, out->value, value.size)) goto fail; - if (key->type & SQUASHFS_XATTR_FLAG_OOL) { + if (key->type & SQFS_XATTR_FLAG_OOL) { if (meta_reader_seek(xr->kvrd, start, offset)) goto fail; } @@ -196,7 +196,8 @@ fail: return NULL; } -int xattr_reader_seek_kv(xattr_reader_t *xr, const sqfs_xattr_id_t *desc) +int sqfs_xattr_reader_seek_kv(sqfs_xattr_reader_t *xr, + const sqfs_xattr_id_t *desc) { uint32_t offset = desc->xattr & 0xFFFF; uint64_t block = xr->xattr_start + (desc->xattr >> 16); @@ -204,8 +205,8 @@ int xattr_reader_seek_kv(xattr_reader_t *xr, const sqfs_xattr_id_t *desc) return meta_reader_seek(xr->kvrd, block, offset); } -int xattr_reader_get_desc(xattr_reader_t *xr, uint32_t idx, - sqfs_xattr_id_t *desc) +int sqfs_xattr_reader_get_desc(sqfs_xattr_reader_t *xr, uint32_t idx, + sqfs_xattr_id_t *desc) { size_t block, offset; @@ -242,7 +243,7 @@ fail_bounds: return -1; } -void xattr_reader_destroy(xattr_reader_t *xr) +void sqfs_xattr_reader_destroy(sqfs_xattr_reader_t *xr) { if (xr->kvrd != NULL) meta_reader_destroy(xr->kvrd); @@ -254,10 +255,10 @@ void xattr_reader_destroy(xattr_reader_t *xr) free(xr); } -xattr_reader_t *xattr_reader_create(int sqfsfd, sqfs_super_t *super, - compressor_t *cmp) +sqfs_xattr_reader_t *sqfs_xattr_reader_create(int sqfsfd, sqfs_super_t *super, + compressor_t *cmp) { - xattr_reader_t *xr = calloc(1, sizeof(*xr)); + sqfs_xattr_reader_t *xr = calloc(1, sizeof(*xr)); if (xr == NULL) { perror("creating xattr reader"); @@ -288,6 +289,6 @@ xattr_reader_t *xattr_reader_create(int sqfsfd, sqfs_super_t *super, xr->super = super; return xr; fail: - xattr_reader_destroy(xr); + sqfs_xattr_reader_destroy(xr); return NULL; } diff --git a/lib/sqfshelper/deserialize_fstree.c b/lib/sqfshelper/deserialize_fstree.c index 47410b0..312dde1 100644 --- a/lib/sqfshelper/deserialize_fstree.c +++ b/lib/sqfshelper/deserialize_fstree.c @@ -36,8 +36,8 @@ static int should_skip(int type, int flags) return 0; } -static int restore_xattr(xattr_reader_t *xr, fstree_t *fs, tree_node_t *node, - sqfs_inode_generic_t *inode) +static int restore_xattr(sqfs_xattr_reader_t *xr, fstree_t *fs, + tree_node_t *node, sqfs_inode_generic_t *inode) { uint32_t idx; @@ -80,7 +80,7 @@ static bool node_would_be_own_parent(tree_node_t *root, tree_node_t *n) static int fill_dir(meta_reader_t *ir, meta_reader_t *dr, tree_node_t *root, sqfs_super_t *super, id_table_t *idtbl, fstree_t *fs, - xattr_reader_t *xr, int flags) + sqfs_xattr_reader_t *xr, int flags) { sqfs_inode_generic_t *inode; sqfs_dir_header_t hdr; @@ -204,8 +204,8 @@ int deserialize_fstree(fstree_t *out, sqfs_super_t *super, compressor_t *cmp, { uint64_t block_start, limit; sqfs_inode_generic_t *root; + sqfs_xattr_reader_t *xr; meta_reader_t *ir, *dr; - xattr_reader_t *xr; id_table_t *idtbl; int status = -1; size_t offset; @@ -232,7 +232,7 @@ int deserialize_fstree(fstree_t *out, sqfs_super_t *super, compressor_t *cmp, if (id_table_read(idtbl, fd, super, cmp)) goto out_id; - xr = xattr_reader_create(fd, super, cmp); + xr = sqfs_xattr_reader_create(fd, super, cmp); if (xr == NULL) goto out_id; @@ -292,7 +292,7 @@ int deserialize_fstree(fstree_t *out, sqfs_super_t *super, compressor_t *cmp, status = 0; out_xr: - xattr_reader_destroy(xr); + sqfs_xattr_reader_destroy(xr); out_id: id_table_destroy(idtbl); out_dr: diff --git a/lib/sqfshelper/write_xattr.c b/lib/sqfshelper/write_xattr.c index ddedc55..a84822f 100644 --- a/lib/sqfshelper/write_xattr.c +++ b/lib/sqfshelper/write_xattr.c @@ -33,7 +33,7 @@ static int write_key(meta_writer_t *mw, const char *key, tree_xattr_t *xattr, ++key; if (value_is_ool) - type |= SQUASHFS_XATTR_FLAG_OOL; + type |= SQFS_XATTR_FLAG_OOL; kent.type = htole16(type); kent.size = htole16(strlen(key)); diff --git a/lib/sqfshelper/xattr_reader.c b/lib/sqfshelper/xattr_reader.c index 2cf1114..a0dc6f6 100644 --- a/lib/sqfshelper/xattr_reader.c +++ b/lib/sqfshelper/xattr_reader.c @@ -15,7 +15,7 @@ #include <stdio.h> #include <errno.h> -static int restore_kv_pairs(xattr_reader_t *xr, fstree_t *fs, +static int restore_kv_pairs(sqfs_xattr_reader_t *xr, fstree_t *fs, tree_node_t *node) { size_t i, key_idx, val_idx; @@ -24,11 +24,11 @@ static int restore_kv_pairs(xattr_reader_t *xr, fstree_t *fs, int ret; for (i = 0; i < node->xattr->num_attr; ++i) { - key = xattr_reader_read_key(xr); + key = sqfs_xattr_reader_read_key(xr); if (key == NULL) return -1; - val = xattr_reader_read_value(xr, key); + val = sqfs_xattr_reader_read_value(xr, key); if (val == NULL) goto fail_key; @@ -69,7 +69,7 @@ fail_key: return -1; } -int xattr_reader_restore_node(xattr_reader_t *xr, fstree_t *fs, +int xattr_reader_restore_node(sqfs_xattr_reader_t *xr, fstree_t *fs, tree_node_t *node, uint32_t xattr) { sqfs_xattr_id_t desc; @@ -82,7 +82,7 @@ int xattr_reader_restore_node(xattr_reader_t *xr, fstree_t *fs, } } - if (xattr_reader_get_desc(xr, xattr, &desc)) + if (sqfs_xattr_reader_get_desc(xr, xattr, &desc)) return -1; if (desc.count == 0 || desc.size == 0) @@ -101,7 +101,7 @@ int xattr_reader_restore_node(xattr_reader_t *xr, fstree_t *fs, node->xattr->index = xattr; node->xattr->owner = node; - if (xattr_reader_seek_kv(xr, &desc)) + if (sqfs_xattr_reader_seek_kv(xr, &desc)) return -1; if (restore_kv_pairs(xr, fs, node)) { |