From cc65bc948ad1d14ed6140cbe8027b4a189cf6a42 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Tue, 16 Apr 2019 20:13:03 +0800 Subject: [PATCH] auth/AuthRegistry: more constness Signed-off-by: Kefu Chai --- src/auth/AuthRegistry.cc | 8 ++++---- src/auth/AuthRegistry.h | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/auth/AuthRegistry.cc b/src/auth/AuthRegistry.cc index 241db4a9c73..2229c8ab906 100644 --- a/src/auth/AuthRegistry.cc +++ b/src/auth/AuthRegistry.cc @@ -178,7 +178,7 @@ void AuthRegistry::_refresh_config() void AuthRegistry::get_supported_methods( int peer_type, std::vector *methods, - std::vector *modes) + std::vector *modes) const { if (methods) { methods->clear(); @@ -253,14 +253,14 @@ void AuthRegistry::get_supported_methods( } } -bool AuthRegistry::is_supported_method(int peer_type, int method) +bool AuthRegistry::is_supported_method(int peer_type, int method) const { std::vector s; get_supported_methods(peer_type, &s); return std::find(s.begin(), s.end(), method) != s.end(); } -bool AuthRegistry::any_supported_methods(int peer_type) +bool AuthRegistry::any_supported_methods(int peer_type) const { std::vector s; get_supported_methods(peer_type, &s); @@ -270,7 +270,7 @@ bool AuthRegistry::any_supported_methods(int peer_type) void AuthRegistry::get_supported_modes( int peer_type, uint32_t auth_method, - std::vector *modes) + std::vector *modes) const { std::vector s; get_supported_methods(peer_type, nullptr, &s); diff --git a/src/auth/AuthRegistry.h b/src/auth/AuthRegistry.h index 0b986965cb4..4be051ee171 100644 --- a/src/auth/AuthRegistry.h +++ b/src/auth/AuthRegistry.h @@ -14,7 +14,7 @@ class AuthRegistry : public md_config_obs_t { CephContext *cct; - ceph::mutex lock = ceph::make_mutex("AuthRegistry::lock"); + mutable ceph::mutex lock = ceph::make_mutex("AuthRegistry::lock"); std::map authorize_handlers; @@ -48,13 +48,13 @@ public: void get_supported_methods(int peer_type, std::vector *methods, - std::vector *modes=nullptr); - bool is_supported_method(int peer_type, int method); - bool any_supported_methods(int peer_type); + std::vector *modes=nullptr) const; + bool is_supported_method(int peer_type, int method) const; + bool any_supported_methods(int peer_type) const; void get_supported_modes(int peer_type, uint32_t auth_method, - std::vector *modes); + std::vector *modes) const; uint32_t pick_mode(int peer_type, uint32_t auth_method, -- 2.39.5