aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ceph
diff options
context:
space:
mode:
authorAlex Elder <elder@dreamhost.com>2012-01-23 16:49:28 -0500
committerAlex Elder <elder@dreamhost.com>2012-03-22 11:47:46 -0400
commit22891907193e005923a14384d82d702f6af4f0cf (patch)
treeb41d7d2360f6fa013cc4a8b3732571f5d74afa1a /fs/ceph
parent06476a69d8954f36a15ff5ddbfd47bdfcff22791 (diff)
ceph: use a symbolic name for "ceph." extended attribute namespace
Use symbolic constants to define the top-level prefix for "ceph." extended attribute names. Signed-off-by: Alex Elder <elder@dreamhost.com> Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'fs/ceph')
-rw-r--r--fs/ceph/xattr.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/fs/ceph/xattr.c b/fs/ceph/xattr.c
index 3418615c53ea..05bb56f402a4 100644
--- a/fs/ceph/xattr.c
+++ b/fs/ceph/xattr.c
@@ -8,9 +8,12 @@
8#include <linux/xattr.h> 8#include <linux/xattr.h>
9#include <linux/slab.h> 9#include <linux/slab.h>
10 10
11#define XATTR_CEPH_PREFIX "ceph."
12#define XATTR_CEPH_PREFIX_LEN (sizeof (XATTR_CEPH_PREFIX) - 1)
13
11static bool ceph_is_valid_xattr(const char *name) 14static bool ceph_is_valid_xattr(const char *name)
12{ 15{
13 return !strncmp(name, "ceph.", 5) || 16 return !strncmp(name, XATTR_CEPH_PREFIX, XATTR_CEPH_PREFIX_LEN) ||
14 !strncmp(name, XATTR_SECURITY_PREFIX, 17 !strncmp(name, XATTR_SECURITY_PREFIX,
15 XATTR_SECURITY_PREFIX_LEN) || 18 XATTR_SECURITY_PREFIX_LEN) ||
16 !strncmp(name, XATTR_TRUSTED_PREFIX, XATTR_TRUSTED_PREFIX_LEN) || 19 !strncmp(name, XATTR_TRUSTED_PREFIX, XATTR_TRUSTED_PREFIX_LEN) ||
@@ -80,14 +83,14 @@ static size_t ceph_vxattrcb_rctime(struct ceph_inode_info *ci, char *val,
80} 83}
81 84
82static struct ceph_vxattr_cb ceph_dir_vxattrs[] = { 85static struct ceph_vxattr_cb ceph_dir_vxattrs[] = {
83 { true, "ceph.dir.entries", ceph_vxattrcb_entries}, 86 { true, XATTR_CEPH_PREFIX "dir.entries", ceph_vxattrcb_entries},
84 { true, "ceph.dir.files", ceph_vxattrcb_files}, 87 { true, XATTR_CEPH_PREFIX "dir.files", ceph_vxattrcb_files},
85 { true, "ceph.dir.subdirs", ceph_vxattrcb_subdirs}, 88 { true, XATTR_CEPH_PREFIX "dir.subdirs", ceph_vxattrcb_subdirs},
86 { true, "ceph.dir.rentries", ceph_vxattrcb_rentries}, 89 { true, XATTR_CEPH_PREFIX "dir.rentries", ceph_vxattrcb_rentries},
87 { true, "ceph.dir.rfiles", ceph_vxattrcb_rfiles}, 90 { true, XATTR_CEPH_PREFIX "dir.rfiles", ceph_vxattrcb_rfiles},
88 { true, "ceph.dir.rsubdirs", ceph_vxattrcb_rsubdirs}, 91 { true, XATTR_CEPH_PREFIX "dir.rsubdirs", ceph_vxattrcb_rsubdirs},
89 { true, "ceph.dir.rbytes", ceph_vxattrcb_rbytes}, 92 { true, XATTR_CEPH_PREFIX "dir.rbytes", ceph_vxattrcb_rbytes},
90 { true, "ceph.dir.rctime", ceph_vxattrcb_rctime}, 93 { true, XATTR_CEPH_PREFIX "dir.rctime", ceph_vxattrcb_rctime},
91 { true, NULL, NULL } 94 { true, NULL, NULL }
92}; 95};
93 96
@@ -111,9 +114,9 @@ static size_t ceph_vxattrcb_layout(struct ceph_inode_info *ci, char *val,
111} 114}
112 115
113static struct ceph_vxattr_cb ceph_file_vxattrs[] = { 116static struct ceph_vxattr_cb ceph_file_vxattrs[] = {
114 { true, "ceph.file.layout", ceph_vxattrcb_layout}, 117 { true, XATTR_CEPH_PREFIX "file.layout", ceph_vxattrcb_layout},
115 /* The following extended attribute name is deprecated */ 118 /* The following extended attribute name is deprecated */
116 { true, "ceph.layout", ceph_vxattrcb_layout}, 119 { true, XATTR_CEPH_PREFIX "layout", ceph_vxattrcb_layout},
117 { true, NULL, NULL } 120 { true, NULL, NULL }
118}; 121};
119 122