]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
client: convert ceph_ll_walk to use ceph_statx
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:28 +0000 (13:05 -0400)
In addition to acquiring the right caps for the requested attributes, we
can also do a path walk that terminates on an existing symlink without
following the link now.

Is that useful? No idea...

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 45262c89a9df128eec81eab12e0508c08f0f5202..969113a9aa192d133ba43682eceef811c078d931 100644 (file)
@@ -9823,32 +9823,34 @@ int Client::ll_lookupx(Inode *parent, const char *name, Inode **out,
   return r;
 }
 
-int Client::ll_walk(const char* name, Inode **out, struct stat *attr,
-                   const UserPerm& perms)
+int Client::ll_walk(const char* name, Inode **out, struct ceph_statx *stx,
+                   unsigned int want, unsigned int flags, const UserPerm& perms)
 {
   Mutex::Locker lock(client_lock);
   filepath fp(name, 0);
   InodeRef in;
   int rc;
+  unsigned mask = statx_to_mask(flags, want);
 
   ldout(cct, 3) << "ll_walk" << name << dendl;
   tout(cct) << "ll_walk" << std::endl;
   tout(cct) << name << std::endl;
 
-  rc = path_walk(fp, &in, perms, false, CEPH_STAT_CAP_INODE_ALL);
+  rc = path_walk(fp, &in, perms, !(flags & AT_SYMLINK_NOFOLLOW), mask);
   if (rc < 0) {
-    attr->st_ino = 0;
+    /* zero out mask, just in case... */
+    stx->stx_mask = 0;
+    stx->stx_ino = 0;
     *out = NULL;
     return rc;
   } else {
     assert(in);
-    fill_stat(in, attr);
+    fill_statx(in, mask, stx);
     *out = in.get();
     return 0;
   }
 }
 
-
 void Client::_ll_get(Inode *in)
 {
   if (in->ll_ref == 0) {
index d4769cc764410cbe7ebafb78ba76bb31ef146694..d2b4755baba1c833e7837079498849c475a4007a 100644 (file)
@@ -1163,8 +1163,8 @@ public:
   int ll_commit_blocks(Inode *in, uint64_t offset, uint64_t length);
 
   int ll_statfs(Inode *in, struct statvfs *stbuf, const UserPerm& perms);
-  int ll_walk(const char* name, Inode **i, struct stat *attr,
-             const UserPerm& perms); // XXX in?
+  int ll_walk(const char* name, Inode **i, struct ceph_statx *stx,
+              unsigned int want, unsigned int flags, const UserPerm& perms);
   uint32_t ll_stripe_unit(Inode *in);
   int ll_file_layout(Inode *in, file_layout_t *layout);
   uint64_t ll_snap_seq(Inode *in);
index c1b24c8a98d2caf3e6c6a92848c5c630351fdbb7..e49d8889180749b3c542b4b735df5d4543c67899 100644 (file)
@@ -1431,9 +1431,9 @@ int ceph_ll_lookup(struct ceph_mount_info *cmount, Inode *parent,
 int ceph_ll_put(struct ceph_mount_info *cmount, struct Inode *in);
 int ceph_ll_forget(struct ceph_mount_info *cmount, struct Inode *in,
                   int count);
-int ceph_ll_walk(struct ceph_mount_info *cmount, const char *name,
-                struct Inode **i,
-                struct stat *attr);
+int ceph_ll_walk(struct ceph_mount_info *cmount, const char* name, Inode **i,
+                struct ceph_statx *stx, unsigned int want, unsigned int flags,
+                const UserPerm *perms);
 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);
index ffcdb7ba856bdba26eb9720b7e0dacf19fedb890..92db1c25005d168e624a9dc8fcff03e9a5c9734e 100644 (file)
@@ -1422,11 +1422,11 @@ extern "C" int ceph_ll_forget(class ceph_mount_info *cmount, Inode *in,
   return (cmount->get_client()->ll_forget(in, count));
 }
 
-extern "C" int ceph_ll_walk(class ceph_mount_info *cmount, const char *name,
-                           struct Inode **i,
-                           struct stat *attr)
+int ceph_ll_walk(struct ceph_mount_info *cmount, const char* name, Inode **i,
+                struct ceph_statx *stx, unsigned int want, unsigned int flags,
+                const UserPerm *perms)
 {
-  return (cmount->get_client()->ll_walk(name, i, attr, cmount->default_perms));
+  return(cmount->get_client()->ll_walk(name, i, stx, want, flags, *perms));
 }
 
 extern "C" int ceph_ll_getattr(class ceph_mount_info *cmount,