]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librgw: fs->root_fh is a pointer (and assign it)
authorMatt Benjamin <mbenjamin@redhat.com>
Mon, 26 Oct 2015 23:44:58 +0000 (19:44 -0400)
committerMatt Benjamin <mbenjamin@redhat.com>
Fri, 12 Feb 2016 17:05:10 +0000 (12:05 -0500)
Assign and expose the expanded root_fh indirectly from the mounted
root filesystem structure.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
src/include/rados/rgw_file.h
src/rgw/rgw_file.cc
src/rgw/rgw_file.h
src/test/librgw_file.cc
src/test/librgw_file_cd.cc
src/test/librgw_file_gp.cc

index 4b7c01f2fad21bd27b32f26293267ceceb0d6d77..10c25d68a10251b38903c59b3ceb070ebc9ab76d 100644 (file)
@@ -52,7 +52,7 @@ struct rgw_fs
 {
   librgw_t rgw;
   void *fs_private;
-  struct rgw_file_handle root_fh;
+  struct rgw_file_handle* root_fh;
 };
 
 
index a2e5083a9baf88de387d14e6ca8af57cc620d936..c0f0105300e528923cfec7c941bd2d72be08d03f 100644 (file)
@@ -49,7 +49,7 @@ extern "C" {
     return -EINVAL;
   }
 
-  struct rgw_fs *fs = new_fs->get_fs();;
+  struct rgw_fs *fs = new_fs->get_fs();
   fs->rgw = rgw;
 
   /* XXX we no longer assume "/" is unique, but we aren't tracking the
index 3ff503f7626b4bfdc7c5d1944b624199e28fe1e5..345d96ae25aa28ee064f11949a0579afb1781a7f 100644 (file)
@@ -115,6 +115,7 @@ public:
     : root_fh(this, nullptr, RGWFileHandle::root_name.c_str()), uid(_uid),
       key(_user_id, _key) {
     fs.fs_private = this;
+    fs.root_fh = root_fh.get_fh(); /* expose public root fh */
   }
 
   int authorize(RGWRados* store) {
index 36b821005982b697a8a1baddfa018291552843f3..0ef919edf7206b9b9169c8feb40085311eba843f 100644 (file)
@@ -57,13 +57,13 @@ TEST(LibRGW, MOUNT) {
 
 TEST(LibRGW, CREATE_BUCKET) {
   struct stat st;
-  struct rgw_file_handle fh;
-  int ret = rgw_mkdir(fs, &fs->root_fh, "sorry_dave", 755, &st, &fh);
+  struct rgw_file_handle* fh;
+  int ret = rgw_mkdir(fs, fs->root_fh, "sorry_dave", 755, &st, fh);
   ASSERT_EQ(ret, 0);
 }
 
 TEST(LibRGW, DELETE_BUCKET) {
-  int ret = rgw_unlink(fs, &fs->root_fh, "sorry_dave");
+  int ret = rgw_unlink(fs, fs->root_fh, "sorry_dave");
   ASSERT_EQ(ret, 0);
 }
 
@@ -84,7 +84,7 @@ TEST(LibRGW, LIST_BUCKETS) {
 
   bool eof = false;
   uint64_t offset = 0;
-  int ret = rgw_readdir(fs, &fs->root_fh, &offset, r1_cb, &fids1, &eof);
+  int ret = rgw_readdir(fs, fs->root_fh, &offset, r1_cb, &fids1, &eof);
   for (auto& fid : fids1) {
     std::cout << "fname: " << get<0>(fid) << " fid: " << get<1>(fid)
              << std::endl;
@@ -109,7 +109,7 @@ TEST(LibRGW, LOOKUP_BUCKETS) {
   int ret = 0;
   for (auto& fid : fids1) {
     struct rgw_file_handle *rgw_fh;
-    ret = rgw_lookup(fs, &fs->root_fh, get<0>(fid).c_str(), &rgw_fh,
+    ret = rgw_lookup(fs, fs->root_fh, get<0>(fid).c_str(), &rgw_fh,
                    0 /* flags */);
     ASSERT_EQ(ret, 0);
     get<2>(fid) = rgw_fh;
index 614d0839248f71f415089c38aec0301984060336..addf29bf9f5cbf7e864af2dbc80ba2c7fb78abe3 100644 (file)
@@ -63,14 +63,14 @@ TEST(LibRGW, CREATE_BUCKET) {
   if (do_create) {
     struct stat st;
     struct rgw_file_handle fh;
-    int ret = rgw_mkdir(fs, &fs->root_fh, bucket_name.c_str(), 755, &st, &fh);
+    int ret = rgw_mkdir(fs, fs->root_fh, bucket_name.c_str(), 755, &st, &fh);
     ASSERT_EQ(ret, 0);
   }
 }
 
 TEST(LibRGW, DELETE_BUCKET) {
   if (do_delete) {
-    int ret = rgw_unlink(fs, &fs->root_fh, bucket_name.c_str());
+    int ret = rgw_unlink(fs, fs->root_fh, bucket_name.c_str());
     ASSERT_EQ(ret, 0);
   }
 }
@@ -83,7 +83,7 @@ TEST(LibRGW, CREATE_BUCKET_MULTI) {
     for (int ix = 0; ix < multi_cnt; ++ix) {
       string bn = bucket_name;
       bn += to_string(ix);
-      ret = rgw_mkdir(fs, &fs->root_fh, bn.c_str(), 755, &st, &fh);
+      ret = rgw_mkdir(fs, fs->root_fh, bn.c_str(), 755, &st, &fh);
       ASSERT_EQ(ret, 0);
       std::cout << "created: " << bn << std::endl;
     }
@@ -95,7 +95,7 @@ TEST(LibRGW, DELETE_BUCKET_MULTI) {
     for (int ix = 0; ix < multi_cnt; ++ix) {
       string bn = bucket_name;
       bn += to_string(ix);
-      int ret = rgw_unlink(fs, &fs->root_fh, bn.c_str());
+      int ret = rgw_unlink(fs, fs->root_fh, bn.c_str());
       ASSERT_EQ(ret, 0);
     }
   }
index 068c10bbc93dc8611d2b4e13953ffeca5cb1eb12..2b73f4beef5a149027e6ce4adfb5cde1fdb758b5 100644 (file)
@@ -137,7 +137,7 @@ TEST(LibRGW, MOUNT) {
 }
 
 TEST(LibRGW, OBJ_OPEN) {
-  int ret = rgw_lookup(fs, &fs->root_fh, bucket_name.c_str(), &fh,
+  int ret = rgw_lookup(fs, fs->root_fh, bucket_name.c_str(), &fh,
                      0 /* flags */);
   ASSERT_EQ(ret, 0);
   ret = rgw_open(fs, fh, 0 /* flags */);