Skip to content

Commit 8860147

Browse files
author
Sage Weil
committed
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>
1 parent 39b648d commit 8860147

1 file changed

Lines changed: 11 additions & 9 deletions

File tree

‎fs/ceph/xattr.c‎

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ struct ceph_vxattr {
2929
size_t name_size; /* strlen(name) + 1 (for '\0') */
3030
size_t (*getxattr_cb)(struct ceph_inode_info *ci, char *val,
3131
size_t size);
32-
bool readonly;
32+
bool readonly, hidden;
3333
};
3434

3535
/* directories */
@@ -85,13 +85,14 @@ static size_t ceph_vxattrcb_dir_rctime(struct ceph_inode_info *ci, char *val,
8585

8686
#define CEPH_XATTR_NAME(_type, _name) XATTR_CEPH_PREFIX #_type "." #_name
8787

88-
#define XATTR_NAME_CEPH(_type, _name) \
89-
{ \
90-
.name = CEPH_XATTR_NAME(_type, _name), \
91-
.name_size = sizeof (CEPH_XATTR_NAME(_type, _name)), \
92-
.getxattr_cb = ceph_vxattrcb_ ## _type ## _ ## _name, \
93-
.readonly = true, \
94-
}
88+
#define XATTR_NAME_CEPH(_type, _name) \
89+
{ \
90+
.name = CEPH_XATTR_NAME(_type, _name), \
91+
.name_size = sizeof (CEPH_XATTR_NAME(_type, _name)), \
92+
.getxattr_cb = ceph_vxattrcb_ ## _type ## _ ## _name, \
93+
.readonly = true, \
94+
.hidden = false, \
95+
}
9596

9697
static struct ceph_vxattr ceph_dir_vxattrs[] = {
9798
XATTR_NAME_CEPH(dir, entries),
@@ -157,7 +158,8 @@ static size_t __init vxattrs_name_size(struct ceph_vxattr *vxattrs)
157158
size_t size = 0;
158159

159160
for (vxattr = vxattrs; vxattr->name; vxattr++)
160-
size += vxattr->name_size;
161+
if (!vxattr->hidden)
162+
size += vxattr->name_size;
161163

162164
return size;
163165
}

0 commit comments

Comments
 (0)