]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
client: change ceph_ll_mkdir to ceph_statx and UserPerm args
authorJeff Layton <jlayton@redhat.com>
Mon, 24 Oct 2016 14:03:00 +0000 (10:03 -0400)
committerJeff Layton <jlayton@redhat.com>
Tue, 25 Oct 2016 17:06:29 +0000 (13:06 -0400)
Signed-off-by: Jeff Layton <jlayton@redhat.com>
src/client/Client.cc
src/client/Client.h
src/include/cephfs/libcephfs.h
src/libcephfs.cc
src/test/libcephfs/test.cc

index 33cf900add9e25617cc7f90628df44fe654466f1..c8db94bef4e7a8129cbb57175fac8483c76c236e 100644 (file)
@@ -11119,6 +11119,42 @@ int Client::ll_mkdir(Inode *parent, const char *name, mode_t mode,
   return r;
 }
 
+int Client::ll_mkdirx(Inode *parent, const char *name, mode_t mode, Inode **out,
+                     struct ceph_statx *stx, unsigned want, unsigned flags,
+                     const UserPerm& perms)
+{
+  Mutex::Locker lock(client_lock);
+
+  vinodeno_t vparent = _get_vino(parent);
+
+  ldout(cct, 3) << "ll_mkdirx " << vparent << " " << name << dendl;
+  tout(cct) << "ll_mkdirx" << std::endl;
+  tout(cct) << vparent.ino.val << std::endl;
+  tout(cct) << name << std::endl;
+  tout(cct) << mode << std::endl;
+
+  if (!cct->_conf->fuse_default_permissions) {
+    int r = may_create(parent, perms);
+    if (r < 0)
+      return r;
+  }
+
+  InodeRef in;
+  int r = _mkdir(parent, name, mode, perms, &in);
+  if (r == 0) {
+    fill_statx(in, statx_to_mask(flags, want), stx);
+    _ll_get(in.get());
+  } else {
+    stx->stx_ino = 0;
+    stx->stx_mask = 0;
+  }
+  tout(cct) << stx->stx_ino << std::endl;
+  ldout(cct, 3) << "ll_mkdirx " << vparent << " " << name
+         << " = " << r << " (" << hex << stx->stx_ino << dec << ")" << dendl;
+  *out = in.get();
+  return r;
+}
+
 int Client::_symlink(Inode *dir, const char *name, const char *target,
                     const UserPerm& perms, InodeRef *inp)
 {
index 9cc0679f7909c355a2d4e6275c43fb345b09c4b5..91badbfc45debd16b6bf43cf93798f10c68b0e5b 100644 (file)
@@ -1144,6 +1144,9 @@ public:
                unsigned flags, const UserPerm& perms);
   int ll_mkdir(Inode *in, const char *name, mode_t mode, struct stat *attr,
               Inode **out, const UserPerm& perm);
+  int ll_mkdirx(Inode *parent, const char *name, mode_t mode, Inode **out,
+               struct ceph_statx *stx, unsigned want, unsigned flags,
+               const UserPerm& perms);
   int ll_symlink(Inode *in, const char *name, const char *value,
                 struct stat *attr, Inode **out, const UserPerm& perms);
   int ll_unlink(Inode *in, const char *name, const UserPerm& perm);
index 191d83e9acba89ddca7377b0aadf020ec4c41cbc..286973ff661f236107d1324bbb03d3bb413fe4e3 100644 (file)
@@ -1485,9 +1485,10 @@ int ceph_ll_mknod(struct ceph_mount_info *cmount, Inode *parent,
                  const char *name, mode_t mode, dev_t rdev, Inode **out,
                  struct ceph_statx *stx, unsigned want, unsigned flags,
                  const UserPerm *perms);
-int ceph_ll_mkdir(struct ceph_mount_info *cmount, struct Inode *parent,
-                 const char *name, mode_t mode, struct stat *attr,
-                 Inode **out, int uid, int gid);
+int ceph_ll_mkdir(struct ceph_mount_info *cmount, Inode *parent,
+                 const char *name, mode_t mode, Inode **out,
+                 struct ceph_statx *stx, unsigned want,
+                 unsigned flags, const UserPerm *perms);
 int ceph_ll_link(struct ceph_mount_info *cmount, struct Inode *in,
                 struct Inode *newparrent, const char *name,
                 struct stat *attr, int uid, int gid);
index 79ced12d36879e88492537265d03ad088b5c5e2d..b565065756be6f0d48ad1cfd67c1367b3d175de6 100644 (file)
@@ -1557,13 +1557,13 @@ extern "C" int ceph_ll_mknod(class ceph_mount_info *cmount, Inode *parent,
                                           out, stx, want, flags, *perms);
 }
 
-extern "C" int ceph_ll_mkdir(class ceph_mount_info *cmount,
-                            Inode *parent, const char *name,
-                            mode_t mode, struct stat *attr, Inode **out,
-                            int uid, int gid)
+extern "C" int ceph_ll_mkdir(class ceph_mount_info *cmount, Inode *parent,
+                            const char *name, mode_t mode, Inode **out,
+                            struct ceph_statx *stx, unsigned want,
+                            unsigned flags, const UserPerm *perms)
 {
-  UserPerm perms(uid, gid);
-  return (cmount->get_client()->ll_mkdir(parent, name, mode, attr, out, perms));
+  return cmount->get_client()->ll_mkdirx(parent, name, mode, out, stx, want,
+                                        flags, *perms);
 }
 
 extern "C" int ceph_ll_link(class ceph_mount_info *cmount,
index edbccf2073419362bbb958a38478ab4ed4071d0f..54164e31a634f352123f85575203796a2a4b353d 100644 (file)
@@ -1401,7 +1401,7 @@ TEST(LibCephFS, Nlink) {
   Fh *fh;
   UserPerm *perms = ceph_mount_perms(cmount);
 
-  ASSERT_EQ(ceph_ll_mkdir(cmount, root, dirname, 0755, &st, &dir, getuid(), getgid()), 0);
+  ASSERT_EQ(ceph_ll_mkdir(cmount, root, dirname, 0755, &dir, &stx, 0, 0, perms), 0);
   ASSERT_EQ(ceph_ll_create(cmount, dir, filename, 0666, O_RDWR|O_CREAT|O_EXCL,
                           &file, &fh, &stx, CEPH_STATX_NLINK, 0, perms), 0);
   ASSERT_EQ(stx.stx_nlink, (nlink_t)1);