]>
glassweightruler.freedombox.rocks Git - Ventoy.git/blob - SQUASHFS/squashfs-tools-4.4/squashfs-tools/xattr.h
4 * Create a squashfs filesystem. This is a highly compressed read only
7 * Copyright (c) 2010, 2012, 2013, 2014, 2019
8 * Phillip Lougher <phillip@squashfs.org.uk>
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.
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.
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.
27 #define XATTR_VALUE_OOL SQUASHFS_XATTR_VALUE_OOL
28 #define XATTR_PREFIX_MASK SQUASHFS_XATTR_PREFIX_MASK
30 #define XATTR_VALUE_OOL_SIZE sizeof(long long)
32 /* maximum size of xattr value data that will be inlined */
33 #define XATTR_INLINE_MAX 128
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
40 #define IS_XATTR(a) (a != SQUASHFS_INVALID_XATTR)
50 unsigned short vchecksum
;
51 struct xattr_list
*vnext
;
55 struct xattr_list
*xattr_list
;
66 extern int generate_xattrs(int, struct xattr_list
*);
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);
80 static inline int get_xattrs(int fd
, struct squashfs_super_block
*sBlk
)
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");
87 return SQUASHFS_INVALID_BLK
;
91 static inline int read_xattrs(void *dir_ent
)
93 return SQUASHFS_INVALID_XATTR
;
97 static inline long long write_xattrs()
99 return SQUASHFS_INVALID_BLK
;
103 static inline void save_xattrs()
108 static inline void restore_xattrs()
113 static inline int write_xattr(char *pathname
, unsigned int xattr
)
119 static inline int read_xattrs_from_disk(int fd
, struct squashfs_super_block
*sBlk
, int flag
, long long *table_start
)
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");
126 return SQUASHFS_INVALID_BLK
;
130 static inline struct xattr_list
*get_xattr(int i
, unsigned int *count
, int j
)
139 #define XOPT_STR " (default)"
142 #define NOXOPT_STR " (default)"
147 #define NOXOPT_STR " (default)"
148 #define XOPT_STR " (unsupported)"