ceph: support hidden vxattrs
[firefly-linux-kernel-4.4.55.git] / fs / ceph / xattr.c
index 2c2ae5be99027af909d30a65cb73706a7c0d193a..43063d0dee8f16973a78b964fb76db7d8fb1d9d9 100644 (file)
@@ -29,7 +29,7 @@ struct ceph_vxattr {
        size_t name_size;       /* strlen(name) + 1 (for '\0') */
        size_t (*getxattr_cb)(struct ceph_inode_info *ci, char *val,
                              size_t size);
-       bool readonly;
+       bool readonly, hidden;
 };
 
 /* directories */
@@ -85,13 +85,14 @@ static size_t ceph_vxattrcb_dir_rctime(struct ceph_inode_info *ci, char *val,
 
 #define CEPH_XATTR_NAME(_type, _name)  XATTR_CEPH_PREFIX #_type "." #_name
 
-#define XATTR_NAME_CEPH(_type, _name) \
-               { \
-                       .name = CEPH_XATTR_NAME(_type, _name), \
-                       .name_size = sizeof (CEPH_XATTR_NAME(_type, _name)), \
-                       .getxattr_cb = ceph_vxattrcb_ ## _type ## _ ## _name, \
-                       .readonly = true, \
-               }
+#define XATTR_NAME_CEPH(_type, _name)                                  \
+       {                                                               \
+               .name = CEPH_XATTR_NAME(_type, _name),                  \
+               .name_size = sizeof (CEPH_XATTR_NAME(_type, _name)), \
+               .getxattr_cb = ceph_vxattrcb_ ## _type ## _ ## _name, \
+               .readonly = true,                               \
+               .hidden = false,                                \
+       }
 
 static struct ceph_vxattr ceph_dir_vxattrs[] = {
        XATTR_NAME_CEPH(dir, entries),
@@ -123,13 +124,6 @@ static size_t ceph_vxattrcb_file_layout(struct ceph_inode_info *ci, char *val,
 
 static struct ceph_vxattr ceph_file_vxattrs[] = {
        XATTR_NAME_CEPH(file, layout),
-       /* The following extended attribute name is deprecated */
-       {
-               .name = XATTR_CEPH_PREFIX "layout",
-               .name_size = sizeof (XATTR_CEPH_PREFIX "layout"),
-               .getxattr_cb = ceph_vxattrcb_file_layout,
-               .readonly = true,
-       },
        { 0 }   /* Required table terminator */
 };
 static size_t ceph_file_vxattrs_name_size;     /* total size of all names */
@@ -164,7 +158,8 @@ static size_t __init vxattrs_name_size(struct ceph_vxattr *vxattrs)
        size_t size = 0;
 
        for (vxattr = vxattrs; vxattr->name; vxattr++)
-               size += vxattr->name_size;
+               if (!vxattr->hidden)
+                       size += vxattr->name_size;
 
        return size;
 }