diff options
author | Sage Weil <sage@inktank.com> | 2013-01-31 14:53:27 -0500 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-02-13 21:25:47 -0500 |
commit | 8860147a01c4243f64f7d602dbf8342ca616ed45 (patch) | |
tree | cdc3b501c724afd1ce3708cdf268cf99171d53e5 /fs | |
parent | 39b648d9ec7d4ab0b4362872c6284a12c582afa6 (diff) |
ceph: support hidden vxattrs
Add ability to flag virtual xattrs as hidden, such that you can
getxattr them but they do not appear in listxattr.
Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Sam Lang <sam.lang@inktank.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ceph/xattr.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/fs/ceph/xattr.c b/fs/ceph/xattr.c index c2048b1a5395..43063d0dee8f 100644 --- a/fs/ceph/xattr.c +++ b/fs/ceph/xattr.c | |||
@@ -29,7 +29,7 @@ struct ceph_vxattr { | |||
29 | size_t name_size; /* strlen(name) + 1 (for '\0') */ | 29 | size_t name_size; /* strlen(name) + 1 (for '\0') */ |
30 | size_t (*getxattr_cb)(struct ceph_inode_info *ci, char *val, | 30 | size_t (*getxattr_cb)(struct ceph_inode_info *ci, char *val, |
31 | size_t size); | 31 | size_t size); |
32 | bool readonly; | 32 | bool readonly, hidden; |
33 | }; | 33 | }; |
34 | 34 | ||
35 | /* directories */ | 35 | /* directories */ |
@@ -85,13 +85,14 @@ static size_t ceph_vxattrcb_dir_rctime(struct ceph_inode_info *ci, char *val, | |||
85 | 85 | ||
86 | #define CEPH_XATTR_NAME(_type, _name) XATTR_CEPH_PREFIX #_type "." #_name | 86 | #define CEPH_XATTR_NAME(_type, _name) XATTR_CEPH_PREFIX #_type "." #_name |
87 | 87 | ||
88 | #define XATTR_NAME_CEPH(_type, _name) \ | 88 | #define XATTR_NAME_CEPH(_type, _name) \ |
89 | { \ | 89 | { \ |
90 | .name = CEPH_XATTR_NAME(_type, _name), \ | 90 | .name = CEPH_XATTR_NAME(_type, _name), \ |
91 | .name_size = sizeof (CEPH_XATTR_NAME(_type, _name)), \ | 91 | .name_size = sizeof (CEPH_XATTR_NAME(_type, _name)), \ |
92 | .getxattr_cb = ceph_vxattrcb_ ## _type ## _ ## _name, \ | 92 | .getxattr_cb = ceph_vxattrcb_ ## _type ## _ ## _name, \ |
93 | .readonly = true, \ | 93 | .readonly = true, \ |
94 | } | 94 | .hidden = false, \ |
95 | } | ||
95 | 96 | ||
96 | static struct ceph_vxattr ceph_dir_vxattrs[] = { | 97 | static struct ceph_vxattr ceph_dir_vxattrs[] = { |
97 | XATTR_NAME_CEPH(dir, entries), | 98 | XATTR_NAME_CEPH(dir, entries), |
@@ -157,7 +158,8 @@ static size_t __init vxattrs_name_size(struct ceph_vxattr *vxattrs) | |||
157 | size_t size = 0; | 158 | size_t size = 0; |
158 | 159 | ||
159 | for (vxattr = vxattrs; vxattr->name; vxattr++) | 160 | for (vxattr = vxattrs; vxattr->name; vxattr++) |
160 | size += vxattr->name_size; | 161 | if (!vxattr->hidden) |
162 | size += vxattr->name_size; | ||
161 | 163 | ||
162 | return size; | 164 | return size; |
163 | } | 165 | } |