From 1f210bab667a540379243050b5ce3465086e1124 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Sun, 7 Jun 2020 23:38:06 +0200 Subject: Cleanup: split libsquashfs xattr writer code This commit moves the libsquashfs xattr related code into a sub directory and splits the xattr writer code up into several files. No actual code is changed. Signed-off-by: David Oberhollenzer --- lib/sqfs/xattr.c | 49 ------------------------------------------------- 1 file changed, 49 deletions(-) delete mode 100644 lib/sqfs/xattr.c (limited to 'lib/sqfs/xattr.c') diff --git a/lib/sqfs/xattr.c b/lib/sqfs/xattr.c deleted file mode 100644 index 29ecebf..0000000 --- a/lib/sqfs/xattr.c +++ /dev/null @@ -1,49 +0,0 @@ -/* SPDX-License-Identifier: LGPL-3.0-or-later */ -/* - * write_xattr.c - * - * Copyright (C) 2019 David Oberhollenzer - */ -#define SQFS_BUILDING_DLL -#include "config.h" -#include "sqfs/xattr.h" -#include "sqfs/error.h" - -#include - -static const struct { - const char *prefix; - SQFS_XATTR_TYPE type; -} xattr_types[] = { - { "user.", SQFS_XATTR_USER }, - { "trusted.", SQFS_XATTR_TRUSTED }, - { "security.", SQFS_XATTR_SECURITY }, -}; - -int sqfs_get_xattr_prefix_id(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 SQFS_ERROR_UNSUPPORTED; -} - -const char *sqfs_get_xattr_prefix(SQFS_XATTR_TYPE id) -{ - size_t i; - - for (i = 0; i < sizeof(xattr_types) / sizeof(xattr_types[0]); ++i) { - if (xattr_types[i].type == id) - return xattr_types[i].prefix; - } - - return NULL; -} -- cgit v1.2.3