]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
auth,client: replace obsolete get_tracked_conf_keys()
authorRonen Friedman <rfriedma@redhat.com>
Sun, 2 Mar 2025 12:10:15 +0000 (06:10 -0600)
committerRonen Friedman <rfriedma@redhat.com>
Mon, 3 Mar 2025 16:03:12 +0000 (10:03 -0600)
.. 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 <rfriedma@redhat.com>
src/auth/AuthRegistry.cc
src/auth/AuthRegistry.h
src/client/Client.cc
src/client/Client.h

index 0043567fb8db865a767cf02c36a1bbbad546181a..50c42bdf71cb9eed7056f705ce9dba226b2cc7ac 100644 (file)
@@ -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<std::string> 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(
index fd746c791114392115935c89c114f7b690c5b03c..05fe01274a1c69de5261d1fa4937572b7960d3db 100644 (file)
@@ -70,7 +70,7 @@ public:
 
   AuthAuthorizeHandler *get_handler(int peer_type, int method);
 
-  const char** get_tracked_conf_keys() const override;
+  std::vector<std::string> get_tracked_keys() const noexcept override;
   void handle_conf_change(const ConfigProxy& conf,
                           const std::set<std::string>& changed) override;
 
index 374918a5c2904b6753f8d2183e999fcf86720c22..5090e7182687ed918c7bc3c869da91cde8d8ade2 100644 (file)
@@ -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<std::string> Client::get_tracked_keys() const noexcept
+{
+  static constexpr auto as_sv = std::to_array<std::string_view>({
+    "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<std::string_view>({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,
index 3fd3e9201e4b568ebe8a4a97ab18a8fdb0c3a51a..23376052f9efc9020f2778603005ca95f828452d 100644 (file)
@@ -696,7 +696,7 @@ public:
   int ll_register_callbacks2(struct ceph_client_callback_args *args);
   std::pair<int, bool> test_dentry_handling(bool can_invalidate);
 
-  const char** get_tracked_conf_keys() const override;
+  std::vector<std::string> get_tracked_keys() const noexcept override;
   void handle_conf_change(const ConfigProxy& conf,
                                  const std::set <std::string> &changed) override;
   uint32_t get_deleg_timeout() { return deleg_timeout; }