]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librgw: update rgw_* api calls so that all take a flags arg
authorMatt Benjamin <mbenjamin@redhat.com>
Mon, 11 Jan 2016 18:20:38 +0000 (13:20 -0500)
committerMatt Benjamin <mbenjamin@redhat.com>
Fri, 12 Feb 2016 17:07:51 +0000 (12:07 -0500)
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
src/include/rados/rgw_file.h
src/rgw/rgw_file.cc
src/test/librgw_file.cc
src/test/librgw_file_aw.cc
src/test/librgw_file_cd.cc
src/test/librgw_file_gp.cc
src/test/librgw_file_nfsns.cc

index 98e005825a08f746e10dbf866b015ca3c75005f2..fa01cb1114bd4e2e5c1b29d0d7a3fe2a63641f0c 100644 (file)
@@ -95,57 +95,77 @@ int rgw_lookup_handle(struct rgw_fs *rgw_fs, struct rgw_fh_hk *fh_hk,
 /*
  * release file handle
  */
+#define RGW_FH_RELE_FLAG_NONE   0x0000
+
 int rgw_fh_rele(struct rgw_fs *rgw_fs, struct rgw_file_handle *fh,
                uint32_t flags);
 
 /*
  attach rgw namespace
 */
+#define RGW_MOUNT_FLAG_NONE     0x0000
+
 int rgw_mount(librgw_t rgw, const char *uid, const char *key,
-             const char *secret, struct rgw_fs **rgw_fs);
+             const char *secret, struct rgw_fs **rgw_fs,
+             uint32_t flags);
 
 /*
  detach rgw namespace
 */
-int rgw_umount(struct rgw_fs *rgw_fs);
+#define RGW_UMOUNT_FLAG_NONE    0x0000
+
+int rgw_umount(struct rgw_fs *rgw_fs, uint32_t flags);
 
 
 /*
   get filesystem attributes
 */
+#define RGW_STATFS_FLAG_NONE     0x0000
+
 int rgw_statfs(struct rgw_fs *rgw_fs,
               struct rgw_file_handle *parent_fh,
-              struct rgw_statvfs *vfs_st);
+              struct rgw_statvfs *vfs_st,
+              uint32_t flags);
 
 
 /*
   create file
 */
+#define RGW_CREATE_FLAG_NONE     0x0000
+
 int rgw_create(struct rgw_fs *rgw_fs,
               struct rgw_file_handle *parent_fh,
               const char *name, mode_t mode, struct stat *st,
-              struct rgw_file_handle **fh);
+              struct rgw_file_handle **fh, uint32_t flags);
 
 /*
   create a new directory
 */
+#define RGW_MKDIR_FLAG_NONE      0x0000
+
 int rgw_mkdir(struct rgw_fs *rgw_fs,
              struct rgw_file_handle *parent_fh,
              const char *name, mode_t mode, struct stat *st,
-             struct rgw_file_handle **fh);
+             struct rgw_file_handle **fh, uint32_t flags);
 
 /*
   rename object
 */
+#define RGW_RENAME_FLAG_NONE      0x0000
+
 int rgw_rename(struct rgw_fs *rgw_fs,
               struct rgw_file_handle *olddir, const char* old_name,
-              struct rgw_file_handle *newdir, const char* new_name);
+              struct rgw_file_handle *newdir, const char* new_name,
+              uint32_t flags);
 
 /*
   remove file or directory
 */
+#define RGW_UNLINK_FLAG_NONE      0x0000
+
 int rgw_unlink(struct rgw_fs *rgw_fs,
-              struct rgw_file_handle *parent_fh, const char* path);
+              struct rgw_file_handle *parent_fh, const char* path,
+              uint32_t flags);
 
 /*
     read  directory content
@@ -172,27 +192,35 @@ int rgw_readdir(struct rgw_fs *rgw_fs,
 /*
    get unix attributes for object
 */
+#define RGW_GETATTR_FLAG_NONE      0x0000
+
 int rgw_getattr(struct rgw_fs *rgw_fs,
-               struct rgw_file_handle *fh, struct stat *st);
+               struct rgw_file_handle *fh, struct stat *st,
+               uint32_t flags);
 
 /*
    set unix attributes for object
 */
+#define RGW_SETATTR_FLAG_NONE      0x0000
+
 int rgw_setattr(struct rgw_fs *rgw_fs,
                struct rgw_file_handle *fh, struct stat *st,
-               uint32_t mask);
+               uint32_t mask, uint32_t flags);
 
 /*
    truncate file
 */
+#define RGW_TRUNCATE_FLAG_NONE     0x0000
+
 int rgw_truncate(struct rgw_fs *rgw_fs,
-                struct rgw_file_handle *fh, uint64_t size);
+                struct rgw_file_handle *fh, uint64_t size,
+                uint32_t flags);
 
 /*
    open file
 */
-#define RGW_OPEN_FLAG_NONE    0x0000
-#define RGW_OPEN_FLAG_CREATE  0x0001
+#define RGW_OPEN_FLAG_NONE         0x0000
+#define RGW_OPEN_FLAG_CREATE       0x0001
 
 int rgw_open(struct rgw_fs *rgw_fs, struct rgw_file_handle *parent_fh,
            uint32_t flags);
@@ -201,8 +229,8 @@ int rgw_open(struct rgw_fs *rgw_fs, struct rgw_file_handle *parent_fh,
    close file
 */
 
-#define RGW_CLOSE_FLAG_NONE 0x0000
-#define RGW_CLOSE_FLAG_RELE 0x0001
+#define RGW_CLOSE_FLAG_NONE        0x0000
+#define RGW_CLOSE_FLAG_RELE        0x0001
   
 int rgw_close(struct rgw_fs *rgw_fs, struct rgw_file_handle *fh,
              uint32_t flags);
@@ -210,16 +238,22 @@ int rgw_close(struct rgw_fs *rgw_fs, struct rgw_file_handle *fh,
 /*
    read data from file
 */
+#define RGW_READ_FLAG_NONE 0x0000
+
 int rgw_read(struct rgw_fs *rgw_fs,
-           struct rgw_file_handle *fh, uint64_t offset,
-           size_t length, size_t *bytes_read, void *buffer);
-  
+            struct rgw_file_handle *fh, uint64_t offset,
+            size_t length, size_t *bytes_read, void *buffer,
+            uint32_t flags);
+
 /*
    write data to file
 */
+#define RGW_WRITE_FLAG_NONE      0x0000
+
 int rgw_write(struct rgw_fs *rgw_fs,
              struct rgw_file_handle *fh, uint64_t offset,
-             size_t length, size_t *bytes_written, void *buffer);
+             size_t length, size_t *bytes_written, void *buffer,
+             uint32_t flags);
 
 #define RGW_UIO_NONE    0x0000
 #define RGW_UIO_GIFT    0x0001
@@ -251,33 +285,18 @@ struct rgw_uio {
 typedef struct rgw_uio rgw_uio;
 
 int rgw_readv(struct rgw_fs *rgw_fs,
-             struct rgw_file_handle *fh, rgw_uio *uio);
-  
+             struct rgw_file_handle *fh, rgw_uio *uio, uint32_t flags);
+
 int rgw_writev(struct rgw_fs *rgw_fs,
-             struct rgw_file_handle *fh, rgw_uio *uio);
+              struct rgw_file_handle *fh, rgw_uio *uio, uint32_t flags);
 
 /*
    sync written data
 */
-int rgw_fsync(struct rgw_fs *rgw_fs, struct rgw_file_handle *fh);
-
-/* XXXX not implemented (needed?) */
-
-int set_user_permissions(const char *uid);
+#define RGW_FSYNC_FLAG_NONE        0x0000
 
-int get_user_permissions(const char *uid);
-
-int set_dir_permissions(const struct rgw_file_handle *fh);
-
-int get_dir_permissions(const struct rgw_file_handle *fh);
-
-int set_file_permissions(const struct rgw_file_handle *fh);
-
-int get_file_permissions(const struct rgw_file_handle *fh);
-
-int rgw_acl2perm();
-
-int rgw_perm2acl();
+int rgw_fsync(struct rgw_fs *rgw_fs, struct rgw_file_handle *fh,
+             uint32_t flags);
 
 #ifdef __cplusplus
 }
index 1a0462bba42fb5fde739a9a7188af417e500dafb..756506b0ccb304080c3722c961fbd8d6734287a0 100644 (file)
@@ -536,7 +536,8 @@ extern "C" {
  attach rgw namespace
 */
   int rgw_mount(librgw_t rgw, const char *uid, const char *acc_key,
-               const char *sec_key, struct rgw_fs **rgw_fs)
+               const char *sec_key, struct rgw_fs **rgw_fs,
+               uint32_t flags)
 {
   int rc = 0;
 
@@ -568,7 +569,7 @@ extern "C" {
 /*
  detach rgw namespace
 */
-int rgw_umount(struct rgw_fs *rgw_fs)
+int rgw_umount(struct rgw_fs *rgw_fs, uint32_t flags)
 {
   RGWLibFS *fs = static_cast<RGWLibFS*>(rgw_fs->fs_private);
   fs->close();
@@ -581,7 +582,7 @@ int rgw_umount(struct rgw_fs *rgw_fs)
 */
 int rgw_statfs(struct rgw_fs *rgw_fs,
               struct rgw_file_handle *parent_fh,
-              struct rgw_statvfs *vfs_st)
+              struct rgw_statvfs *vfs_st, uint32_t flags)
 {
   RGWLibFS *fs = static_cast<RGWLibFS*>(rgw_fs->fs_private);
 
@@ -647,7 +648,7 @@ static int valid_s3_bucket_name(const string& name, bool relaxed=false)
 int rgw_create(struct rgw_fs *rgw_fs,
               struct rgw_file_handle *parent_fh,
               const char *name, mode_t mode, struct stat *st,
-              struct rgw_file_handle **fh)
+              struct rgw_file_handle **fh, uint32_t flags)
 {
   /* XXX a CREATE operation can be a precursor to the canonical
    * OPEN, WRITE*, CLOSE transaction which writes or overwrites
@@ -693,7 +694,7 @@ int rgw_create(struct rgw_fs *rgw_fs,
 int rgw_mkdir(struct rgw_fs *rgw_fs,
              struct rgw_file_handle *parent_fh,
              const char *name, mode_t mode, struct stat *st,
-             struct rgw_file_handle **fh)
+             struct rgw_file_handle **fh, uint32_t flags)
 {
   int rc, rc2;
 
@@ -761,7 +762,8 @@ int rgw_mkdir(struct rgw_fs *rgw_fs,
 */
 int rgw_rename(struct rgw_fs *rgw_fs,
               struct rgw_file_handle *olddir, const char* old_name,
-              struct rgw_file_handle *newdir, const char* new_name)
+              struct rgw_file_handle *newdir, const char* new_name,
+              uint32_t flags)
 {
   /* -ENOTSUP */
   return -EINVAL;
@@ -771,7 +773,7 @@ int rgw_rename(struct rgw_fs *rgw_fs,
   remove file or directory
 */
 int rgw_unlink(struct rgw_fs *rgw_fs, struct rgw_file_handle *parent_fh,
-             const char *name)
+              const char *name, uint32_t flags)
 {
   int rc = 0;
 
@@ -931,7 +933,7 @@ int rgw_fh_rele(struct rgw_fs *rgw_fs, struct rgw_file_handle *fh,
    get unix attributes for object
 */
 int rgw_getattr(struct rgw_fs *rgw_fs,
-               struct rgw_file_handle *fh, struct stat *st)
+               struct rgw_file_handle *fh, struct stat *st, uint32_t flags)
 {
   CephContext* cct = static_cast<CephContext*>(rgw_fs->rgw);
   RGWLibFS *fs = static_cast<RGWLibFS*>(rgw_fs->fs_private);
@@ -980,7 +982,7 @@ done:
 */
 int rgw_setattr(struct rgw_fs *rgw_fs,
                struct rgw_file_handle *fh, struct stat *st,
-               uint32_t mask)
+               uint32_t mask, uint32_t flags)
 {
   /* XXX no-op */
   return 0;
@@ -990,7 +992,7 @@ int rgw_setattr(struct rgw_fs *rgw_fs,
    truncate file
 */
 int rgw_truncate(struct rgw_fs *rgw_fs,
-                struct rgw_file_handle *fh, uint64_t size)
+                struct rgw_file_handle *fh, uint64_t size, uint32_t flags)
 {
   return 0;
 }
@@ -1053,8 +1055,9 @@ int rgw_readdir(struct rgw_fs *rgw_fs,
    read data from file
 */
 int rgw_read(struct rgw_fs *rgw_fs,
-           struct rgw_file_handle *fh, uint64_t offset,
-           size_t length, size_t *bytes_read, void *buffer)
+            struct rgw_file_handle *fh, uint64_t offset,
+            size_t length, size_t *bytes_read, void *buffer,
+            uint32_t flags)
 {
   CephContext* cct = static_cast<CephContext*>(rgw_fs->rgw);
   RGWLibFS *fs = static_cast<RGWLibFS*>(rgw_fs->fs_private);
@@ -1081,7 +1084,8 @@ int rgw_read(struct rgw_fs *rgw_fs,
 */
 int rgw_write(struct rgw_fs *rgw_fs,
              struct rgw_file_handle *fh, uint64_t offset,
-             size_t length, size_t *bytes_written, void *buffer)
+             size_t length, size_t *bytes_written, void *buffer,
+             uint32_t flags)
 {
   RGWFileHandle* rgw_fh = get_rgwfh(fh);
 
@@ -1123,7 +1127,7 @@ void rgw_readv_rele(struct rgw_uio *uio, uint32_t flags)
 }
 
 int rgw_readv(struct rgw_fs *rgw_fs,
-             struct rgw_file_handle *fh, rgw_uio *uio)
+             struct rgw_file_handle *fh, rgw_uio *uio, uint32_t flags)
 {
 #if 0 /* XXX */
   CephContext* cct = static_cast<CephContext*>(rgw_fs->rgw);
@@ -1179,7 +1183,7 @@ int rgw_readv(struct rgw_fs *rgw_fs,
    write data to file (vector)
 */
   int rgw_writev(struct rgw_fs *rgw_fs, struct rgw_file_handle *fh,
-               rgw_uio *uio)
+                rgw_uio *uio, uint32_t flags)
 {
   CephContext* cct = static_cast<CephContext*>(rgw_fs->rgw);
   RGWLibFS *fs = static_cast<RGWLibFS*>(rgw_fs->fs_private);
@@ -1210,7 +1214,8 @@ int rgw_readv(struct rgw_fs *rgw_fs,
 /*
    sync written data
 */
-int rgw_fsync(struct rgw_fs *rgw_fs, struct rgw_file_handle *handle)
+int rgw_fsync(struct rgw_fs *rgw_fs, struct rgw_file_handle *handle,
+             uint32_t flags)
 {
   return 0;
 }
index 949e2eaa9236ce66d5274545a64bfb30c5506413..ed1360940725959694ce97cae4da9323a5e11d54 100644 (file)
@@ -54,7 +54,7 @@ TEST(LibRGW, INIT) {
 
 TEST(LibRGW, MOUNT) {
   int ret = rgw_mount(rgw, uid.c_str(), access_key.c_str(), secret_key.c_str(),
-                     &fs);
+                     &fs, RGW_MOUNT_FLAG_NONE);
   ASSERT_EQ(ret, 0);
   ASSERT_NE(fs, nullptr);
 }
@@ -67,7 +67,7 @@ TEST(LibRGW, GETATTR_ROOT) {
       return;
 
     struct stat st;
-    int ret = rgw_getattr(fs, fs->root_fh, &st);
+    int ret = rgw_getattr(fs, fs->root_fh, &st, RGW_GETATTR_FLAG_NONE);
     ASSERT_EQ(ret, 0);
   }
 }
@@ -140,7 +140,7 @@ TEST(LibRGW, GETATTR_BUCKETS) {
     for (auto& fid_row : bucket_matrix) {
       auto& fid = get<0>(fid_row);
       struct rgw_file_handle *rgw_fh = get<2>(fid);
-      ret = rgw_getattr(fs, rgw_fh, &st);
+      ret = rgw_getattr(fs, rgw_fh, &st, RGW_GETATTR_FLAG_NONE);
       ASSERT_EQ(ret, 0);
     }
   }
@@ -204,7 +204,8 @@ TEST(LibRGW, GETATTR_OBJECTS) {
        ASSERT_EQ(ret, 0);
        get<2>(obj) = obj_fh; // stash obj_fh for cleanup
        ASSERT_NE(get<2>(obj), nullptr);
-       ret = rgw_getattr(fs, obj_fh, &st); // now, getattr
+       ret = rgw_getattr(fs, obj_fh, &st,
+                         RGW_GETATTR_FLAG_NONE); // now, getattr
        ASSERT_EQ(ret, 0);
       }
     }
@@ -239,7 +240,7 @@ TEST(LibRGW, UMOUNT) {
   if (! fs)
     return;
 
-  int ret = rgw_umount(fs);
+  int ret = rgw_umount(fs, RGW_UMOUNT_FLAG_NONE);
   ASSERT_EQ(ret, 0);
 }
 
index ec3c82ff2255a47ce09138eb3b0bff2e03c759ce..5284cc77b9a5ae62f2161f13a0f803b3c5d9fc5a 100644 (file)
@@ -170,7 +170,7 @@ TEST(LibRGW, INIT) {
 
 TEST(LibRGW, MOUNT) {
   int ret = rgw_mount(rgw, uid.c_str(), access_key.c_str(), secret_key.c_str(),
-                     &fs);
+                     &fs, RGW_MOUNT_FLAG_NONE);
   ASSERT_EQ(ret, 0);
   ASSERT_NE(fs, nullptr);
 }
@@ -179,14 +179,15 @@ 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,
+                       RGW_MKDIR_FLAG_NONE);
     ASSERT_EQ(ret, 0);
   }
 }
 
 TEST(LibRGW, LOOKUP_BUCKET) {
   int ret = rgw_lookup(fs, fs->root_fh, bucket_name.c_str(), &bucket_fh,
-                     0 /* flags */);
+                     RGW_LOOKUP_FLAG_NONE);
   ASSERT_EQ(ret, 0);
 }
 
@@ -197,7 +198,7 @@ TEST(LibRGW, LOOKUP_OBJECT) {
 }
 
 TEST(LibRGW, OPEN1) {
-  int ret = rgw_open(fs, object_fh, 0 /* flags */);
+  int ret = rgw_open(fs, object_fh, RGW_OPEN_FLAG_NONE);
   ASSERT_EQ(ret, 0);
 }
 
@@ -211,7 +212,7 @@ TEST(LibRGW, PUT_OBJECT) {
     sprintf(static_cast<char*>(iov->iov_base), "::hi mom (%d)", ix);
     iov->iov_len = 14;
     int ret = rgw_write(fs, object_fh, offset, iov->iov_len, &nbytes,
-                       iov->iov_base);
+                       iov->iov_base, RGW_WRITE_FLAG_NONE);
     offset += iov->iov_len;
     ASSERT_EQ(ret, 0);
     ASSERT_EQ(nbytes, iov->iov_len);
@@ -219,12 +220,12 @@ TEST(LibRGW, PUT_OBJECT) {
 }
 
 TEST(LibRGW, CLOSE1) {
-  int ret = rgw_close(fs, object_fh, 0 /* flags */);
+  int ret = rgw_close(fs, object_fh, RGW_CLOSE_FLAG_NONE);
   ASSERT_EQ(ret, 0);
 }
 
 TEST(LibRGW, OPEN2) {
-  int ret = rgw_open(fs, object_fh, 0 /* flags */);
+  int ret = rgw_open(fs, object_fh, RGW_OPEN_FLAG_NONE);
   ASSERT_EQ(ret, 0);
 }
 
@@ -235,7 +236,7 @@ TEST(LibRGW, GET_OBJECT) {
   for (int ix : {2 , 3}) {
     struct iovec *iov = &iovs[ix];
     int ret = rgw_read(fs, object_fh, offset, iovs[ix-2].iov_len, &nread,
-                      iov->iov_base);
+                      iov->iov_base, RGW_READ_FLAG_NONE);
     iov->iov_len = nread;
     offset += iov->iov_len;
     ASSERT_EQ(ret, 0);
@@ -245,13 +246,13 @@ TEST(LibRGW, GET_OBJECT) {
 }
 
 TEST(LibRGW, CLOSE2) {
-  int ret = rgw_close(fs, object_fh, 0 /* flags */);
+  int ret = rgw_close(fs, object_fh, RGW_CLOSE_FLAG_NONE);
   ASSERT_EQ(ret, 0);
 }
 
 TEST(LibRGW, STAT_OBJECT) {
   struct stat st;
-  int ret = rgw_getattr(fs, object_fh, &st);
+  int ret = rgw_getattr(fs, object_fh, &st, RGW_GETATTR_FLAG_NONE);
   ASSERT_EQ(ret, 0);
   dout(15) << "rgw_getattr on " << object_name << " size = "
           << st.st_size << dendl;
@@ -259,7 +260,8 @@ TEST(LibRGW, STAT_OBJECT) {
 
 TEST(LibRGW, DELETE_OBJECT) {
   if (do_delete) {
-    int ret = rgw_unlink(fs, bucket_fh, object_name.c_str());
+    int ret = rgw_unlink(fs, bucket_fh, object_name.c_str(),
+                        RGW_UNLINK_FLAG_NONE);
     ASSERT_EQ(ret, 0);
   }
 }
@@ -267,7 +269,7 @@ TEST(LibRGW, DELETE_OBJECT) {
 TEST(LibRGW, CLEANUP) {
   int ret;
   if (object_fh) {
-    ret = rgw_fh_rele(fs, object_fh, 0 /* flags */);
+    ret = rgw_fh_rele(fs, object_fh, RGW_FH_RELE_FLAG_NONE);
     ASSERT_EQ(ret, 0);
   }
   ret = rgw_fh_rele(fs, bucket_fh, 0 /* flags */);
@@ -278,7 +280,7 @@ TEST(LibRGW, UMOUNT) {
   if (! fs)
     return;
 
-  int ret = rgw_umount(fs);
+  int ret = rgw_umount(fs, RGW_UMOUNT_FLAG_NONE);
   ASSERT_EQ(ret, 0);
 }
 
index 735b01f2e0a871695413706c5c36f096da6dad07..4ec671fcda54148a51f868257e938f3e1c4c38e9 100644 (file)
@@ -54,7 +54,7 @@ TEST(LibRGW, INIT) {
 
 TEST(LibRGW, MOUNT) {
   int ret = rgw_mount(rgw, uid.c_str(), access_key.c_str(), secret_key.c_str(),
-                     &fs);
+                     &fs, RGW_MOUNT_FLAG_NONE);
   ASSERT_EQ(ret, 0);
   ASSERT_NE(fs, nullptr);
 }
@@ -63,14 +63,16 @@ 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,
+                       RGW_MKDIR_FLAG_NONE);
     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(),
+                        RGW_UNLINK_FLAG_NONE);
     ASSERT_EQ(ret, 0);
   }
 }
@@ -83,7 +85,8 @@ 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,
+                     RGW_MKDIR_FLAG_NONE);
       ASSERT_EQ(ret, 0);
       std::cout << "created: " << bn << std::endl;
     }
@@ -95,7 +98,8 @@ 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(),
+                          RGW_UNLINK_FLAG_NONE);
       ASSERT_EQ(ret, 0);
     }
   }
@@ -109,7 +113,7 @@ TEST(LibRGW, UMOUNT) {
   if (! fs)
     return;
 
-  int ret = rgw_umount(fs);
+  int ret = rgw_umount(fs, RGW_UMOUNT_FLAG_NONE);
   ASSERT_EQ(ret, 0);
 }
 
index eab64a8aa813c36d658364cffb4c91dd0627c01b..06b199b218fbc0b99d9e9e38bb38c6dad07f7d13 100644 (file)
@@ -179,14 +179,14 @@ TEST(LibRGW, INIT) {
 
 TEST(LibRGW, MOUNT) {
   int ret = rgw_mount(rgw, uid.c_str(), access_key.c_str(), secret_key.c_str(),
-                     &fs);
+                     &fs, RGW_MOUNT_FLAG_NONE);
   ASSERT_EQ(ret, 0);
   ASSERT_NE(fs, nullptr);
 }
 
 TEST(LibRGW, LOOKUP_BUCKET) {
   int ret = rgw_lookup(fs, fs->root_fh, bucket_name.c_str(), &bucket_fh,
-                     0 /* flags */);
+                      RGW_LOOKUP_FLAG_NONE);
   ASSERT_EQ(ret, 0);
 }
 
@@ -238,7 +238,7 @@ TEST(LibRGW, PUT_OBJECT) {
     size_t nbytes;
     string data = "hi mom"; // fix this
     int ret = rgw_write(fs, object_fh, 0, data.length(), &nbytes,
-                       (void*) data.c_str());
+                       (void*) data.c_str(), RGW_WRITE_FLAG_NONE);
     ASSERT_EQ(ret, 0);
     ASSERT_EQ(nbytes, data.length());
   }
@@ -249,7 +249,8 @@ TEST(LibRGW, GET_OBJECT) {
     char sbuf[512];
     memset(sbuf, 0, 512);
     uint64_t nread;
-    int ret = rgw_read(fs, object_fh, 0 /* off */, 512 /* len */, &nread, sbuf);
+    int ret = rgw_read(fs, object_fh, 0 /* off */, 512 /* len */, &nread, sbuf,
+                      RGW_READ_FLAG_NONE);
     ASSERT_EQ(ret, 0);
     buffer::list bl;
     bl.push_back(buffer::create_static(nread, sbuf));
@@ -264,7 +265,7 @@ TEST(LibRGW, GET_OBJECT) {
 TEST(LibRGW, STAT_OBJECT) {
   if (do_stat) {
     struct stat st;
-    int ret = rgw_getattr(fs, object_fh, &st);
+    int ret = rgw_getattr(fs, object_fh, &st, RGW_GETATTR_FLAG_NONE);
     ASSERT_EQ(ret, 0);
     dout(15) << "rgw_getattr on " << object_name << " size = "
             << st.st_size << dendl;
@@ -282,7 +283,7 @@ TEST(LibRGW, WRITE_READ_VERIFY)
     for (int ix = 0; ix < 16; ++ix, off += page_size) {
       struct iovec *iov = &iovs[ix];
       int ret = rgw_write(fs, object_fh, off, page_size, &nbytes,
-                         iov->iov_base);
+                         iov->iov_base, RGW_WRITE_FLAG_NONE);
       ASSERT_EQ(ret, 0);
       ASSERT_EQ(nbytes, size_t(page_size));
     }
@@ -320,7 +321,7 @@ TEST(LibRGW, WRITEV)
     uio->uio_cnt = iovcnt;
     uio->uio_offset = iovcnt * page_size;
 
-    int ret = rgw_writev(fs, object_fh, uio);
+    int ret = rgw_writev(fs, object_fh, uio, RGW_WRITE_FLAG_NONE);
     ASSERT_EQ(ret, 0);
   }
 }
@@ -331,7 +332,7 @@ TEST(LibRGW, READV)
     memset(uio, 0, sizeof(rgw_uio));
     uio->uio_offset = 0; // ok, it was already 0
     uio->uio_resid = UINT64_MAX;
-    int ret = rgw_readv(fs, object_fh, uio);
+    int ret = rgw_readv(fs, object_fh, uio, RGW_READ_FLAG_NONE);
     ASSERT_EQ(ret, 0);
     buffer::list bl;
     for (unsigned int ix = 0; ix < uio->uio_cnt; ++ix) {
@@ -362,7 +363,8 @@ TEST(LibRGW, READV_AFTER_WRITEV)
 
 TEST(LibRGW, DELETE_OBJECT) {
   if (do_delete) {
-    int ret = rgw_unlink(fs, bucket_fh, object_name.c_str());
+    int ret = rgw_unlink(fs, bucket_fh, object_name.c_str(),
+                        RGW_UNLINK_FLAG_NONE);
     ASSERT_EQ(ret, 0);
   }
 }
@@ -377,7 +379,7 @@ TEST(LibRGW, CLEANUP) {
   }
   int ret;
   if (object_open) {
-    ret = rgw_close(fs, object_fh, 0 /* flags */);
+    ret = rgw_close(fs, object_fh, RGW_CLOSE_FLAG_NONE);
     ASSERT_EQ(ret, 0);
   }
   if (object_fh) {
@@ -392,7 +394,7 @@ TEST(LibRGW, UMOUNT) {
   if (! fs)
     return;
 
-  int ret = rgw_umount(fs);
+  int ret = rgw_umount(fs, RGW_UMOUNT_FLAG_NONE);
   ASSERT_EQ(ret, 0);
 }
 
index fd5f8838b739547bbecebb9c5c188ba349945a46..7b86e0cebe4b49d6e9102795400b775a162da945 100644 (file)
@@ -132,7 +132,7 @@ TEST(LibRGW, INIT) {
 
 TEST(LibRGW, MOUNT) {
   int ret = rgw_mount(rgw_h, uid.c_str(), access_key.c_str(),
-                     secret_key.c_str(), &fs);
+                     secret_key.c_str(), &fs, RGW_MOUNT_FLAG_NONE);
   ASSERT_EQ(ret, 0);
   ASSERT_NE(fs, nullptr);
 
@@ -148,7 +148,7 @@ TEST(LibRGW, SETUP_HIER1)
       if (do_create) {
        struct stat st;
        int rc = rgw_mkdir(fs, fs->root_fh, bucket_name.c_str(), 755, &st,
-                         &bucket_fh);
+                          &bucket_fh, RGW_MKDIR_FLAG_NONE);
        ASSERT_EQ(rc, 0);
       }
     }
@@ -203,7 +203,7 @@ TEST(LibRGW, SETUP_DIRS1) {
     if (! dirs1_b.fh) {
       if (do_create) {
        rc = rgw_mkdir(fs, dirs1_b.parent_fh, dirs1_b.name.c_str(), 755, &st,
-                     &dirs1_b.fh);
+                      &dirs1_b.fh, RGW_MKDIR_FLAG_NONE);
        ASSERT_EQ(rc, 0);
       }
     }
@@ -222,7 +222,7 @@ TEST(LibRGW, SETUP_DIRS1) {
       if (! dir.fh) {
        if (do_create) {
          rc = rgw_mkdir(fs, dir.parent_fh, dir.name.c_str(), 755, &st,
-                       &dir.fh);
+                        &dir.fh, RGW_MKDIR_FLAG_NONE);
          ASSERT_EQ(rc, 0);
        }
       }
@@ -245,7 +245,7 @@ TEST(LibRGW, SETUP_DIRS1) {
        if (! sdir.fh) {
          if (do_create) {
            rc = rgw_mkdir(fs, sdir.parent_fh, sdir.name.c_str(), 755,
-                         &st, &sdir.fh);
+                          &st, &sdir.fh, RGW_MKDIR_FLAG_NONE);
            ASSERT_EQ(rc, 0);
          }
        }
@@ -281,7 +281,7 @@ TEST(LibRGW, SETUP_DIRS1) {
            size_t nbytes;
            string data = "data for " + sf.name;
            rc = rgw_write(fs, sf.fh, 0, data.length(), &nbytes,
-                         (void*) data.c_str());
+                          (void*) data.c_str(), RGW_WRITE_FLAG_NONE);
            ASSERT_EQ(rc, 0);
            ASSERT_EQ(nbytes, data.length());
            /* commit write transaction */
@@ -306,7 +306,8 @@ TEST(LibRGW, BAD_DELETES_DIRS1) {
     int rc;
     if (do_delete) {
       /* try to unlink a non-empty directory (bucket) */
-      rc = rgw_unlink(fs, dirs1_b.parent_fh, dirs1_b.name.c_str());
+      rc = rgw_unlink(fs, dirs1_b.parent_fh, dirs1_b.name.c_str(),
+                     RGW_UNLINK_FLAG_NONE);
       ASSERT_NE(rc, 0);
     }
     /* try to unlink a non-empty directory (non-bucket) */
@@ -317,12 +318,18 @@ TEST(LibRGW, BAD_DELETES_DIRS1) {
 #if 0
     ASSERT_EQ(sdir_0.name, "sdir_0");
     ASSERT_TRUE(sdir_0.rgw_fh->is_dir());
-    rc = rgw_unlink(fs, sdir_0.parent_fh, sdir_0.name.c_str());
+    rc = rgw_unlink(fs, sdir_0.parent_fh, sdir_0.name.c_str(),
+                   RGW_UNLINK_FLAG_NONE);
     ASSERT_NE(rc, 0);
 #endif
   }
 }
 
+TEST(LibRGW, GETATTR_DIRS1)
+{
+
+}
+
 TEST(LibRGW, RELEASE_DIRS1) {
   if (do_dirs1) {
     /* force release of handles for children of dirs1--force subsequent
@@ -351,8 +358,6 @@ TEST(LibRGW, RELEASE_DIRS1) {
   }
 }
 
-// do getattrs (check type and times)
-
 extern "C" {
   static bool r1_cb(const char* name, void *arg, uint64_t offset) {
     struct rgw_file_handle* parent_fh
@@ -457,7 +462,8 @@ TEST(LibRGW, MARKER1_SETUP_BUCKET) {
     int ret;
 
     if (do_create) {
-      ret = rgw_mkdir(fs, bucket_fh, marker_dir.c_str(), 755, &st, &marker_fh);
+      ret = rgw_mkdir(fs, bucket_fh, marker_dir.c_str(), 755, &st, &marker_fh,
+                     RGW_MKDIR_FLAG_NONE);
     } else {
       ret = rgw_lookup(fs, bucket_fh, marker_dir.c_str(), &marker_fh,
                       RGW_LOOKUP_FLAG_NONE);
@@ -483,7 +489,7 @@ TEST(LibRGW, MARKER1_SETUP_OBJECTS)
       ASSERT_EQ(ret, 0);
       obj.rgw_fh = get_rgwfh(obj.fh);
       // open object--open transaction
-      ret = rgw_open(fs, obj.fh, 0 /* flags */);
+      ret = rgw_open(fs, obj.fh, RGW_OPEN_FLAG_NONE);
       ASSERT_EQ(ret, 0);
       ASSERT_TRUE(obj.rgw_fh->is_open());
       // unstable write data
@@ -491,7 +497,7 @@ TEST(LibRGW, MARKER1_SETUP_OBJECTS)
       string data("data for ");
       data += object_name;
       int ret = rgw_write(fs, obj.fh, 0, data.length(), &nbytes,
-                         (void*) data.c_str());
+                         (void*) data.c_str(), RGW_WRITE_FLAG_NONE);
       ASSERT_EQ(ret, 0);
       ASSERT_EQ(nbytes, data.length());
       // commit transaction (write on close)
@@ -561,7 +567,7 @@ TEST(LibRGW, MARKER1_OBJ_CLEANUP)
          std::cout << "unlinking: " << bucket_name << ":" << obj.name
                    << std::endl;
        }
-       rc = rgw_unlink(fs, marker_fh, obj.name.c_str());
+       rc = rgw_unlink(fs, marker_fh, obj.name.c_str(), RGW_UNLINK_FLAG_NONE);
       }
       rc = rgw_fh_rele(fs, obj.fh, 0 /* flags */);
       ASSERT_EQ(rc, 0);
@@ -591,7 +597,7 @@ TEST(LibRGW, UMOUNT) {
   if (! fs)
     return;
 
-  int ret = rgw_umount(fs);
+  int ret = rgw_umount(fs, RGW_UMOUNT_FLAG_NONE);
   ASSERT_EQ(ret, 0);
 }