hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
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
....@@ -177,6 +191,7 @@
177191
178192 extern int ext4_expand_extra_isize_ea(struct inode *inode, int new_extra_isize,
179193 struct ext4_inode *raw_inode, handle_t *handle);
194
+extern void ext4_evict_ea_inode(struct inode *inode);
180195
181196 extern const struct xattr_handler *ext4_xattr_handlers[];
182197
....@@ -185,9 +200,9 @@
185200 extern int ext4_xattr_ibody_get(struct inode *inode, int name_index,
186201 const char *name,
187202 void *buffer, size_t buffer_size);
188
-extern int ext4_xattr_ibody_inline_set(handle_t *handle, struct inode *inode,
189
- struct ext4_xattr_info *i,
190
- struct ext4_xattr_ibody_find *is);
203
+extern int ext4_xattr_ibody_set(handle_t *handle, struct inode *inode,
204
+ struct ext4_xattr_info *i,
205
+ struct ext4_xattr_ibody_find *is);
191206
192207 extern struct mb_cache *ext4_xattr_create_cache(void);
193208 extern void ext4_xattr_destroy_cache(struct mb_cache *);