Blame view
fs/ext4/xattr_user.c
1.23 KB
b24413180
|
1 |
// SPDX-License-Identifier: GPL-2.0 |
ac27a0ec1
|
2 |
/* |
617ba13b3
|
3 |
* linux/fs/ext4/xattr_user.c |
ac27a0ec1
|
4 5 6 7 |
* Handler for extended user attributes. * * Copyright (C) 2001 by Andreas Gruenbacher, <a.gruenbacher@computer.org> */ |
ac27a0ec1
|
8 9 |
#include <linux/string.h> #include <linux/fs.h> |
3dcf54515
|
10 11 |
#include "ext4_jbd2.h" #include "ext4.h" |
ac27a0ec1
|
12 |
#include "xattr.h" |
764a5c6b1
|
13 14 |
static bool ext4_xattr_user_list(struct dentry *dentry) |
ac27a0ec1
|
15 |
{ |
764a5c6b1
|
16 |
return test_opt(dentry->d_sb, XATTR_USER); |
ac27a0ec1
|
17 18 19 |
} static int |
d9a82a040
|
20 |
ext4_xattr_user_get(const struct xattr_handler *handler, |
b296821a7
|
21 |
struct dentry *unused, struct inode *inode, |
3484eba91
|
22 |
const char *name, void *buffer, size_t size, int flags) |
ac27a0ec1
|
23 |
{ |
b296821a7
|
24 |
if (!test_opt(inode->i_sb, XATTR_USER)) |
ac27a0ec1
|
25 |
return -EOPNOTSUPP; |
b296821a7
|
26 |
return ext4_xattr_get(inode, EXT4_XATTR_INDEX_USER, |
431547b3c
|
27 |
name, buffer, size); |
ac27a0ec1
|
28 29 30 |
} static int |
d9a82a040
|
31 |
ext4_xattr_user_set(const struct xattr_handler *handler, |
593012268
|
32 33 34 |
struct dentry *unused, struct inode *inode, const char *name, const void *value, size_t size, int flags) |
ac27a0ec1
|
35 |
{ |
593012268
|
36 |
if (!test_opt(inode->i_sb, XATTR_USER)) |
ac27a0ec1
|
37 |
return -EOPNOTSUPP; |
593012268
|
38 |
return ext4_xattr_set(inode, EXT4_XATTR_INDEX_USER, |
431547b3c
|
39 |
name, value, size, flags); |
ac27a0ec1
|
40 |
} |
11e275280
|
41 |
const struct xattr_handler ext4_xattr_user_handler = { |
ac27a0ec1
|
42 |
.prefix = XATTR_USER_PREFIX, |
617ba13b3
|
43 44 45 |
.list = ext4_xattr_user_list, .get = ext4_xattr_user_get, .set = ext4_xattr_user_set, |
ac27a0ec1
|
46 |
}; |