summaryrefslogtreecommitdiff
path: root/lib/sqfs/write_xattr.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-08-01 13:50:05 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-08-01 15:48:42 +0200
commit23a3f10ab62abadf5adcfb9540f2180275ab5b0c (patch)
treecfe537d4359de7dd3486898dad70c40761947680 /lib/sqfs/write_xattr.c
parent7073f002b54c690ffa17d9f736a4417485d3c6d6 (diff)
Add xattr reader implementation to recover xattrs from squashfs
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/sqfs/write_xattr.c')
-rw-r--r--lib/sqfs/write_xattr.c32
1 files changed, 1 insertions, 31 deletions
diff --git a/lib/sqfs/write_xattr.c b/lib/sqfs/write_xattr.c
index 98829e8..195de0d 100644
--- a/lib/sqfs/write_xattr.c
+++ b/lib/sqfs/write_xattr.c
@@ -15,43 +15,13 @@
#include <string.h>
#include <stdio.h>
-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 },
-};
-
-static int get_prefix(const char *key)
-{
- size_t i, len;
-
- for (i = 0; i < sizeof(xattr_types) / sizeof(xattr_types[0]); ++i) {
- len = strlen(xattr_types[i].prefix);
-
- if (strncmp(key, xattr_types[i].prefix, len) == 0 &&
- strlen(key) > len) {
- return xattr_types[i].type;
- }
- }
-
- return -1;
-}
-
-bool sqfs_has_xattr(const char *key)
-{
- return get_prefix(key) >= 0;
-}
-
static int write_key(meta_writer_t *mw, const char *key, tree_xattr_t *xattr,
bool value_is_ool)
{
sqfs_xattr_entry_t kent;
int type;
- type = get_prefix(key);
+ type = sqfs_get_xattr_prefix_id(key);
if (type < 0) {
fprintf(stderr, "unsupported xattr key '%s'\n", key);
return -1;