From f7ea7c989b66a9eee7338ff9dfe30dee85e49e04 Mon Sep 17 00:00:00 2001 From: Colin Patrick McCabe Date: Tue, 24 May 2011 17:50:24 -0700 Subject: [PATCH] rgw: Fix RGWAccess::init_storage_provider Signed-off-by: Colin McCabe --- src/rgw/rgw_access.cc | 4 ++-- src/rgw/rgw_access.h | 4 ++-- src/rgw/rgw_admin.cc | 2 +- src/rgw/rgw_fs.cc | 5 +++++ src/rgw/rgw_fs.h | 1 + src/rgw/rgw_main.cc | 2 +- 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/rgw/rgw_access.cc b/src/rgw/rgw_access.cc index 1166b75b8f3..468cafc086c 100644 --- a/src/rgw/rgw_access.cc +++ b/src/rgw/rgw_access.cc @@ -17,7 +17,7 @@ RGWAccess::~RGWAccess() { } -RGWAccess *RGWAccess::init_storage_provider(const char *type, md_config_t *conf) +RGWAccess *RGWAccess::init_storage_provider(const char *type, CephContext *cct) { if (strcmp(type, "rados") == 0) { store = &rados_provider; @@ -27,7 +27,7 @@ RGWAccess *RGWAccess::init_storage_provider(const char *type, md_config_t *conf) store = NULL; } - if (store->initialize(conf) < 0) + if (store->initialize(cct) < 0) store = NULL; return store; diff --git a/src/rgw/rgw_access.h b/src/rgw/rgw_access.h index 787ed62aa97..f52dcb938c8 100644 --- a/src/rgw/rgw_access.h +++ b/src/rgw/rgw_access.h @@ -18,7 +18,7 @@ class RGWAccess { public: virtual ~RGWAccess(); /** do all necessary setup of the storage device */ - virtual int initialize(md_config_t *conf) { return 0; } + virtual int initialize(CephContext *cct) = 0; /** prepare a listing of all buckets. */ virtual int list_buckets_init(std::string& id, RGWAccessHandle *handle) = 0; /** get the next bucket in the provided listing context. */ @@ -184,7 +184,7 @@ public: * Given the name of the storage provider, initialize it * with the given arguments. */ - static RGWAccess *init_storage_provider(const char *type, md_config_t *conf); + static RGWAccess *init_storage_provider(const char *type, CephContext *cct); static RGWAccess *store; }; diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index df4f2d952f8..ba40d0421cd 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -396,7 +396,7 @@ int main(int argc, char **argv) opt_cmd == OPT_SUBUSER_CREATE || opt_cmd == OPT_SUBUSER_RM || opt_cmd == OPT_KEY_CREATE || opt_cmd == OPT_KEY_RM); - store = RGWAccess::init_storage_provider("rados", &g_conf); + store = RGWAccess::init_storage_provider("rados", &g_ceph_context); if (!store) { cerr << "couldn't init storage provider" << std::endl; return 5; //EIO diff --git a/src/rgw/rgw_fs.cc b/src/rgw/rgw_fs.cc index ff8091d04b9..6ea2f99da72 100644 --- a/src/rgw/rgw_fs.cc +++ b/src/rgw/rgw_fs.cc @@ -26,6 +26,11 @@ struct rgwfs_state { #define DIR_NAME "/tmp/radosgw" +int RGWFS::initialize(CephContext *cct) +{ + return 0; +} + int RGWFS::list_buckets_init(string& id, RGWAccessHandle *handle) { DIR *dir = opendir(DIR_NAME); diff --git a/src/rgw/rgw_fs.h b/src/rgw/rgw_fs.h index b2e424d6181..e4c5deb9d7a 100644 --- a/src/rgw/rgw_fs.h +++ b/src/rgw/rgw_fs.h @@ -10,6 +10,7 @@ class RGWFS : public RGWAccess int fd; }; public: + virtual int initialize(CephContext *cct); int list_buckets_init(std::string& id, RGWAccessHandle *handle); int list_buckets_next(std::string& id, RGWObjEnt& obj, RGWAccessHandle *handle); diff --git a/src/rgw/rgw_main.cc b/src/rgw/rgw_main.cc index 944e19f133b..559016b7eb1 100644 --- a/src/rgw/rgw_main.cc +++ b/src/rgw/rgw_main.cc @@ -77,7 +77,7 @@ int main(int argc, const char **argv) common_init(args, CEPH_ENTITY_TYPE_CLIENT, CODE_ENVIRONMENT_UTILITY, 0); common_init_finish(&g_ceph_context); - if (!RGWAccess::init_storage_provider("rados", &g_conf)) { + if (!RGWAccess::init_storage_provider("rados", &g_ceph_context)) { derr << "Couldn't init storage provider (RADOS)" << dendl; return EIO; } -- 2.47.3