]>
Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* |
2 | * linux/fs/ext2/xattr_trusted.c | |
3 | * Handler for trusted extended attributes. | |
4 | * | |
5 | * Copyright (C) 2003 by Andreas Gruenbacher, <[email protected]> | |
6 | */ | |
7 | ||
f7699f2b | 8 | #include "ext2.h" |
1da177e4 LT |
9 | #include "xattr.h" |
10 | ||
764a5c6b AG |
11 | static bool |
12 | ext2_xattr_trusted_list(struct dentry *dentry) | |
1da177e4 | 13 | { |
764a5c6b | 14 | return capable(CAP_SYS_ADMIN); |
1da177e4 LT |
15 | } |
16 | ||
17 | static int | |
d9a82a04 | 18 | ext2_xattr_trusted_get(const struct xattr_handler *handler, |
b296821a AV |
19 | struct dentry *unused, struct inode *inode, |
20 | const char *name, void *buffer, size_t size) | |
1da177e4 | 21 | { |
b296821a | 22 | return ext2_xattr_get(inode, EXT2_XATTR_INDEX_TRUSTED, name, |
1da177e4 LT |
23 | buffer, size); |
24 | } | |
25 | ||
26 | static int | |
d9a82a04 | 27 | ext2_xattr_trusted_set(const struct xattr_handler *handler, |
59301226 AV |
28 | struct dentry *unused, struct inode *inode, |
29 | const char *name, const void *value, | |
30 | size_t size, int flags) | |
1da177e4 | 31 | { |
59301226 | 32 | return ext2_xattr_set(inode, EXT2_XATTR_INDEX_TRUSTED, name, |
1da177e4 LT |
33 | value, size, flags); |
34 | } | |
35 | ||
749c72ef | 36 | const struct xattr_handler ext2_xattr_trusted_handler = { |
1da177e4 LT |
37 | .prefix = XATTR_TRUSTED_PREFIX, |
38 | .list = ext2_xattr_trusted_list, | |
39 | .get = ext2_xattr_trusted_get, | |
40 | .set = ext2_xattr_trusted_set, | |
41 | }; |