]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
client: convert args to ceph_ll_mknod to use ceph_statx and UserPerm
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)
The underlying plumbing needs to remain the same for FUSE though.

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

index fe73d033f9f40181fca30405676c7522f177f35c..33cf900add9e25617cc7f90628df44fe654466f1 100644 (file)
@@ -10902,6 +10902,42 @@ int Client::ll_mknod(Inode *parent, const char *name, mode_t mode,
   return r;
 }
 
+int Client::ll_mknodx(Inode *parent, const char *name, mode_t mode,
+                     dev_t rdev, Inode **out,
+                     struct ceph_statx *stx, unsigned want, unsigned flags,
+                     const UserPerm& perms)
+{
+  unsigned caps = statx_to_mask(flags, want);
+  Mutex::Locker lock(client_lock);
+
+  vinodeno_t vparent = _get_vino(parent);
+
+  ldout(cct, 3) << "ll_mknodx " << vparent << " " << name << dendl;
+  tout(cct) << "ll_mknodx" << std::endl;
+  tout(cct) << vparent.ino.val << std::endl;
+  tout(cct) << name << std::endl;
+  tout(cct) << mode << std::endl;
+  tout(cct) << rdev << std::endl;
+
+  if (!cct->_conf->fuse_default_permissions) {
+    int r = may_create(parent, perms);
+    if (r < 0)
+      return r;
+  }
+
+  InodeRef in;
+  int r = _mknod(parent, name, mode, rdev, perms, &in);
+  if (r == 0) {
+    fill_statx(in, caps, stx);
+    _ll_get(in.get());
+  }
+  tout(cct) << stx->stx_ino << std::endl;
+  ldout(cct, 3) << "ll_mknodx " << vparent << " " << name
+         << " = " << r << " (" << hex << stx->stx_ino << dec << ")" << dendl;
+  *out = in.get();
+  return r;
+}
+
 int Client::_create(Inode *dir, const char *name, int flags, mode_t mode,
                    InodeRef *inp, Fh **fhp, int stripe_unit, int stripe_count,
                    int object_size, const char *data_pool, bool *created,
index c2f4e8cbf863dc80ca2ff851834a1c239dc8db43..9cc0679f7909c355a2d4e6275c43fb345b09c4b5 100644 (file)
@@ -1139,6 +1139,9 @@ public:
   int ll_readlink(Inode *in, char *buf, size_t bufsize, const UserPerm& perms);
   int ll_mknod(Inode *in, const char *name, mode_t mode, dev_t rdev,
               struct stat *attr, Inode **out, const UserPerm& perms);
+  int ll_mknodx(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 ll_mkdir(Inode *in, const char *name, mode_t mode, struct stat *attr,
               Inode **out, const UserPerm& perm);
   int ll_symlink(Inode *in, const char *name, const char *value,
index f1b01812b9009812eaafed576b41234b3963ef3d..191d83e9acba89ddca7377b0aadf020ec4c41cbc 100644 (file)
@@ -1481,10 +1481,10 @@ int ceph_ll_create(struct ceph_mount_info *cmount, Inode *parent,
                   const char *name, mode_t mode, int oflags, Inode **outp,
                   Fh **fhp, struct ceph_statx *stx, unsigned want,
                   unsigned lflags, const UserPerm *perms);
-int ceph_ll_mknod(struct ceph_mount_info *cmount, struct Inode *parent,
-                 const char *name, mode_t mode, dev_t rdev,
-                 struct stat *attr, struct Inode **out,
-                 int uid, int gid);
+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);
index 4f4e99e7fd9e73a0adbeed972c472e7a68f806d4..79ced12d36879e88492537265d03ad088b5c5e2d 100644 (file)
@@ -1547,14 +1547,14 @@ extern "C" int ceph_ll_create(class ceph_mount_info *cmount,
                                            fhp, stx, want, lflags, *perms);
 }
 
-extern "C" int ceph_ll_mknod(class ceph_mount_info *cmount,
-                            struct Inode *parent, const char *name,
-                            mode_t mode, dev_t rdev, struct stat *attr,
-                            struct Inode **out, int uid, int gid)
-{
-  UserPerm perms(uid, gid);
-  return (cmount->get_client())->ll_mknod(parent, name, mode, rdev,
-                                         attr, out, perms);
+extern "C" int ceph_ll_mknod(class 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)
+{
+  return (cmount->get_client())->ll_mknodx(parent, name, mode, rdev,
+                                          out, stx, want, flags, *perms);
 }
 
 extern "C" int ceph_ll_mkdir(class ceph_mount_info *cmount,