From f5377528d4897e42fafe6c88ce550c956b0d85be Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Mon, 15 May 2023 19:35:45 +0200 Subject: libio: add xattr query interface to dir_iterator_t Again, with a dummy implementation for Unix and Windows backends. Signed-off-by: David Oberhollenzer --- include/io/dir_iterator.h | 11 +++++++++++ include/io/xattr.h | 18 ++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 include/io/xattr.h (limited to 'include/io') 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 + */ +#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 */ -- cgit v1.2.3