From: Jeff Layton Date: Mon, 24 Oct 2016 14:02:59 +0000 (-0400) Subject: client: convert ceph_ll_setxattr, listxattr, removexattr to take a UserPerms pointer X-Git-Tag: v11.1.0~383^2~17 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=775900e9b362e00bdac2399452cf6688ecdb7f9c;p=ceph.git client: convert ceph_ll_setxattr, listxattr, removexattr to take a UserPerms pointer Signed-off-by: Jeff Layton --- diff --git a/src/include/cephfs/libcephfs.h b/src/include/cephfs/libcephfs.h index eb88915dad0e..8bb8baf6f3d8 100644 --- a/src/include/cephfs/libcephfs.h +++ b/src/include/cephfs/libcephfs.h @@ -1471,11 +1471,12 @@ int ceph_ll_getxattr(struct ceph_mount_info *cmount, struct Inode *in, const UserPerm *perms); int ceph_ll_setxattr(struct ceph_mount_info *cmount, struct Inode *in, const char *name, const void *value, size_t size, - int flags, int uid, int gid); + int flags, const UserPerm *perms); int ceph_ll_listxattr(struct ceph_mount_info *cmount, struct Inode *in, - char *list, size_t buf_size, size_t *list_size, int uid, int gid); + char *list, size_t buf_size, size_t *list_size, + const UserPerm *perms); int ceph_ll_removexattr(struct ceph_mount_info *cmount, struct Inode *in, - const char *name, int uid, int gid); + const char *name, const UserPerm *perms); int ceph_ll_create(struct ceph_mount_info *cmount, struct Inode *parent, const char *name, mode_t mode, int flags, struct stat *attr, struct Inode **out, Fh **fhp, diff --git a/src/libcephfs.cc b/src/libcephfs.cc index 5dca674ff291..ca5415aae213 100644 --- a/src/libcephfs.cc +++ b/src/libcephfs.cc @@ -1650,10 +1650,10 @@ extern "C" int ceph_ll_getxattr(class ceph_mount_info *cmount, extern "C" int ceph_ll_listxattr(struct ceph_mount_info *cmount, Inode *in, char *list, - size_t buf_size, size_t *list_size, int uid, int gid) + size_t buf_size, size_t *list_size, + const UserPerm *perms) { - UserPerm perms(uid, gid); - int res = cmount->get_client()->ll_listxattr(in, list, buf_size, perms); + int res = cmount->get_client()->ll_listxattr(in, list, buf_size, *perms); if (res >= 0) { *list_size = (size_t)res; return 0; @@ -1664,18 +1664,16 @@ extern "C" int ceph_ll_listxattr(struct ceph_mount_info *cmount, extern "C" int ceph_ll_setxattr(class ceph_mount_info *cmount, Inode *in, const char *name, const void *value, size_t size, - int flags, int uid, int gid) + int flags, const UserPerm *perms) { - UserPerm perms(uid, gid); - return (cmount->get_client()->ll_setxattr(in, name, value, size, flags, perms)); + return (cmount->get_client()->ll_setxattr(in, name, value, size, flags, *perms)); } extern "C" int ceph_ll_removexattr(class ceph_mount_info *cmount, Inode *in, const char *name, - int uid, int gid) + const UserPerm *perms) { - UserPerm perms(uid, gid); - return (cmount->get_client()->ll_removexattr(in, name, perms)); + return (cmount->get_client()->ll_removexattr(in, name, *perms)); } extern "C" int ceph_ll_getlk(struct ceph_mount_info *cmount, diff --git a/src/test/libcephfs/test.cc b/src/test/libcephfs/test.cc index 810c03060cdf..0f37fe7c2e82 100644 --- a/src/test/libcephfs/test.cc +++ b/src/test/libcephfs/test.cc @@ -583,7 +583,7 @@ TEST(LibCephFS, Xattrs_ll) { const char *value = "attrvalue"; char value_buf[256] = { 0 }; - res = ceph_ll_setxattr(cmount, existent_file_handle, valid_name, value, strlen(value), 0, 0, 0); + res = ceph_ll_setxattr(cmount, existent_file_handle, valid_name, value, strlen(value), 0, perms); ASSERT_EQ(res, 0); res = ceph_ll_getxattr(cmount, existent_file_handle, valid_name, value_buf, 256, perms);