Skip to content

Commit 879b382

Browse files
taoma-tmtytso
authored andcommitted
ext4: export inline xattr functions
The inline data feature will need some inline xattr functions, so export them from fs/ext4/xattr.c so that inline.c can use them. Signed-off-by: Tao Ma <[email protected]> Signed-off-by: "Theodore Ts'o" <[email protected]>
1 parent 152a7b0 commit 879b382

File tree

2 files changed

+64
-33
lines changed

2 files changed

+64
-33
lines changed

fs/ext4/xattr.c

Lines changed: 6 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,6 @@
6161
#include "xattr.h"
6262
#include "acl.h"
6363

64-
#define BHDR(bh) ((struct ext4_xattr_header *)((bh)->b_data))
65-
#define ENTRY(ptr) ((struct ext4_xattr_entry *)(ptr))
66-
#define BFIRST(bh) ENTRY(BHDR(bh)+1)
67-
#define IS_LAST_ENTRY(entry) (*(__u32 *)(entry) == 0)
68-
6964
#ifdef EXT4_XATTR_DEBUG
7065
# define ea_idebug(inode, f...) do { \
7166
printk(KERN_DEBUG "inode %s:%lu: ", \
@@ -312,7 +307,7 @@ ext4_xattr_block_get(struct inode *inode, int name_index, const char *name,
312307
return error;
313308
}
314309

315-
static int
310+
int
316311
ext4_xattr_ibody_get(struct inode *inode, int name_index, const char *name,
317312
void *buffer, size_t buffer_size)
318313
{
@@ -581,21 +576,6 @@ static size_t ext4_xattr_free_space(struct ext4_xattr_entry *last,
581576
return (*min_offs - ((void *)last - base) - sizeof(__u32));
582577
}
583578

584-
struct ext4_xattr_info {
585-
int name_index;
586-
const char *name;
587-
const void *value;
588-
size_t value_len;
589-
};
590-
591-
struct ext4_xattr_search {
592-
struct ext4_xattr_entry *first;
593-
void *base;
594-
void *end;
595-
struct ext4_xattr_entry *here;
596-
int not_found;
597-
};
598-
599579
static int
600580
ext4_xattr_set_entry(struct ext4_xattr_info *i, struct ext4_xattr_search *s)
601581
{
@@ -949,14 +929,8 @@ ext4_xattr_block_set(handle_t *handle, struct inode *inode,
949929
#undef header
950930
}
951931

952-
struct ext4_xattr_ibody_find {
953-
struct ext4_xattr_search s;
954-
struct ext4_iloc iloc;
955-
};
956-
957-
static int
958-
ext4_xattr_ibody_find(struct inode *inode, struct ext4_xattr_info *i,
959-
struct ext4_xattr_ibody_find *is)
932+
int ext4_xattr_ibody_find(struct inode *inode, struct ext4_xattr_info *i,
933+
struct ext4_xattr_ibody_find *is)
960934
{
961935
struct ext4_xattr_ibody_header *header;
962936
struct ext4_inode *raw_inode;
@@ -984,10 +958,9 @@ ext4_xattr_ibody_find(struct inode *inode, struct ext4_xattr_info *i,
984958
return 0;
985959
}
986960

987-
static int
988-
ext4_xattr_ibody_set(handle_t *handle, struct inode *inode,
989-
struct ext4_xattr_info *i,
990-
struct ext4_xattr_ibody_find *is)
961+
int ext4_xattr_ibody_set(handle_t *handle, struct inode *inode,
962+
struct ext4_xattr_info *i,
963+
struct ext4_xattr_ibody_find *is)
991964
{
992965
struct ext4_xattr_ibody_header *header;
993966
struct ext4_xattr_search *s = &is->s;

fs/ext4/xattr.h

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,32 @@ struct ext4_xattr_entry {
6565
EXT4_I(inode)->i_extra_isize))
6666
#define IFIRST(hdr) ((struct ext4_xattr_entry *)((hdr)+1))
6767

68+
#define BHDR(bh) ((struct ext4_xattr_header *)((bh)->b_data))
69+
#define ENTRY(ptr) ((struct ext4_xattr_entry *)(ptr))
70+
#define BFIRST(bh) ENTRY(BHDR(bh)+1)
71+
#define IS_LAST_ENTRY(entry) (*(__u32 *)(entry) == 0)
72+
73+
74+
struct ext4_xattr_info {
75+
int name_index;
76+
const char *name;
77+
const void *value;
78+
size_t value_len;
79+
};
80+
81+
struct ext4_xattr_search {
82+
struct ext4_xattr_entry *first;
83+
void *base;
84+
void *end;
85+
struct ext4_xattr_entry *here;
86+
int not_found;
87+
};
88+
89+
struct ext4_xattr_ibody_find {
90+
struct ext4_xattr_search s;
91+
struct ext4_iloc iloc;
92+
};
93+
6894
# ifdef CONFIG_EXT4_FS_XATTR
6995

7096
extern const struct xattr_handler ext4_xattr_user_handler;
@@ -90,6 +116,15 @@ extern void ext4_exit_xattr(void);
90116

91117
extern const struct xattr_handler *ext4_xattr_handlers[];
92118

119+
extern int ext4_xattr_ibody_find(struct inode *inode, struct ext4_xattr_info *i,
120+
struct ext4_xattr_ibody_find *is);
121+
extern int ext4_xattr_ibody_get(struct inode *inode, int name_index,
122+
const char *name,
123+
void *buffer, size_t buffer_size);
124+
extern int ext4_xattr_ibody_set(handle_t *handle, struct inode *inode,
125+
struct ext4_xattr_info *i,
126+
struct ext4_xattr_ibody_find *is);
127+
93128
# else /* CONFIG_EXT4_FS_XATTR */
94129

95130
static inline int
@@ -143,6 +178,29 @@ ext4_expand_extra_isize_ea(struct inode *inode, int new_extra_isize,
143178

144179
#define ext4_xattr_handlers NULL
145180

181+
static inline int
182+
ext4_xattr_ibody_find(struct inode *inode, struct ext4_xattr_info *i,
183+
struct ext4_xattr_ibody_find *is)
184+
{
185+
return -EOPNOTSUPP;
186+
}
187+
188+
static inline int
189+
ext4_xattr_ibody_set(handle_t *handle, struct inode *inode,
190+
struct ext4_xattr_info *i,
191+
struct ext4_xattr_ibody_find *is)
192+
{
193+
return -EOPNOTSUPP;
194+
}
195+
196+
static inline int
197+
ext4_xattr_ibody_get(struct inode *inode, int name_index,
198+
const char *name,
199+
void *buffer, size_t buffer_size)
200+
{
201+
return -EOPNOTSUPP;
202+
}
203+
146204
# endif /* CONFIG_EXT4_FS_XATTR */
147205

148206
#ifdef CONFIG_EXT4_FS_SECURITY

0 commit comments

Comments
 (0)