From 9a97a9a4fe224bcf53ad23af31bca67bbb71a824 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Mon, 15 May 2023 20:11:56 +0200 Subject: libtar: replace tar_xattr_t with dir_entry_xattr_t struct Signed-off-by: David Oberhollenzer --- include/io/xattr.h | 17 ++++++++++++++++- include/tar/tar.h | 15 +++------------ 2 files changed, 19 insertions(+), 13 deletions(-) (limited to 'include') diff --git a/include/io/xattr.h b/include/io/xattr.h index d912fad..cf35bca 100644 --- a/include/io/xattr.h +++ b/include/io/xattr.h @@ -1,4 +1,4 @@ -/* SPDX-License-Identifier: LGPL-3.0-or-later */ +/* SPDX-License-Identifier: GPL-3.0-or-later */ /* * xattr.h * @@ -7,6 +7,8 @@ #ifndef IO_XATTR_H #define IO_XATTR_H +#include "sqfs/predef.h" + typedef struct dir_entry_xattr_t { struct dir_entry_xattr_t *next; char *key; @@ -15,4 +17,17 @@ typedef struct dir_entry_xattr_t { char data[]; } dir_entry_xattr_t; +#ifdef __cplusplus +extern "C" { +#endif + +dir_entry_xattr_t *dir_entry_xattr_create(const char *key, const sqfs_u8 *value, + size_t value_len); + +void dir_entry_xattr_list_free(dir_entry_xattr_t *list); + +#ifdef __cplusplus +} +#endif + #endif /* IO_XATTR_H */ diff --git a/include/tar/tar.h b/include/tar/tar.h index 7c4faa7..21ded7d 100644 --- a/include/tar/tar.h +++ b/include/tar/tar.h @@ -11,6 +11,7 @@ #include "compat.h" #include "io/istream.h" #include "io/ostream.h" +#include "io/dir_iterator.h" #include #include @@ -22,14 +23,6 @@ typedef struct sparse_map_t { sqfs_u64 count; } sparse_map_t; -typedef struct tar_xattr_t { - struct tar_xattr_t *next; - char *key; - sqfs_u8 *value; - size_t value_len; - char data[]; -} tar_xattr_t; - typedef struct { char *name; char *link_target; @@ -38,7 +31,7 @@ typedef struct { sqfs_u64 record_size; bool unknown_record; bool is_hard_link; - tar_xattr_t *xattr; + dir_entry_xattr_t *xattr; sqfs_u16 mode; sqfs_u64 uid; @@ -59,7 +52,7 @@ extern "C" { headers need to be generated. */ int write_tar_header(ostream_t *fp, const struct stat *sb, const char *name, - const char *slink_target, const tar_xattr_t *xattr, + const char *slink_target, const dir_entry_xattr_t *xattr, unsigned int counter); int write_hard_link(ostream_t *fp, const struct stat *sb, const char *name, @@ -83,8 +76,6 @@ int padd_file(ostream_t *fp, sqfs_u64 size); void free_sparse_list(sparse_map_t *sparse); -void free_xattr_list(tar_xattr_t *list); - #ifdef __cplusplus } #endif -- cgit v1.2.3