summaryrefslogtreecommitdiff
path: root/include/sqfs/xattr.h
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-09-01 15:53:44 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-09-01 15:53:44 +0200
commita901d77efe116938bdaf5c0fc6075141ebb2bafc (patch)
treea6f97a891410c4159c80eafeb23b7d34c92f970f /include/sqfs/xattr.h
parent9533dc84d7addf792db4f4702b6fc7d7ddd20e78 (diff)
Break up squashfs.h into topic related headers
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'include/sqfs/xattr.h')
-rw-r--r--include/sqfs/xattr.h57
1 files changed, 57 insertions, 0 deletions
diff --git a/include/sqfs/xattr.h b/include/sqfs/xattr.h
new file mode 100644
index 0000000..3d5da39
--- /dev/null
+++ b/include/sqfs/xattr.h
@@ -0,0 +1,57 @@
+/* SPDX-License-Identifier: GPL-3.0-or-later */
+/*
+ * xattr.h
+ *
+ * Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at>
+ */
+#ifndef SQFS_XATTR_H
+#define SQFS_XATTR_H
+
+#include "config.h"
+
+#include <stdbool.h>
+#include <stdint.h>
+#include <stddef.h>
+
+typedef enum {
+ SQUASHFS_XATTR_USER = 0,
+ SQUASHFS_XATTR_TRUSTED = 1,
+ SQUASHFS_XATTR_SECURITY = 2,
+
+ SQUASHFS_XATTR_FLAG_OOL = 0x100,
+ SQUASHFS_XATTR_PREFIX_MASK = 0xFF,
+} E_SQFS_XATTR_TYPE;
+
+typedef struct {
+ uint16_t type;
+ uint16_t size;
+ uint8_t key[];
+} sqfs_xattr_entry_t;
+
+typedef struct {
+ uint32_t size;
+ uint8_t value[];
+} sqfs_xattr_value_t;
+
+typedef struct {
+ uint64_t xattr;
+ uint32_t count;
+ uint32_t size;
+} sqfs_xattr_id_t;
+
+typedef struct {
+ uint64_t xattr_table_start;
+ uint32_t xattr_ids;
+ uint32_t unused;
+} sqfs_xattr_id_table_t;
+
+/* Get a prefix string from the ID or NULL if unknown */
+const char *sqfs_get_xattr_prefix(E_SQFS_XATTR_TYPE id);
+
+/* Get id from xattr key prefix or -1 if not supported */
+int sqfs_get_xattr_prefix_id(const char *key);
+
+/* Check if a given xattr key can be encoded in squashfs at all. */
+bool sqfs_has_xattr(const char *key);
+
+#endif /* SQFS_XATTR_H */