Commit | Line | Data |
---|---|---|
ac27a0ec | 1 | /* |
617ba13b | 2 | * linux/fs/ext4/xattr_user.c |
ac27a0ec DK |
3 | * Handler for extended user attributes. |
4 | * | |
5 | * Copyright (C) 2001 by Andreas Gruenbacher, <a.gruenbacher@computer.org> | |
6 | */ | |
7 | ||
ac27a0ec DK |
8 | #include <linux/string.h> |
9 | #include <linux/fs.h> | |
3dcf5451 CH |
10 | #include "ext4_jbd2.h" |
11 | #include "ext4.h" | |
ac27a0ec DK |
12 | #include "xattr.h" |
13 | ||
764a5c6b AG |
14 | static bool |
15 | ext4_xattr_user_list(struct dentry *dentry) | |
ac27a0ec | 16 | { |
764a5c6b | 17 | return test_opt(dentry->d_sb, XATTR_USER); |
ac27a0ec DK |
18 | } |
19 | ||
20 | static int | |
d9a82a04 AG |
21 | ext4_xattr_user_get(const struct xattr_handler *handler, |
22 | struct dentry *dentry, const char *name, | |
23 | void *buffer, size_t size) | |
ac27a0ec | 24 | { |
431547b3 | 25 | if (!test_opt(dentry->d_sb, XATTR_USER)) |
ac27a0ec | 26 | return -EOPNOTSUPP; |
2b0143b5 | 27 | return ext4_xattr_get(d_inode(dentry), EXT4_XATTR_INDEX_USER, |
431547b3 | 28 | name, buffer, size); |
ac27a0ec DK |
29 | } |
30 | ||
31 | static int | |
d9a82a04 AG |
32 | ext4_xattr_user_set(const struct xattr_handler *handler, |
33 | struct dentry *dentry, const char *name, | |
34 | const void *value, size_t size, int flags) | |
ac27a0ec | 35 | { |
431547b3 | 36 | if (!test_opt(dentry->d_sb, XATTR_USER)) |
ac27a0ec | 37 | return -EOPNOTSUPP; |
2b0143b5 | 38 | return ext4_xattr_set(d_inode(dentry), EXT4_XATTR_INDEX_USER, |
431547b3 | 39 | name, value, size, flags); |
ac27a0ec DK |
40 | } |
41 | ||
11e27528 | 42 | const struct xattr_handler ext4_xattr_user_handler = { |
ac27a0ec | 43 | .prefix = XATTR_USER_PREFIX, |
617ba13b MC |
44 | .list = ext4_xattr_user_list, |
45 | .get = ext4_xattr_user_get, | |
46 | .set = ext4_xattr_user_set, | |
ac27a0ec | 47 | }; |