forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-09 95099d4622f8cb224d94e314c7a8e0df60b13f87
kernel/fs/ext4/xattr.h
....@@ -48,7 +48,7 @@
4848 __le32 e_value_inum; /* inode in which the value is stored */
4949 __le32 e_value_size; /* size of attribute value */
5050 __le32 e_hash; /* hash value of name and value */
51
- char e_name[0]; /* attribute name */
51
+ char e_name[]; /* attribute name */
5252 };
5353
5454 #define EXT4_XATTR_PAD_BITS 2
....@@ -95,6 +95,19 @@
9595
9696 #define EXT4_ZERO_XATTR_VALUE ((void *)-1)
9797
98
+/*
99
+ * If we want to add an xattr to the inode, we should make sure that
100
+ * i_extra_isize is not 0 and that the inode size is not less than
101
+ * EXT4_GOOD_OLD_INODE_SIZE + extra_isize + pad.
102
+ * EXT4_GOOD_OLD_INODE_SIZE extra_isize header entry pad data
103
+ * |--------------------------|------------|------|---------|---|-------|
104
+ */
105
+#define EXT4_INODE_HAS_XATTR_SPACE(inode) \
106
+ ((EXT4_I(inode)->i_extra_isize != 0) && \
107
+ (EXT4_GOOD_OLD_INODE_SIZE + EXT4_I(inode)->i_extra_isize + \
108
+ sizeof(struct ext4_xattr_ibody_header) + EXT4_XATTR_PAD <= \
109
+ EXT4_INODE_SIZE((inode)->i_sb)))
110
+
98111 struct ext4_xattr_info {
99112 const char *name;
100113 const void *value;
....@@ -118,12 +131,13 @@
118131
119132 struct ext4_xattr_inode_array {
120133 unsigned int count; /* # of used items in the array */
121
- struct inode *inodes[0];
134
+ struct inode *inodes[];
122135 };
123136
124137 extern const struct xattr_handler ext4_xattr_user_handler;
125138 extern const struct xattr_handler ext4_xattr_trusted_handler;
126139 extern const struct xattr_handler ext4_xattr_security_handler;
140
+extern const struct xattr_handler ext4_xattr_hurd_handler;
127141
128142 #define EXT4_XATTR_NAME_ENCRYPTION_CONTEXT "c"
129143