aboutsummaryrefslogtreecommitdiff
path: root/include/io
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2023-05-15 19:35:45 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2023-05-16 16:54:21 +0200
commitf5377528d4897e42fafe6c88ce550c956b0d85be (patch)
treecf0f6d19971484051dbc5c27839b32506b8e2634 /include/io
parent69cf28db0dfa175884c9c41fc3f329b051e0a9c5 (diff)
libio: add xattr query interface to dir_iterator_t
Again, with a dummy implementation for Unix and Windows backends. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'include/io')
-rw-r--r--include/io/dir_iterator.h11
-rw-r--r--include/io/xattr.h18
2 files changed, 29 insertions, 0 deletions
diff --git a/include/io/dir_iterator.h b/include/io/dir_iterator.h
index 0de135a..377f07e 100644
--- a/include/io/dir_iterator.h
+++ b/include/io/dir_iterator.h
@@ -9,6 +9,7 @@
#include "sqfs/predef.h"
#include "io/istream.h"
+#include "io/xattr.h"
typedef enum {
DIR_ENTRY_FLAG_MOUNT_POINT = 0x0001,
@@ -148,6 +149,16 @@ typedef struct dir_iterator_t {
* @return Zero on success, negative @ref SQFS_ERROR value on failure.
*/
int (*open_file_ro)(struct dir_iterator_t *it, istream_t **out);
+
+ /**
+ * @brief Read extended attributes associated with the current entry
+ *
+ * @param it A pointer to the iterator itself.
+ * @param out Returns a linked list of xattr entries.
+ *
+ * @return Zero on success, negative @ref SQFS_ERROR value on failure.
+ */
+ int (*read_xattr)(struct dir_iterator_t *it, dir_entry_xattr_t **out);
} dir_iterator_t;
enum {
diff --git a/include/io/xattr.h b/include/io/xattr.h
new file mode 100644
index 0000000..d912fad
--- /dev/null
+++ b/include/io/xattr.h
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: LGPL-3.0-or-later */
+/*
+ * xattr.h
+ *
+ * Copyright (C) 2023 David Oberhollenzer <goliath@infraroot.at>
+ */
+#ifndef IO_XATTR_H
+#define IO_XATTR_H
+
+typedef struct dir_entry_xattr_t {
+ struct dir_entry_xattr_t *next;
+ char *key;
+ sqfs_u8 *value;
+ size_t value_len;
+ char data[];
+} dir_entry_xattr_t;
+
+#endif /* IO_XATTR_H */