name += this_len;
size -= this_len;
}
-
- const VXattr *vxattr;
- for (vxattr = _get_vxattrs(in); vxattr && !vxattr->name.empty(); vxattr++) {
- if (vxattr->hidden)
- continue;
- // call pointer-to-member function
- if (vxattr->exists_cb && !(this->*(vxattr->exists_cb))(in))
- continue;
-
- size_t this_len = vxattr->name.length() + 1;
- r += this_len;
- if (len_only)
- continue;
-
- if (this_len > size) {
- r = -ERANGE;
- goto out;
- }
-
- memcpy(name, vxattr->name.c_str(), this_len);
- name += this_len;
- size -= this_len;
- }
out:
ldout(cct, 8) << __func__ << "(" << in->ino << ", " << size << ") = " << r << dendl;
return r;
name: CEPH_XATTR_NAME(_type, _name), \
getxattr_cb: &Client::_vxattrcb_ ## _type ## _ ## _name, \
readonly: true, \
- hidden: false, \
exists_cb: NULL, \
flags: 0, \
}
name: CEPH_XATTR_NAME(_type, _name), \
getxattr_cb: &Client::_vxattrcb_ ## _type ## _ ## _name, \
readonly: true, \
- hidden: false, \
exists_cb: NULL, \
flags: _flags, \
}
name: CEPH_XATTR_NAME2(_type, _name, _field), \
getxattr_cb: &Client::_vxattrcb_ ## _name ## _ ## _field, \
readonly: false, \
- hidden: true, \
exists_cb: &Client::_vxattrcb_layout_exists, \
flags: 0, \
}
name: CEPH_XATTR_NAME(_type, _name), \
getxattr_cb: &Client::_vxattrcb_ ## _type ## _ ## _name, \
readonly: false, \
- hidden: true, \
exists_cb: &Client::_vxattrcb_quota_exists, \
flags: 0, \
}
name: "ceph.dir.layout",
getxattr_cb: &Client::_vxattrcb_layout,
readonly: false,
- hidden: true,
exists_cb: &Client::_vxattrcb_layout_exists,
flags: 0,
},
name: "ceph.quota",
getxattr_cb: &Client::_vxattrcb_quota,
readonly: false,
- hidden: true,
exists_cb: &Client::_vxattrcb_quota_exists,
flags: 0,
},
name: "ceph.dir.pin",
getxattr_cb: &Client::_vxattrcb_dir_pin,
readonly: false,
- hidden: true,
exists_cb: &Client::_vxattrcb_dir_pin_exists,
flags: 0,
},
name: "ceph.snap.btime",
getxattr_cb: &Client::_vxattrcb_snap_btime,
readonly: true,
- hidden: false,
exists_cb: &Client::_vxattrcb_snap_btime_exists,
flags: 0,
},
name: "ceph.file.layout",
getxattr_cb: &Client::_vxattrcb_layout,
readonly: false,
- hidden: true,
exists_cb: &Client::_vxattrcb_layout_exists,
flags: 0,
},
name: "ceph.snap.btime",
getxattr_cb: &Client::_vxattrcb_snap_btime,
readonly: true,
- hidden: false,
exists_cb: &Client::_vxattrcb_snap_btime_exists,
flags: 0,
},
char *n;
i = 'a';
while (len > 0) {
- // skip/ignore the dir layout
- if (strcmp(p, "ceph.dir.layout") == 0 ||
- strcmp(p, "ceph.file.layout") == 0) {
- len -= strlen(p) + 1;
- p += strlen(p) + 1;
- continue;
- }
+ // ceph.* xattrs should not be listed
+ ASSERT_NE(strncmp(p, "ceph.", 5), 0);
sprintf(xattrk, "user.test_xattr_%c", i);
ASSERT_STREQ(p, xattrk);
utime_t new_btime = utime_t(strtoull(gxattrv2, NULL, 10), strtoull(s + 1, NULL, 10));
ASSERT_LT(btime, new_btime);
- // check that the snap.btime vxattr appears in listxattr()
+ // listxattr() shouldn't return snap.btime vxattr
char xattrlist[512];
- int len = ceph_listxattr(cmount, c_temp, xattrlist, sizeof(xattrlist));
- ASSERT_GT(len, 0);
+ int len = ceph_listxattr(cmount, test_snap_xattr_file, xattrlist, sizeof(xattrlist));
ASSERT_GE(sizeof(xattrlist), (size_t)len);
char *p = xattrlist;
int found = 0;
len -= strlen(p) + 1;
p += strlen(p) + 1;
}
- ASSERT_EQ(found, 1);
-
- // listxattr() shouldn't return snap.btime vxattr for non-snaps
- len = ceph_listxattr(cmount, test_snap_xattr_file, xattrlist, sizeof(xattrlist));
- ASSERT_GE(sizeof(xattrlist), (size_t)len);
- p = xattrlist;
- found = 0;
- while (len > 0) {
- if (strcmp(p, "ceph.snap.btime") == 0)
- found++;
- len -= strlen(p) + 1;
- p += strlen(p) + 1;
- }
ASSERT_EQ(found, 0);
ceph_shutdown(cmount);