From: Jeff Layton Date: Mon, 24 Oct 2016 14:02:59 +0000 (-0400) Subject: ceph: fix arguments to ceph_ll_setattr and remove ceph_ll_setattrx X-Git-Tag: v11.1.0~383^2~21 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a302d194133f320fa462e56b614e5fae6598d347;p=ceph.git ceph: fix arguments to ceph_ll_setattr and remove ceph_ll_setattrx Again, for now we leave the underlying method called ll_setattrx, since FUSE is wired to use struct stat. Signed-off-by: Jeff Layton --- diff --git a/src/include/cephfs/libcephfs.h b/src/include/cephfs/libcephfs.h index e49d88891807..18c9a8e16a78 100644 --- a/src/include/cephfs/libcephfs.h +++ b/src/include/cephfs/libcephfs.h @@ -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, diff --git a/src/libcephfs.cc b/src/libcephfs.cc index 92db1c25005d..e867bc7c5df5 100644 --- a/src/libcephfs.cc +++ b/src/libcephfs.cc @@ -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, diff --git a/src/test/libcephfs/test.cc b/src/test/libcephfs/test.cc index c2621f08f468..e3888819c9a3 100644 --- a/src/test/libcephfs/test.cc +++ b/src/test/libcephfs/test.cc @@ -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);