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
commitaa4066ed7ba60421423c35f66b789bb3dd21d89e (patch)
tree3b3a805fd5acad82a5e4febb9770e939d9e533e3 /fs/ceph
parent881a5fa20092d221a7c4b365742c959ef4b297ec (diff)
ceph: encode type in vxattr callback routines
The names of the callback functions used for virtual extended attributes are based only on the last component of the attribute name. Because of the way these are defined, this precludes allowing a single (lowest) attribute name for different callbacks, dependent on the type of file being operated on. (For example, it might be nice to support both "ceph.dir.layout" and "ceph.file.layout".) Just change the callback names to avoid this problem. 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.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/fs/ceph/xattr.c b/fs/ceph/xattr.c
index e29c7d3fa405..46be30d6d127 100644
--- a/fs/ceph/xattr.c
+++ b/fs/ceph/xattr.c
@@ -33,49 +33,49 @@ struct ceph_vxattr {
33 33
34/* directories */ 34/* directories */
35 35
36static size_t ceph_vxattrcb_entries(struct ceph_inode_info *ci, char *val, 36static size_t ceph_vxattrcb_dir_entries(struct ceph_inode_info *ci, char *val,
37 size_t size) 37 size_t size)
38{ 38{
39 return snprintf(val, size, "%lld", ci->i_files + ci->i_subdirs); 39 return snprintf(val, size, "%lld", ci->i_files + ci->i_subdirs);
40} 40}
41 41
42static size_t ceph_vxattrcb_files(struct ceph_inode_info *ci, char *val, 42static size_t ceph_vxattrcb_dir_files(struct ceph_inode_info *ci, char *val,
43 size_t size) 43 size_t size)
44{ 44{
45 return snprintf(val, size, "%lld", ci->i_files); 45 return snprintf(val, size, "%lld", ci->i_files);
46} 46}
47 47
48static size_t ceph_vxattrcb_subdirs(struct ceph_inode_info *ci, char *val, 48static size_t ceph_vxattrcb_dir_subdirs(struct ceph_inode_info *ci, char *val,
49 size_t size) 49 size_t size)
50{ 50{
51 return snprintf(val, size, "%lld", ci->i_subdirs); 51 return snprintf(val, size, "%lld", ci->i_subdirs);
52} 52}
53 53
54static size_t ceph_vxattrcb_rentries(struct ceph_inode_info *ci, char *val, 54static size_t ceph_vxattrcb_dir_rentries(struct ceph_inode_info *ci, char *val,
55 size_t size) 55 size_t size)
56{ 56{
57 return snprintf(val, size, "%lld", ci->i_rfiles + ci->i_rsubdirs); 57 return snprintf(val, size, "%lld", ci->i_rfiles + ci->i_rsubdirs);
58} 58}
59 59
60static size_t ceph_vxattrcb_rfiles(struct ceph_inode_info *ci, char *val, 60static size_t ceph_vxattrcb_dir_rfiles(struct ceph_inode_info *ci, char *val,
61 size_t size) 61 size_t size)
62{ 62{
63 return snprintf(val, size, "%lld", ci->i_rfiles); 63 return snprintf(val, size, "%lld", ci->i_rfiles);
64} 64}
65 65
66static size_t ceph_vxattrcb_rsubdirs(struct ceph_inode_info *ci, char *val, 66static size_t ceph_vxattrcb_dir_rsubdirs(struct ceph_inode_info *ci, char *val,
67 size_t size) 67 size_t size)
68{ 68{
69 return snprintf(val, size, "%lld", ci->i_rsubdirs); 69 return snprintf(val, size, "%lld", ci->i_rsubdirs);
70} 70}
71 71
72static size_t ceph_vxattrcb_rbytes(struct ceph_inode_info *ci, char *val, 72static size_t ceph_vxattrcb_dir_rbytes(struct ceph_inode_info *ci, char *val,
73 size_t size) 73 size_t size)
74{ 74{
75 return snprintf(val, size, "%lld", ci->i_rbytes); 75 return snprintf(val, size, "%lld", ci->i_rbytes);
76} 76}
77 77
78static size_t ceph_vxattrcb_rctime(struct ceph_inode_info *ci, char *val, 78static size_t ceph_vxattrcb_dir_rctime(struct ceph_inode_info *ci, char *val,
79 size_t size) 79 size_t size)
80{ 80{
81 return snprintf(val, size, "%ld.%ld", (long)ci->i_rctime.tv_sec, 81 return snprintf(val, size, "%ld.%ld", (long)ci->i_rctime.tv_sec,
@@ -87,7 +87,7 @@ static size_t ceph_vxattrcb_rctime(struct ceph_inode_info *ci, char *val,
87#define XATTR_NAME_CEPH(_type, _name) \ 87#define XATTR_NAME_CEPH(_type, _name) \
88 { \ 88 { \
89 .name = CEPH_XATTR_NAME(_type, _name), \ 89 .name = CEPH_XATTR_NAME(_type, _name), \
90 .getxattr_cb = ceph_vxattrcb_ ## _name, \ 90 .getxattr_cb = ceph_vxattrcb_ ## _type ## _ ## _name, \
91 .readonly = true, \ 91 .readonly = true, \
92 } 92 }
93 93
@@ -105,7 +105,7 @@ static struct ceph_vxattr ceph_dir_vxattrs[] = {
105 105
106/* files */ 106/* files */
107 107
108static size_t ceph_vxattrcb_layout(struct ceph_inode_info *ci, char *val, 108static size_t ceph_vxattrcb_file_layout(struct ceph_inode_info *ci, char *val,
109 size_t size) 109 size_t size)
110{ 110{
111 int ret; 111 int ret;
@@ -127,7 +127,7 @@ static struct ceph_vxattr ceph_file_vxattrs[] = {
127 /* The following extended attribute name is deprecated */ 127 /* The following extended attribute name is deprecated */
128 { 128 {
129 .name = XATTR_CEPH_PREFIX "layout", 129 .name = XATTR_CEPH_PREFIX "layout",
130 .getxattr_cb = ceph_vxattrcb_layout, 130 .getxattr_cb = ceph_vxattrcb_file_layout,
131 .readonly = true, 131 .readonly = true,
132 }, 132 },
133 { 0 } /* Required table terminator */ 133 { 0 } /* Required table terminator */