libsquashfs  1.3.2
A new set of tools and libraries for working with SquashFS images
xattr.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: LGPL-3.0-or-later */
2 /*
3  * xattr.h - This file is part of libsquashfs
4  *
5  * Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at>
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU Lesser General Public License as published
9  * by the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public License
18  * along with this program. If not, see <https://www.gnu.org/licenses/>.
19  */
20 #ifndef SQFS_XATTR_H
21 #define SQFS_XATTR_H
22 
23 #include "sqfs/predef.h"
24 
36 typedef enum {
37  SQFS_XATTR_USER = 0,
38  SQFS_XATTR_TRUSTED = 1,
39  SQFS_XATTR_SECURITY = 2,
40 
41  SQFS_XATTR_FLAG_OOL = 0x100,
42  SQFS_XATTR_PREFIX_MASK = 0xFF,
44 
61  sqfs_u16 type;
62 
66  sqfs_u16 size;
67  sqfs_u8 key[];
68 };
69 
82  sqfs_u32 size;
83  sqfs_u8 value[];
84 };
85 
104  sqfs_u64 xattr;
105 
109  sqfs_u32 count;
110 
115  sqfs_u32 size;
116 };
117 
133 
137  sqfs_u32 xattr_ids;
138 
142  sqfs_u32 unused;
143 
148  sqfs_u64 locations[];
149 };
150 
151 #ifdef __cplusplus
152 extern "C" {
153 #endif
154 
165 SQFS_API const char *sqfs_get_xattr_prefix(SQFS_XATTR_TYPE id);
166 
179 SQFS_API int sqfs_get_xattr_prefix_id(const char *key);
180 
181 #ifdef __cplusplus
182 }
183 #endif
184 
185 #endif /* SQFS_XATTR_H */
On-disk data structure that holds a single xattr value.
Definition: xattr.h:78
sqfs_u32 unused
Unused, alwayas set this to 0 when writing!
Definition: xattr.h:142
sqfs_u16 type
Encodes the prefix of the key.
Definition: xattr.h:61
sqfs_u32 size
The exact size in bytes of the value that follows.
Definition: xattr.h:82
sqfs_u32 count
Number of consecutive key-value pairs.
Definition: xattr.h:109
On-disk data structure that holds a single xattr key.
Definition: xattr.h:53
On-disk data structure that the super block points to.
Definition: xattr.h:127
sqfs_u64 xattr
Location of the first key-value pair.
Definition: xattr.h:104
On-disk data structure that describes a set of key-value pairs.
Definition: xattr.h:94
sqfs_u16 size
The size in bytes of the suffix string that follows.
Definition: xattr.h:66
sqfs_u64 xattr_table_start
The location of the first meta data block holding the key value pairs.
Definition: xattr.h:132
SQFS_API const char * sqfs_get_xattr_prefix(SQFS_XATTR_TYPE id)
Resolve an xattr identifier to the coresponding prefix.
sqfs_u64 locations[]
Holds the locations of the meta data blocks that contain the sqfs_xattr_id_t descriptor array...
Definition: xattr.h:148
sqfs_u32 size
Total size of the uncompressed key-value pairs in bytes, including data structures used to encode the...
Definition: xattr.h:115
SQFS_XATTR_TYPE
Definition: xattr.h:36
Includes forward declarations of data structures, macros and integer types.
sqfs_u32 xattr_ids
The total number of descriptors (sqfs_xattr_id_t)
Definition: xattr.h:137
SQFS_API int sqfs_get_xattr_prefix_id(const char *key)
Resolve an xattr prefix into an identifier.