Skip to content

Commit 1a06923

Browse files
committed
auth,client: replace obsolete get_tracked_conf_keys()
.. with get_tracked_keys(). Following ceph#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>
1 parent 2d4b423 commit 1a06923

File tree

4 files changed

+36
-48
lines changed

4 files changed

+36
-48
lines changed

src/auth/AuthRegistry.cc

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#define dout_prefix *_dout << "AuthRegistry(" << this << ") "
1818

1919
using std::string;
20+
using namespace std::literals;
2021

2122
AuthRegistry::AuthRegistry(CephContext *cct)
2223
: cct(cct)
@@ -32,23 +33,21 @@ AuthRegistry::~AuthRegistry()
3233
}
3334
}
3435

35-
const char** AuthRegistry::get_tracked_conf_keys() const
36+
std::vector<std::string> AuthRegistry::get_tracked_keys() const noexcept
3637
{
37-
static const char *keys[] = {
38-
"auth_supported",
39-
"auth_client_required",
40-
"auth_cluster_required",
41-
"auth_service_required",
42-
"ms_mon_cluster_mode",
43-
"ms_mon_service_mode",
44-
"ms_mon_client_mode",
45-
"ms_cluster_mode",
46-
"ms_service_mode",
47-
"ms_client_mode",
48-
"keyring",
49-
NULL
38+
return {
39+
"auth_supported"s,
40+
"auth_client_required"s,
41+
"auth_cluster_required"s,
42+
"auth_service_required"s,
43+
"ms_mon_cluster_mode"s,
44+
"ms_mon_service_mode"s,
45+
"ms_mon_client_mode"s,
46+
"ms_cluster_mode"s,
47+
"ms_service_mode"s,
48+
"ms_client_mode"s,
49+
"keyring"s
5050
};
51-
return keys;
5251
}
5352

5453
void AuthRegistry::handle_conf_change(

src/auth/AuthRegistry.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class AuthRegistry : public md_config_obs_t {
7070

7171
AuthAuthorizeHandler *get_handler(int peer_type, int method);
7272

73-
const char** get_tracked_conf_keys() const override;
73+
std::vector<std::string> get_tracked_keys() const noexcept override;
7474
void handle_conf_change(const ConfigProxy& conf,
7575
const std::set<std::string>& changed) override;
7676

src/client/Client.cc

Lines changed: 20 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ using std::vector;
172172
using namespace std::literals;
173173

174174
using namespace TOPNSPC::common;
175+
using namespace std::literals;
175176

176177
namespace bs = boost::system;
177178
namespace ca = ceph::async;
@@ -17332,38 +17333,26 @@ void Client::set_cap_epoch_barrier(epoch_t e)
1733217333
cap_epoch_barrier = e;
1733317334
}
1733417335

17335-
const char** Client::get_tracked_conf_keys() const
17336-
{
17337-
#define KEYS \
17338-
"client_acl_type", \
17339-
"client_cache_mid", \
17340-
"client_cache_size", \
17341-
"client_caps_release_delay", \
17342-
"client_deleg_break_on_open", \
17343-
"client_deleg_timeout", \
17344-
"client_mount_timeout", \
17345-
"client_oc_max_dirty", \
17346-
"client_oc_max_dirty_age", \
17347-
"client_oc_max_objects", \
17348-
"client_oc_size", \
17349-
"client_oc_target_dirty", \
17350-
"client_permissions", \
17336+
std::vector<std::string> Client::get_tracked_keys() const noexcept
17337+
{
17338+
static constexpr auto as_sv = std::to_array<std::string_view>({
17339+
"client_acl_type",
17340+
"client_cache_mid",
17341+
"client_cache_size",
17342+
"client_caps_release_delay",
17343+
"client_deleg_break_on_open",
17344+
"client_deleg_timeout",
17345+
"client_mount_timeout",
17346+
"client_oc_max_dirty",
17347+
"client_oc_max_dirty_age",
17348+
"client_oc_max_objects",
17349+
"client_oc_size",
17350+
"client_oc_target_dirty",
17351+
"client_permissions",
1735117352
"fuse_default_permissions"
17352-
17353-
constexpr bool is_sorted = [] () constexpr {
17354-
constexpr auto arr = std::to_array<std::string_view>({KEYS});
17355-
for (unsigned long i = 0; i < arr.size()-1; ++i) {
17356-
if (arr[i] > arr[i+1]) {
17357-
return false;
17358-
}
17359-
}
17360-
return true;
17361-
}();
17362-
static_assert(is_sorted, "keys are not sorted!");
17363-
17364-
static char const* keys[] = {KEYS, nullptr};
17365-
17366-
return keys;
17353+
});
17354+
static_assert(std::is_sorted(begin(as_sv), end(as_sv)));
17355+
return {begin(as_sv), end(as_sv)};
1736717356
}
1736817357

1736917358
void Client::handle_conf_change(const ConfigProxy& conf,

src/client/Client.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -696,7 +696,7 @@ class Client : public Dispatcher, public md_config_obs_t {
696696
int ll_register_callbacks2(struct ceph_client_callback_args *args);
697697
std::pair<int, bool> test_dentry_handling(bool can_invalidate);
698698

699-
const char** get_tracked_conf_keys() const override;
699+
std::vector<std::string> get_tracked_keys() const noexcept override;
700700
void handle_conf_change(const ConfigProxy& conf,
701701
const std::set <std::string> &changed) override;
702702
uint32_t get_deleg_timeout() { return deleg_timeout; }

0 commit comments

Comments
 (0)