summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-09-05 17:37:19 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-09-05 17:37:19 +0200
commitf85394c5887350a9728e108e72d908e08fc4cb78 (patch)
tree76ee4e50a5ece365d1c429271bd735dca40f01ad /lib
parenta4b4c27bb01e64ff0072be78f7ddc0fa64193bfa (diff)
Cleanup: add sqfs_* prefix to id table
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib')
-rw-r--r--lib/sqfs/id_table.c21
-rw-r--r--lib/sqfshelper/deserialize_fstree.c11
-rw-r--r--lib/sqfshelper/serialize_fstree.c2
-rw-r--r--lib/sqfshelper/tree_node_from_inode.c6
-rw-r--r--lib/sqfshelper/tree_node_to_inode.c6
5 files changed, 24 insertions, 22 deletions
diff --git a/lib/sqfs/id_table.c b/lib/sqfs/id_table.c
index 75d5db4..2b8044c 100644
--- a/lib/sqfs/id_table.c
+++ b/lib/sqfs/id_table.c
@@ -13,15 +13,15 @@
#include <string.h>
#include <stdio.h>
-struct id_table_t {
+struct sqfs_id_table_t {
uint32_t *ids;
size_t num_ids;
size_t max_ids;
};
-id_table_t *id_table_create(void)
+sqfs_id_table_t *sqfs_id_table_create(void)
{
- id_table_t *tbl = calloc(1, sizeof(*tbl));
+ sqfs_id_table_t *tbl = calloc(1, sizeof(*tbl));
if (tbl == NULL)
perror("Creating ID table");
@@ -29,13 +29,13 @@ id_table_t *id_table_create(void)
return tbl;
}
-void id_table_destroy(id_table_t *tbl)
+void sqfs_id_table_destroy(sqfs_id_table_t *tbl)
{
free(tbl->ids);
free(tbl);
}
-int id_table_id_to_index(id_table_t *tbl, uint32_t id, uint16_t *out)
+int sqfs_id_table_id_to_index(sqfs_id_table_t *tbl, uint32_t id, uint16_t *out)
{
size_t i, sz;
void *ptr;
@@ -70,7 +70,8 @@ int id_table_id_to_index(id_table_t *tbl, uint32_t id, uint16_t *out)
return 0;
}
-int id_table_index_to_id(const id_table_t *tbl, uint16_t index, uint32_t *out)
+int sqfs_id_table_index_to_id(const sqfs_id_table_t *tbl, uint16_t index,
+ uint32_t *out)
{
if (index >= tbl->num_ids) {
fputs("attempted out of bounds ID table access\n", stderr);
@@ -81,8 +82,8 @@ int id_table_index_to_id(const id_table_t *tbl, uint16_t index, uint32_t *out)
return 0;
}
-int id_table_read(id_table_t *tbl, int fd, sqfs_super_t *super,
- compressor_t *cmp)
+int sqfs_id_table_read(sqfs_id_table_t *tbl, int fd, sqfs_super_t *super,
+ compressor_t *cmp)
{
uint64_t upper_limit, lower_limit;
size_t i;
@@ -126,8 +127,8 @@ int id_table_read(id_table_t *tbl, int fd, sqfs_super_t *super,
return 0;
}
-int id_table_write(id_table_t *tbl, int outfd, sqfs_super_t *super,
- compressor_t *cmp)
+int sqfs_id_table_write(sqfs_id_table_t *tbl, int outfd, sqfs_super_t *super,
+ compressor_t *cmp)
{
uint64_t start;
size_t i;
diff --git a/lib/sqfshelper/deserialize_fstree.c b/lib/sqfshelper/deserialize_fstree.c
index 71cc57e..8d3c916 100644
--- a/lib/sqfshelper/deserialize_fstree.c
+++ b/lib/sqfshelper/deserialize_fstree.c
@@ -79,7 +79,8 @@ static bool node_would_be_own_parent(tree_node_t *root, tree_node_t *n)
}
static int fill_dir(sqfs_meta_reader_t *ir, sqfs_meta_reader_t *dr,
- tree_node_t *root, sqfs_super_t *super, id_table_t *idtbl,
+ tree_node_t *root, sqfs_super_t *super,
+ sqfs_id_table_t *idtbl,
fstree_t *fs, sqfs_xattr_reader_t *xr, int flags)
{
sqfs_inode_generic_t *inode;
@@ -208,7 +209,7 @@ int deserialize_fstree(fstree_t *out, sqfs_super_t *super, compressor_t *cmp,
sqfs_meta_reader_t *ir, *dr;
sqfs_inode_generic_t *root;
sqfs_xattr_reader_t *xr;
- id_table_t *idtbl;
+ sqfs_id_table_t *idtbl;
int status = -1;
size_t offset;
@@ -228,11 +229,11 @@ int deserialize_fstree(fstree_t *out, sqfs_super_t *super, compressor_t *cmp,
if (dr == NULL)
goto out_ir;
- idtbl = id_table_create();
+ idtbl = sqfs_id_table_create();
if (idtbl == NULL)
goto out_dr;
- if (id_table_read(idtbl, fd, super, cmp))
+ if (sqfs_id_table_read(idtbl, fd, super, cmp))
goto out_id;
xr = sqfs_xattr_reader_create(fd, super, cmp);
@@ -297,7 +298,7 @@ int deserialize_fstree(fstree_t *out, sqfs_super_t *super, compressor_t *cmp,
out_xr:
sqfs_xattr_reader_destroy(xr);
out_id:
- id_table_destroy(idtbl);
+ sqfs_id_table_destroy(idtbl);
out_dr:
sqfs_meta_reader_destroy(dr);
out_ir:
diff --git a/lib/sqfshelper/serialize_fstree.c b/lib/sqfshelper/serialize_fstree.c
index 0a574a0..f400a53 100644
--- a/lib/sqfshelper/serialize_fstree.c
+++ b/lib/sqfshelper/serialize_fstree.c
@@ -42,7 +42,7 @@ static int write_dir_entries(sqfs_dir_writer_t *dirw, tree_node_t *node)
}
int sqfs_serialize_fstree(int outfd, sqfs_super_t *super, fstree_t *fs,
- compressor_t *cmp, id_table_t *idtbl)
+ compressor_t *cmp, sqfs_id_table_t *idtbl)
{
sqfs_inode_generic_t *inode;
sqfs_meta_writer_t *im, *dm;
diff --git a/lib/sqfshelper/tree_node_from_inode.c b/lib/sqfshelper/tree_node_from_inode.c
index d8b3361..68365d0 100644
--- a/lib/sqfshelper/tree_node_from_inode.c
+++ b/lib/sqfshelper/tree_node_from_inode.c
@@ -58,7 +58,7 @@ static void copy_block_sizes(sqfs_inode_generic_t *inode, tree_node_t *out,
}
tree_node_t *tree_node_from_inode(sqfs_inode_generic_t *inode,
- const id_table_t *idtbl,
+ const sqfs_id_table_t *idtbl,
const char *name,
size_t block_size)
{
@@ -70,12 +70,12 @@ tree_node_t *tree_node_from_inode(sqfs_inode_generic_t *inode,
return NULL;
}
- if (id_table_index_to_id(idtbl, inode->base.uid_idx, &out->uid)) {
+ if (sqfs_id_table_index_to_id(idtbl, inode->base.uid_idx, &out->uid)) {
free(out);
return NULL;
}
- if (id_table_index_to_id(idtbl, inode->base.gid_idx, &out->gid)) {
+ if (sqfs_id_table_index_to_id(idtbl, inode->base.gid_idx, &out->gid)) {
free(out);
return NULL;
}
diff --git a/lib/sqfshelper/tree_node_to_inode.c b/lib/sqfshelper/tree_node_to_inode.c
index d3346e2..7de8abd 100644
--- a/lib/sqfshelper/tree_node_to_inode.c
+++ b/lib/sqfshelper/tree_node_to_inode.c
@@ -81,7 +81,7 @@ static int get_type(tree_node_t *node)
assert(0);
}
-sqfs_inode_generic_t *tree_node_to_inode(fstree_t *fs, id_table_t *idtbl,
+sqfs_inode_generic_t *tree_node_to_inode(fstree_t *fs, sqfs_id_table_t *idtbl,
tree_node_t *node)
{
size_t i, extra = 0, block_count = 0;
@@ -124,10 +124,10 @@ sqfs_inode_generic_t *tree_node_to_inode(fstree_t *fs, id_table_t *idtbl,
}
}
- if (id_table_id_to_index(idtbl, node->uid, &uid_idx))
+ if (sqfs_id_table_id_to_index(idtbl, node->uid, &uid_idx))
goto fail;
- if (id_table_id_to_index(idtbl, node->gid, &gid_idx))
+ if (sqfs_id_table_id_to_index(idtbl, node->gid, &gid_idx))
goto fail;
if (node->xattr != NULL)