From 4d8c6519b374d14c8c367cebb9228387cbdeaa80 Mon Sep 17 00:00:00 2001 From: Rongqi Sun Date: Tue, 12 Dec 2023 10:33:19 +0800 Subject: [PATCH] crimson: add set_val and rm_val to global conf. Signed-off-by: Rongqi Sun --- src/crimson/common/config_proxy.h | 7 +++++++ src/global/global_context.cc | 29 +++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/src/crimson/common/config_proxy.h b/src/crimson/common/config_proxy.h index 822db34f61a..b04fbee2e8a 100644 --- a/src/crimson/common/config_proxy.h +++ b/src/crimson/common/config_proxy.h @@ -14,6 +14,11 @@ namespace ceph { class Formatter; } +namespace ceph::global { +int g_conf_set_val(const std::string& key, const std::string& s); +int g_conf_rm_val(const std::string& key); +} + namespace crimson::common { // a facade for managing config. each shard has its own copy of ConfigProxy. @@ -128,6 +133,7 @@ public: obs_mgr.remove_observer(obs); } seastar::future<> rm_val(const std::string& key) { + ceph::global::g_conf_rm_val(key); return do_change([key, this](ConfigValues& values) { auto ret = get_config().rm_val(values, key); if (ret < 0) { @@ -137,6 +143,7 @@ public: } seastar::future<> set_val(const std::string& key, const std::string& val) { + ceph::global::g_conf_set_val(key, val); return do_change([key, val, this](ConfigValues& values) { std::stringstream err; auto ret = get_config().set_val(values, obs_mgr, key, val, &err); diff --git a/src/global/global_context.cc b/src/global/global_context.cc index b1e37bfbe59..0fea21d558a 100644 --- a/src/global/global_context.cc +++ b/src/global/global_context.cc @@ -20,6 +20,17 @@ #include "crimson/common/config_proxy.h" #endif +#if defined(WITH_SEASTAR) && !defined(WITH_ALIEN) +namespace ceph::global { +int __attribute__((weak)) g_conf_set_val(const std::string& key, const std::string& s) { + return 0; +} + +int __attribute__((weak)) g_conf_rm_val(const std::string& key) { + return 0; +} +} +#endif /* * Global variables for use from process context. @@ -34,6 +45,24 @@ ConfigProxy& g_conf() { #endif } +#ifdef WITH_ALIEN +int g_conf_set_val(const std::string& key, const std::string& s) +{ + if (g_ceph_context != NULL) + return g_ceph_context->_conf.set_val(key, s); + + return 0; +} + +int g_conf_rm_val(const std::string& key) +{ + if (g_ceph_context != NULL) + return g_ceph_context->_conf.rm_val(key); + + return 0; +} +#endif + const char *g_assert_file = 0; int g_assert_line = 0; const char *g_assert_func = 0; -- 2.47.3