]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
client: change ceph_ll_symlinkx to take a UserPerm and ceph_statx
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

index 12cd4647172884f78537fef5f83edae640b28379..340f88696e8c54bf2b07dd2ee1084d6b671dc4b0 100644 (file)
@@ -11234,6 +11234,40 @@ int Client::ll_symlink(Inode *parent, const char *name, const char *value,
   return r;
 }
 
+int Client::ll_symlinkx(Inode *parent, const char *name, const char *value,
+                       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_symlinkx " << vparent << " " << name << " -> " << value
+               << dendl;
+  tout(cct) << "ll_symlinkx" << std::endl;
+  tout(cct) << vparent.ino.val << std::endl;
+  tout(cct) << name << std::endl;
+  tout(cct) << value << std::endl;
+
+  if (!cct->_conf->fuse_default_permissions) {
+    int r = may_create(parent, perms);
+    if (r < 0)
+      return r;
+  }
+
+  InodeRef in;
+  int r = _symlink(parent, name, value, perms, &in);
+  if (r == 0) {
+    fill_statx(in, statx_to_mask(flags, want), stx);
+    _ll_get(in.get());
+  }
+  tout(cct) << stx->stx_ino << std::endl;
+  ldout(cct, 3) << "ll_symlinkx " << vparent << " " << name
+         << " = " << r << " (" << hex << stx->stx_ino << dec << ")" << dendl;
+  *out = in.get();
+  return r;
+}
+
 int Client::_unlink(Inode *dir, const char *name, const UserPerm& perm)
 {
   ldout(cct, 3) << "_unlink(" << dir->ino << " " << name
index cbe7b1fb32f80a5bcaf3ca974a7935e903db9068..c3e6ffdfc077e46a1a96416e65740d5ae59e29b5 100644 (file)
@@ -1149,6 +1149,9 @@ public:
                const UserPerm& perms);
   int ll_symlink(Inode *in, const char *name, const char *value,
                 struct stat *attr, Inode **out, const UserPerm& perms);
+  int ll_symlinkx(Inode *parent, const char *name, const char *value,
+                 Inode **out, struct ceph_statx *stx, unsigned want,
+                 unsigned flags, const UserPerm& perms);
   int ll_unlink(Inode *in, const char *name, const UserPerm& perm);
   int ll_rmdir(Inode *in, const char *name, const UserPerm& perms);
   int ll_rename(Inode *parent, const char *name, Inode *newparent,
index 5d5f8a06861840f62fd64f8013d24672ffe4f479..a5802eebeedb6230f50e4a9464d60cc01c0c5f07 100644 (file)
@@ -1505,9 +1505,11 @@ int ceph_ll_statfs(struct ceph_mount_info *cmount, struct Inode *in,
                   struct statvfs *stbuf);
 int ceph_ll_readlink(struct ceph_mount_info *cmount, struct Inode *in,
                     char *buf, size_t bufsize, int uid, int gid);
-int ceph_ll_symlink(struct ceph_mount_info *cmount, struct Inode *parent,
-                   const char *name, const char *value, struct stat *attr,
-                   struct Inode **in, int uid, int gid);
+int ceph_ll_symlink(struct ceph_mount_info *cmount,
+                   Inode *in, const char *name, const char *value,
+                   Inode **out, struct ceph_statx *stx,
+                   unsigned want, unsigned flags,
+                   const UserPerm *perms);
 int ceph_ll_rmdir(struct ceph_mount_info *cmount, struct Inode *in,
                  const char *name, int uid, int gid);
 uint32_t ceph_ll_stripe_unit(struct ceph_mount_info *cmount,
index 97cfc6b551d2e7b7f9fefabf2ef29ae21b5b40fe..ea6802973387ffc2b7dcb086e62a575feef0e3d2 100644 (file)
@@ -1620,11 +1620,12 @@ extern "C" int ceph_ll_readlink(class ceph_mount_info *cmount,
 
 extern "C" int ceph_ll_symlink(class ceph_mount_info *cmount,
                               Inode *in, const char *name,
-                              const char *value, struct stat *attr,
-                              Inode **out, int uid, int gid)
+                              const char *value, Inode **out,
+                              struct ceph_statx *stx, unsigned want,
+                              unsigned flags, const UserPerm *perms)
 {
-  UserPerm perms(uid, gid);
-  return (cmount->get_client()->ll_symlink(in, name, value, attr, out, perms));
+  return (cmount->get_client()->ll_symlinkx(in, name, value, out, stx, want,
+                                           flags, *perms));
 }
 
 extern "C" int ceph_ll_rmdir(class ceph_mount_info *cmount,