]> glassweightruler.freedombox.rocks Git - Ventoy.git/blob - SQUASHFS/squashfs-tools-4.4/squashfs-tools/xattr.h
add support for UnionTechOS fuyu (#864)
[Ventoy.git] / SQUASHFS / squashfs-tools-4.4 / squashfs-tools / xattr.h
1 #ifndef XATTR_H
2 #define XATTR_H
3 /*
4 * Create a squashfs filesystem. This is a highly compressed read only
5 * filesystem.
6 *
7 * Copyright (c) 2010, 2012, 2013, 2014, 2019
8 * Phillip Lougher <phillip@squashfs.org.uk>
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 2,
13 * or (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 *
24 * xattr.h
25 */
26
27 #define XATTR_VALUE_OOL SQUASHFS_XATTR_VALUE_OOL
28 #define XATTR_PREFIX_MASK SQUASHFS_XATTR_PREFIX_MASK
29
30 #define XATTR_VALUE_OOL_SIZE sizeof(long long)
31
32 /* maximum size of xattr value data that will be inlined */
33 #define XATTR_INLINE_MAX 128
34
35 /* the target size of an inode's xattr name:value list. If it
36 * exceeds this, then xattr value data will be successively out of lined
37 * until it meets the target */
38 #define XATTR_TARGET_MAX 65536
39
40 #define IS_XATTR(a) (a != SQUASHFS_INVALID_XATTR)
41
42 struct xattr_list {
43 char *name;
44 char *full_name;
45 int size;
46 int vsize;
47 void *value;
48 int type;
49 long long ool_value;
50 unsigned short vchecksum;
51 struct xattr_list *vnext;
52 };
53
54 struct dupl_id {
55 struct xattr_list *xattr_list;
56 int xattrs;
57 int xattr_id;
58 struct dupl_id *next;
59 };
60
61 struct prefix {
62 char *prefix;
63 int type;
64 };
65
66 extern int generate_xattrs(int, struct xattr_list *);
67
68 #ifdef XATTR_SUPPORT
69 extern int get_xattrs(int, struct squashfs_super_block *);
70 extern int read_xattrs(void *);
71 extern long long write_xattrs();
72 extern void save_xattrs();
73 extern void restore_xattrs();
74 extern unsigned int xattr_bytes, total_xattr_bytes;
75 extern int write_xattr(char *, unsigned int);
76 extern int read_xattrs_from_disk(int, struct squashfs_super_block *, int, long long *);
77 extern struct xattr_list *get_xattr(int, unsigned int *, int *);
78 extern void free_xattr(struct xattr_list *, int);
79 #else
80 static inline int get_xattrs(int fd, struct squashfs_super_block *sBlk)
81 {
82 if(sBlk->xattr_id_table_start != SQUASHFS_INVALID_BLK) {
83 fprintf(stderr, "Xattrs in filesystem! These are not "
84 "supported on this version of Squashfs\n");
85 return 0;
86 } else
87 return SQUASHFS_INVALID_BLK;
88 }
89
90
91 static inline int read_xattrs(void *dir_ent)
92 {
93 return SQUASHFS_INVALID_XATTR;
94 }
95
96
97 static inline long long write_xattrs()
98 {
99 return SQUASHFS_INVALID_BLK;
100 }
101
102
103 static inline void save_xattrs()
104 {
105 }
106
107
108 static inline void restore_xattrs()
109 {
110 }
111
112
113 static inline int write_xattr(char *pathname, unsigned int xattr)
114 {
115 return 0;
116 }
117
118
119 static inline int read_xattrs_from_disk(int fd, struct squashfs_super_block *sBlk, int flag, long long *table_start)
120 {
121 if(sBlk->xattr_id_table_start != SQUASHFS_INVALID_BLK) {
122 fprintf(stderr, "Xattrs in filesystem! These are not "
123 "supported on this version of Squashfs\n");
124 return 0;
125 } else
126 return SQUASHFS_INVALID_BLK;
127 }
128
129
130 static inline struct xattr_list *get_xattr(int i, unsigned int *count, int j)
131 {
132 return NULL;
133 }
134 #endif
135
136 #ifdef XATTR_SUPPORT
137 #ifdef XATTR_DEFAULT
138 #define NOXOPT_STR
139 #define XOPT_STR " (default)"
140 #define XATTR_DEF 0
141 #else
142 #define NOXOPT_STR " (default)"
143 #define XOPT_STR
144 #define XATTR_DEF 1
145 #endif
146 #else
147 #define NOXOPT_STR " (default)"
148 #define XOPT_STR " (unsupported)"
149 #define XATTR_DEF 1
150 #endif
151 #endif