aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2023-06-05 19:06:42 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2023-06-05 16:01:34 +0200
commitc9a8adc15f9de110771156fdc85fb98533648a53 (patch)
treecdd6300b1c69a002628a76c4bac45ac6664111d9 /bin
parent57ca46cdd74fd1004a3b0476c136e1f26fcf002d (diff)
Move dir_entry_xattr_t from libio to libsquashfs
The structure and functions are renamed to sqfs_xattr_* instead, an additional helper is added to accept an encoded xattr. Documentation and unit test are added as well. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'bin')
-rw-r--r--bin/sqfs2tar/src/sqfs2tar.h2
-rw-r--r--bin/sqfs2tar/src/write_tree.c4
-rw-r--r--bin/sqfs2tar/src/xattr.c16
-rw-r--r--bin/tar2sqfs/src/process_tarball.c6
4 files changed, 14 insertions, 14 deletions
diff --git a/bin/sqfs2tar/src/sqfs2tar.h b/bin/sqfs2tar/src/sqfs2tar.h
index 88185ee..3c7b3d1 100644
--- a/bin/sqfs2tar/src/sqfs2tar.h
+++ b/bin/sqfs2tar/src/sqfs2tar.h
@@ -48,7 +48,7 @@ char *assemble_tar_path(char *name, bool is_dir);
/* xattr.c */
int get_xattrs(const char *name, const sqfs_inode_generic_t *inode,
- dir_entry_xattr_t **out);
+ sqfs_xattr_t **out);
/* write_tree.c */
int write_tree(const sqfs_tree_node_t *n);
diff --git a/bin/sqfs2tar/src/write_tree.c b/bin/sqfs2tar/src/write_tree.c
index 150bac1..71eb249 100644
--- a/bin/sqfs2tar/src/write_tree.c
+++ b/bin/sqfs2tar/src/write_tree.c
@@ -68,7 +68,7 @@ static void inode_stat(const sqfs_tree_node_t *node, struct stat *sb)
static int write_tree_dfs(const sqfs_tree_node_t *n)
{
sqfs_hard_link_t *lnk = NULL;
- dir_entry_xattr_t *xattr = NULL;
+ sqfs_xattr_t *xattr = NULL;
char *name, *target;
struct stat sb;
size_t len;
@@ -134,7 +134,7 @@ static int write_tree_dfs(const sqfs_tree_node_t *n)
target = S_ISLNK(sb.st_mode) ? (char *)n->inode->extra : NULL;
ret = write_tar_header(out_file, &sb, name, target, xattr,
record_counter++);
- dir_entry_xattr_list_free(xattr);
+ sqfs_xattr_list_free(xattr);
if (ret > 0)
goto out_skip;
diff --git a/bin/sqfs2tar/src/xattr.c b/bin/sqfs2tar/src/xattr.c
index 8d21cd8..2af856d 100644
--- a/bin/sqfs2tar/src/xattr.c
+++ b/bin/sqfs2tar/src/xattr.c
@@ -6,13 +6,13 @@
*/
#include "sqfs2tar.h"
-static dir_entry_xattr_t *mkxattr(const sqfs_xattr_entry_t *key,
- const sqfs_xattr_value_t *value)
+static sqfs_xattr_t *mkxattr(const sqfs_xattr_entry_t *key,
+ const sqfs_xattr_value_t *value)
{
- dir_entry_xattr_t *ent;
+ sqfs_xattr_t *ent;
- ent = dir_entry_xattr_create((const char *)key->key,
- value->value, value->size);
+ ent = sqfs_xattr_create((const char *)key->key,
+ value->value, value->size);
if (ent == NULL) {
perror("creating xattr entry");
return NULL;
@@ -22,9 +22,9 @@ static dir_entry_xattr_t *mkxattr(const sqfs_xattr_entry_t *key,
}
int get_xattrs(const char *name, const sqfs_inode_generic_t *inode,
- dir_entry_xattr_t **out)
+ sqfs_xattr_t **out)
{
- dir_entry_xattr_t *list = NULL, *ent;
+ sqfs_xattr_t *list = NULL, *ent;
sqfs_xattr_value_t *value;
sqfs_xattr_entry_t *key;
sqfs_xattr_id_t desc;
@@ -79,6 +79,6 @@ int get_xattrs(const char *name, const sqfs_inode_generic_t *inode,
*out = list;
return 0;
fail:
- dir_entry_xattr_list_free(list);
+ sqfs_xattr_list_free(list);
return -1;
}
diff --git a/bin/tar2sqfs/src/process_tarball.c b/bin/tar2sqfs/src/process_tarball.c
index 76c7dc1..5b0cbdd 100644
--- a/bin/tar2sqfs/src/process_tarball.c
+++ b/bin/tar2sqfs/src/process_tarball.c
@@ -40,7 +40,7 @@ static int write_file(sqfs_writer_t *sqfs, dir_iterator_t *it,
static int copy_xattr(sqfs_writer_t *sqfs, const char *filename,
tree_node_t *node, dir_iterator_t *it)
{
- dir_entry_xattr_t *xattr, *list;
+ sqfs_xattr_t *xattr, *list;
int ret;
ret = it->read_xattr(it, &list);
@@ -82,10 +82,10 @@ static int copy_xattr(sqfs_writer_t *sqfs, const char *filename,
goto fail;
}
- dir_entry_xattr_list_free(list);
+ sqfs_xattr_list_free(list);
return 0;
fail:
- dir_entry_xattr_list_free(list);
+ sqfs_xattr_list_free(list);
return -1;
}