]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
client: convert ceph_ll_setxattr, listxattr, removexattr to take a UserPerms pointer
authorJeff Layton <jlayton@redhat.com>
Mon, 24 Oct 2016 14:02:59 +0000 (10:02 -0400)
committerJeff Layton <jlayton@redhat.com>
Tue, 25 Oct 2016 17:06:28 +0000 (13:06 -0400)
Signed-off-by: Jeff Layton <jlayton@redhat.com>
src/include/cephfs/libcephfs.h
src/libcephfs.cc
src/test/libcephfs/test.cc

index eb88915dad0e8e9ab4d28a4007617b735009d962..8bb8baf6f3d8b67803d41699b3c81e5def646e85 100644 (file)
@@ -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,
index 5dca674ff291f94001847454652c055203b90b9f..ca5415aae213aecba5fa6c356dce15c23710c04e 100644 (file)
@@ -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,
index 810c03060cdf939d538da9075e8cc8eed04432b6..0f37fe7c2e82bb752671024620b7d5f7340da71e 100644 (file)
@@ -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);