From c9a8adc15f9de110771156fdc85fb98533648a53 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Mon, 5 Jun 2023 19:06:42 +0200 Subject: 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 --- lib/tar/test/tar_write_simple.c | 17 +++++++++-------- lib/tar/test/tar_xattr.c | 1 + lib/tar/test/tar_xattr_bin.c | 1 + 3 files changed, 11 insertions(+), 8 deletions(-) (limited to 'lib/tar/test') diff --git a/lib/tar/test/tar_write_simple.c b/lib/tar/test/tar_write_simple.c index 738b469..8a41c8f 100644 --- a/lib/tar/test/tar_write_simple.c +++ b/lib/tar/test/tar_write_simple.c @@ -9,6 +9,7 @@ #include "io/ostream.h" #include "io/file.h" #include "util/test.h" +#include "sqfs/xattr.h" #include "compat.h" /*****************************************************************************/ @@ -52,7 +53,7 @@ static const char *buffer_get_filename(ostream_t *strm) #define TIME_STAMP (1057296600) -static dir_entry_xattr_t *mkxattr_chain(void) +static sqfs_xattr_t *mkxattr_chain(void) { static const uint8_t value[] = { 0x00, 0x00, 0x00, 0x02, @@ -61,20 +62,20 @@ static dir_entry_xattr_t *mkxattr_chain(void) 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; - dir_entry_xattr_t *list; + sqfs_xattr_t *list; - list = dir_entry_xattr_create("user.mime_type", - (const sqfs_u8 *)"blob/magic", 10); + list = sqfs_xattr_create("user.mime_type", + (const sqfs_u8 *)"blob/magic", 10); TEST_NOT_NULL(list); - list->next = dir_entry_xattr_create("security.capability", - value, sizeof(value)); + list->next = sqfs_xattr_create("security.capability", + value, sizeof(value)); TEST_NOT_NULL(list->next); return list; } int main(int argc, char **argv) { - dir_entry_xattr_t *xattr; + sqfs_xattr_t *xattr; struct stat sb; istream_t *fp; int ret; @@ -154,7 +155,7 @@ int main(int argc, char **argv) ret = write_tar_header(&mem_stream, &sb, "home/goliath/test.exe", NULL, xattr, 11); TEST_EQUAL_I(ret, 0); - dir_entry_xattr_list_free(xattr); + sqfs_xattr_list_free(xattr); ret = ostream_append(&mem_stream, ":-)\n", 4); TEST_EQUAL_I(ret, 0); diff --git a/lib/tar/test/tar_xattr.c b/lib/tar/test/tar_xattr.c index 122d1db..1577fc7 100644 --- a/lib/tar/test/tar_xattr.c +++ b/lib/tar/test/tar_xattr.c @@ -8,6 +8,7 @@ #include "io/file.h" #include "tar/tar.h" #include "util/test.h" +#include "sqfs/xattr.h" int main(int argc, char **argv) { diff --git a/lib/tar/test/tar_xattr_bin.c b/lib/tar/test/tar_xattr_bin.c index 90443a1..129d227 100644 --- a/lib/tar/test/tar_xattr_bin.c +++ b/lib/tar/test/tar_xattr_bin.c @@ -8,6 +8,7 @@ #include "io/file.h" #include "tar/tar.h" #include "util/test.h" +#include "sqfs/xattr.h" static const uint8_t value[] = { 0x00, 0x00, 0x00, 0x02, -- cgit v1.2.3