]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph: fix arguments to ceph_ll_setattr and remove ceph_ll_setattrx
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:05:31 +0000 (13:05 -0400)
Again, for now we leave the underlying method called ll_setattrx, since
FUSE is wired to use struct stat.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
src/include/cephfs/libcephfs.h
src/libcephfs.cc
src/test/libcephfs/test.cc

index e49d8889180749b3c542b4b735df5d4543c67899..18c9a8e16a781fca3a4467d2541595a9dffc5812 100644 (file)
@@ -1438,9 +1438,7 @@ int ceph_ll_getattr(struct ceph_mount_info *cmount, struct Inode *in,
                    struct ceph_statx *stx, unsigned int want, unsigned int flags,
                    const UserPerm *perms);
 int ceph_ll_setattr(struct ceph_mount_info *cmount, struct Inode *in,
-                   struct stat *st, int mask, int uid, int gid);
-int ceph_ll_setattrx(struct ceph_mount_info *cmount, struct Inode *in,
-                   struct ceph_statx *stx, int mask, int uid, int gid);
+                   struct ceph_statx *stx, int mask, const UserPerm *perms);
 int ceph_ll_open(struct ceph_mount_info *cmount, struct Inode *in, int flags,
                 struct Fh **fh, int uid, int gid);
 off_t ceph_ll_lseek(struct ceph_mount_info *cmount, struct Fh* filehandle,
index 92db1c25005d168e624a9dc8fcff03e9a5c9734e..e867bc7c5df5ebfedfec622a3a173bc5fc24c799 100644 (file)
@@ -1438,19 +1438,10 @@ extern "C" int ceph_ll_getattr(class ceph_mount_info *cmount,
 }
 
 extern "C" int ceph_ll_setattr(class ceph_mount_info *cmount,
-                              Inode *in, struct stat *st,
-                              int mask, int uid, int gid)
-{
-  UserPerm perms(uid, gid);
-  return (cmount->get_client()->ll_setattr(in, st, mask, perms));
-}
-
-extern "C" int ceph_ll_setattrx(class ceph_mount_info *cmount,
                               Inode *in, struct ceph_statx *stx,
-                              int mask, int uid, int gid)
+                              int mask, const UserPerm *perms)
 {
-  UserPerm perms(uid, gid);
-  return (cmount->get_client()->ll_setattrx(in, stx, mask, perms));
+  return (cmount->get_client()->ll_setattrx(in, stx, mask, *perms));
 }
 
 extern "C" int ceph_ll_open(class ceph_mount_info *cmount, Inode *in,
@@ -1589,11 +1580,11 @@ extern "C" int ceph_ll_truncate(class ceph_mount_info *cmount,
                                Inode *in, uint64_t length, int uid,
                                int gid)
 {
-  struct stat st;
-  st.st_size=length;
+  struct ceph_statx stx;
+  stx.stx_size = length;
   UserPerm perms(uid, gid);
 
-  return(cmount->get_client()->ll_setattr(in, &st, CEPH_SETATTR_SIZE, perms));
+  return(cmount->get_client()->ll_setattrx(in, &stx, CEPH_SETATTR_SIZE, perms));
 }
 
 extern "C" int ceph_ll_opendir(class ceph_mount_info *cmount,
index c2621f08f4689b9bdcec1f19b5faf333eb1a8555..e3888819c9a3d25cd89b06d4c64a46f717cfcc8d 100644 (file)
@@ -1568,6 +1568,8 @@ TEST(LibCephFS, LazyStatx) {
   struct stat st;
   struct ceph_statx stx;
   Fh *fh;
+  UserPerm *perms1 = ceph_mount_perms(cmount1);
+  UserPerm *perms2 = ceph_mount_perms(cmount2);
 
   ASSERT_EQ(ceph_ll_lookup_root(cmount1, &root1), 0);
   ceph_ll_unlink(cmount1, root1, filename, getuid(), getgid());
@@ -1577,8 +1579,7 @@ TEST(LibCephFS, LazyStatx) {
 
   ASSERT_EQ(ceph_ll_lookup_root(cmount2, &root2), 0);
 
-  UserPerm *perms = ceph_mount_perms(cmount2);
-  ASSERT_EQ(ceph_ll_lookup(cmount2, root2, filename, &file2, &stx, CEPH_STATX_CTIME, 0, perms), 0);
+  ASSERT_EQ(ceph_ll_lookup(cmount2, root2, filename, &file2, &stx, CEPH_STATX_CTIME, 0, perms2), 0);
 
   struct timespec old_ctime = stx.stx_ctime;
 
@@ -1587,10 +1588,10 @@ TEST(LibCephFS, LazyStatx) {
    * different ctime with a statx that uses AT_NO_ATTR_SYNC
    */
   sleep(1);
-  st.st_mode = 0644;
-  ASSERT_EQ(ceph_ll_setattr(cmount1, file1, &st, CEPH_SETATTR_MODE, getuid(), getgid()), 0);
+  stx.stx_mode = 0644;
+  ASSERT_EQ(ceph_ll_setattr(cmount1, file1, &stx, CEPH_SETATTR_MODE, perms1), 0);
 
-  ASSERT_EQ(ceph_ll_getattr(cmount2, file2, &stx, CEPH_STATX_CTIME, AT_NO_ATTR_SYNC, perms), 0);
+  ASSERT_EQ(ceph_ll_getattr(cmount2, file2, &stx, CEPH_STATX_CTIME, AT_NO_ATTR_SYNC, perms2), 0);
   ASSERT_TRUE(stx.stx_mask & CEPH_STATX_CTIME);
   ASSERT_TRUE(stx.stx_ctime.tv_sec == old_ctime.tv_sec &&
              stx.stx_ctime.tv_nsec == old_ctime.tv_nsec);