aboutsummaryrefslogtreecommitdiff
path: root/lib/sqfs
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-09-05 17:00:57 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-09-05 17:00:57 +0200
commitd5f89c52d219332c48a46aa297bb4896e8c159aa (patch)
tree23ff58002556e9880373b4285029d38cc0c1ccae /lib/sqfs
parent6391ed9a18caf89ade24c05083569c66d8daa33b (diff)
Cleanup: unify sqfs/SQFS name prefix for xattr reader
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/sqfs')
-rw-r--r--lib/sqfs/xattr.c6
-rw-r--r--lib/sqfs/xattr_reader.c35
2 files changed, 21 insertions, 20 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;
}