]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
client: pass UserPerm to describe_layout()
authorGreg Farnum <gfarnum@redhat.com>
Wed, 3 Aug 2016 05:44:17 +0000 (22:44 -0700)
committerGreg Farnum <gfarnum@redhat.com>
Wed, 21 Sep 2016 23:33:53 +0000 (16:33 -0700)
Signed-off-by: Greg Farnum <gfarnum@redhat.com>
src/client/Client.cc
src/client/Client.h
src/libcephfs.cc

index 4dc04b05afb86c5227e3851fb5dd8ef0f9caee9a..0aa73cb2603782e2e8c55cdc8ff02bca3c81d8ac 100644 (file)
@@ -11856,13 +11856,14 @@ void Client::ll_interrupt(void *d)
 
 // expose file layouts
 
-int Client::describe_layout(const char *relpath, file_layout_t *lp)
+int Client::describe_layout(const char *relpath, file_layout_t *lp,
+                           const UserPerm& perms)
 {
   Mutex::Locker lock(client_lock);
 
   filepath path(relpath);
   InodeRef in;
-  int r = path_walk(path, &in);
+  int r = path_walk(path, &in, perms);
   if (r < 0)
     return r;
 
index b02871e6e693e06b8f346864b928619ae1044947..9592436ded7f0aedde4520a40434c828ce551dd0 100644 (file)
@@ -1166,7 +1166,8 @@ public:
   int lazyio_synchronize(int fd, loff_t offset, size_t count);
 
   // expose file layout
-  int describe_layout(const char *path, file_layout_t* layout);
+  int describe_layout(const char *path, file_layout_t* layout,
+                     const UserPerm& perms);
   int fdescribe_layout(int fd, file_layout_t* layout);
   int get_file_stripe_address(int fd, loff_t offset, vector<entity_addr_t>& address);
   int get_file_extent_osds(int fd, loff_t off, loff_t *len, vector<int>& osds);
index ccace2907f0e0ac66efe6b0f70d971a6368a0549..5accbae84303687a446bd9dcc40722620a89f4e6 100644 (file)
@@ -927,7 +927,8 @@ extern "C" int ceph_get_file_stripe_unit(struct ceph_mount_info *cmount, int fh)
 
   if (!cmount->is_mounted())
     return -ENOTCONN;
-  r = cmount->get_client()->fdescribe_layout(fh, &l);
+  UserPerm perms = cmount->get_client()->pick_my_perms();
+  r = cmount->get_client()->fdescribe_layout(fh, &l, perms);
   if (r < 0)
     return r;
   return l.stripe_unit;
@@ -940,7 +941,8 @@ extern "C" int ceph_get_path_stripe_unit(struct ceph_mount_info *cmount, const c
 
   if (!cmount->is_mounted())
     return -ENOTCONN;
-  r = cmount->get_client()->describe_layout(path, &l);
+  UserPerm perms = cmount->get_client()->pick_my_perms();
+  r = cmount->get_client()->describe_layout(path, &l, perms);
   if (r < 0)
     return r;
   return l.stripe_unit;
@@ -953,7 +955,8 @@ extern "C" int ceph_get_file_stripe_count(struct ceph_mount_info *cmount, int fh
 
   if (!cmount->is_mounted())
     return -ENOTCONN;
-  r = cmount->get_client()->fdescribe_layout(fh, &l);
+  UserPerm perms = cmount->get_client()->pick_my_perms();
+  r = cmount->get_client()->fdescribe_layout(fh, &l, perms);
   if (r < 0)
     return r;
   return l.stripe_count;
@@ -966,7 +969,8 @@ extern "C" int ceph_get_path_stripe_count(struct ceph_mount_info *cmount, const
 
   if (!cmount->is_mounted())
     return -ENOTCONN;
-  r = cmount->get_client()->describe_layout(path, &l);
+  UserPerm perms = cmount->get_client()->pick_my_perms();
+  r = cmount->get_client()->describe_layout(path, &l, perms);
   if (r < 0)
     return r;
   return l.stripe_count;
@@ -979,7 +983,8 @@ extern "C" int ceph_get_file_object_size(struct ceph_mount_info *cmount, int fh)
 
   if (!cmount->is_mounted())
     return -ENOTCONN;
-  r = cmount->get_client()->fdescribe_layout(fh, &l);
+  UserPerm perms = cmount->get_client()->pick_my_perms();
+  r = cmount->get_client()->fdescribe_layout(fh, &l, perms);
   if (r < 0)
     return r;
   return l.object_size;
@@ -992,7 +997,8 @@ extern "C" int ceph_get_path_object_size(struct ceph_mount_info *cmount, const c
 
   if (!cmount->is_mounted())
     return -ENOTCONN;
-  r = cmount->get_client()->describe_layout(path, &l);
+  UserPerm perms = cmount->get_client()->pick_my_perms();
+  r = cmount->get_client()->describe_layout(path, &l, perms);
   if (r < 0)
     return r;
   return l.object_size;
@@ -1005,7 +1011,8 @@ extern "C" int ceph_get_file_pool(struct ceph_mount_info *cmount, int fh)
 
   if (!cmount->is_mounted())
     return -ENOTCONN;
-  r = cmount->get_client()->fdescribe_layout(fh, &l);
+  UserPerm perms = cmount->get_client()->pick_my_perms();
+  r = cmount->get_client()->fdescribe_layout(fh, &l, perms);
   if (r < 0)
     return r;
   return l.pool_id;
@@ -1018,7 +1025,8 @@ extern "C" int ceph_get_path_pool(struct ceph_mount_info *cmount, const char *pa
 
   if (!cmount->is_mounted())
     return -ENOTCONN;
-  r = cmount->get_client()->describe_layout(path, &l);
+  UserPerm perms = cmount->get_client()->pick_my_perms();
+  r = cmount->get_client()->describe_layout(path, &l, perms);
   if (r < 0)
     return r;
   return l.pool_id;
@@ -1031,7 +1039,8 @@ extern "C" int ceph_get_file_pool_name(struct ceph_mount_info *cmount, int fh, c
 
   if (!cmount->is_mounted())
     return -ENOTCONN;
-  r = cmount->get_client()->fdescribe_layout(fh, &l);
+  UserPerm perms = cmount->get_client()->pick_my_perms();
+  r = cmount->get_client()->fdescribe_layout(fh, &l, perms);
   if (r < 0)
     return r;
   string name = cmount->get_client()->get_pool_name(l.pool_id);
@@ -1063,7 +1072,8 @@ extern "C" int ceph_get_path_pool_name(struct ceph_mount_info *cmount, const cha
 
   if (!cmount->is_mounted())
     return -ENOTCONN;
-  r = cmount->get_client()->describe_layout(path, &l);
+  UserPerm perms = cmount->get_client()->pick_my_perms();
+  r = cmount->get_client()->describe_layout(path, &l, perms);
   if (r < 0)
     return r;
   string name = cmount->get_client()->get_pool_name(l.pool_id);
@@ -1082,7 +1092,8 @@ extern "C" int ceph_get_file_layout(struct ceph_mount_info *cmount, int fh, int
 
   if (!cmount->is_mounted())
     return -ENOTCONN;
-  r = cmount->get_client()->fdescribe_layout(fh, &l);
+  UserPerm perms = cmount->get_client()->pick_my_perms();
+  r = cmount->get_client()->fdescribe_layout(fh, &l, perms);
   if (r < 0)
     return r;
   if (stripe_unit)
@@ -1103,7 +1114,8 @@ extern "C" int ceph_get_path_layout(struct ceph_mount_info *cmount, const char *
 
   if (!cmount->is_mounted())
     return -ENOTCONN;
-  r = cmount->get_client()->describe_layout(path, &l);
+  UserPerm perms = cmount->get_client()->pick_my_perms();
+  r = cmount->get_client()->describe_layout(path, &l, perms);
   if (r < 0)
     return r;
   if (stripe_unit)
@@ -1124,7 +1136,8 @@ extern "C" int ceph_get_file_replication(struct ceph_mount_info *cmount, int fh)
 
   if (!cmount->is_mounted())
     return -ENOTCONN;
-  r = cmount->get_client()->fdescribe_layout(fh, &l);
+  UserPerm perms = cmount->get_client()->pick_my_perms();
+  r = cmount->get_client()->fdescribe_layout(fh, &l, perms);
   if (r < 0)
     return r;
   int rep = cmount->get_client()->get_pool_replication(l.pool_id);
@@ -1138,7 +1151,8 @@ extern "C" int ceph_get_path_replication(struct ceph_mount_info *cmount, const c
 
   if (!cmount->is_mounted())
     return -ENOTCONN;
-  r = cmount->get_client()->describe_layout(path, &l);
+  UserPerm perms = cmount->get_client()->pick_my_perms();
+  r = cmount->get_client()->describe_layout(path, &l, perms);
   if (r < 0)
     return r;
   int rep = cmount->get_client()->get_pool_replication(l.pool_id);