From 1a06923049dfd9a9c26dbf0f45ac72f893087438 Mon Sep 17 00:00:00 2001 From: Ronen Friedman Date: Sun, 2 Mar 2025 06:10:15 -0600 Subject: [PATCH] auth,client: replace obsolete get_tracked_conf_keys() .. with get_tracked_keys(). Following https://github.com/ceph/ceph/pull/61394, all uses of the deprecated interface will be updated, and that old interface will be removed. Signed-off-by: Ronen Friedman --- src/auth/AuthRegistry.cc | 29 +++++++++++------------ src/auth/AuthRegistry.h | 2 +- src/client/Client.cc | 51 ++++++++++++++++------------------------ src/client/Client.h | 2 +- 4 files changed, 36 insertions(+), 48 deletions(-) diff --git a/src/auth/AuthRegistry.cc b/src/auth/AuthRegistry.cc index 0043567fb8db8..50c42bdf71cb9 100644 --- a/src/auth/AuthRegistry.cc +++ b/src/auth/AuthRegistry.cc @@ -17,6 +17,7 @@ #define dout_prefix *_dout << "AuthRegistry(" << this << ") " using std::string; +using namespace std::literals; AuthRegistry::AuthRegistry(CephContext *cct) : cct(cct) @@ -32,23 +33,21 @@ AuthRegistry::~AuthRegistry() } } -const char** AuthRegistry::get_tracked_conf_keys() const +std::vector AuthRegistry::get_tracked_keys() const noexcept { - static const char *keys[] = { - "auth_supported", - "auth_client_required", - "auth_cluster_required", - "auth_service_required", - "ms_mon_cluster_mode", - "ms_mon_service_mode", - "ms_mon_client_mode", - "ms_cluster_mode", - "ms_service_mode", - "ms_client_mode", - "keyring", - NULL + return { + "auth_supported"s, + "auth_client_required"s, + "auth_cluster_required"s, + "auth_service_required"s, + "ms_mon_cluster_mode"s, + "ms_mon_service_mode"s, + "ms_mon_client_mode"s, + "ms_cluster_mode"s, + "ms_service_mode"s, + "ms_client_mode"s, + "keyring"s }; - return keys; } void AuthRegistry::handle_conf_change( diff --git a/src/auth/AuthRegistry.h b/src/auth/AuthRegistry.h index fd746c7911143..05fe01274a1c6 100644 --- a/src/auth/AuthRegistry.h +++ b/src/auth/AuthRegistry.h @@ -70,7 +70,7 @@ public: AuthAuthorizeHandler *get_handler(int peer_type, int method); - const char** get_tracked_conf_keys() const override; + std::vector get_tracked_keys() const noexcept override; void handle_conf_change(const ConfigProxy& conf, const std::set& changed) override; diff --git a/src/client/Client.cc b/src/client/Client.cc index 374918a5c2904..5090e7182687e 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -172,6 +172,7 @@ using std::vector; using namespace std::literals; using namespace TOPNSPC::common; +using namespace std::literals; namespace bs = boost::system; namespace ca = ceph::async; @@ -17332,38 +17333,26 @@ void Client::set_cap_epoch_barrier(epoch_t e) cap_epoch_barrier = e; } -const char** Client::get_tracked_conf_keys() const -{ -#define KEYS \ - "client_acl_type", \ - "client_cache_mid", \ - "client_cache_size", \ - "client_caps_release_delay", \ - "client_deleg_break_on_open", \ - "client_deleg_timeout", \ - "client_mount_timeout", \ - "client_oc_max_dirty", \ - "client_oc_max_dirty_age", \ - "client_oc_max_objects", \ - "client_oc_size", \ - "client_oc_target_dirty", \ - "client_permissions", \ +std::vector Client::get_tracked_keys() const noexcept +{ + static constexpr auto as_sv = std::to_array({ + "client_acl_type", + "client_cache_mid", + "client_cache_size", + "client_caps_release_delay", + "client_deleg_break_on_open", + "client_deleg_timeout", + "client_mount_timeout", + "client_oc_max_dirty", + "client_oc_max_dirty_age", + "client_oc_max_objects", + "client_oc_size", + "client_oc_target_dirty", + "client_permissions", "fuse_default_permissions" - - constexpr bool is_sorted = [] () constexpr { - constexpr auto arr = std::to_array({KEYS}); - for (unsigned long i = 0; i < arr.size()-1; ++i) { - if (arr[i] > arr[i+1]) { - return false; - } - } - return true; - }(); - static_assert(is_sorted, "keys are not sorted!"); - - static char const* keys[] = {KEYS, nullptr}; - - return keys; + }); + static_assert(std::is_sorted(begin(as_sv), end(as_sv))); + return {begin(as_sv), end(as_sv)}; } void Client::handle_conf_change(const ConfigProxy& conf, diff --git a/src/client/Client.h b/src/client/Client.h index 3fd3e9201e4b5..23376052f9efc 100644 --- a/src/client/Client.h +++ b/src/client/Client.h @@ -696,7 +696,7 @@ public: int ll_register_callbacks2(struct ceph_client_callback_args *args); std::pair test_dentry_handling(bool can_invalidate); - const char** get_tracked_conf_keys() const override; + std::vector get_tracked_keys() const noexcept override; void handle_conf_change(const ConfigProxy& conf, const std::set &changed) override; uint32_t get_deleg_timeout() { return deleg_timeout; } -- 2.39.5