]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
MDSAuthCaps: bring std::string_view in main scope before using it
authorRishabh Dave <ridave@redhat.com>
Wed, 21 Jun 2023 20:58:40 +0000 (02:28 +0530)
committerRishabh Dave <ridave@redhat.com>
Fri, 22 Mar 2024 16:36:05 +0000 (22:06 +0530)
Bring std::string_view to the main scope of MDSAuthCaps.cc before using
it. This reduces typing effort and improves readability.

Signed-off-by: Rishabh Dave <ridave@redhat.com>
(cherry picked from commit 4a37d66a6a6fed24b4c206b140abc6f589de598a)

src/mds/MDSAuthCaps.cc

index 343751505c3ecc64fdf7c96920600b2097171ddb..7f16c954368909ccfc3b693a5f15b5d7b13b3aec 100644 (file)
@@ -33,6 +33,7 @@
 using std::ostream;
 using std::string;
 using std::vector;
+using std::string_view;
 namespace qi = boost::spirit::qi;
 namespace ascii = boost::spirit::ascii;
 namespace phoenix = boost::phoenix;
@@ -132,7 +133,7 @@ void MDSCapMatch::normalize_path()
   // drop ..
 }
 
-bool MDSCapMatch::match(std::string_view target_path,
+bool MDSCapMatch::match(string_view target_path,
                        const int caller_uid,
                        const int caller_gid,
                        const vector<uint64_t> *caller_gid_list) const
@@ -164,7 +165,7 @@ bool MDSCapMatch::match(std::string_view target_path,
   return true;
 }
 
-bool MDSCapMatch::match_path(std::string_view target_path) const
+bool MDSCapMatch::match_path(string_view target_path) const
 {
   if (path.length()) {
     if (target_path.find(path) != 0)
@@ -190,7 +191,7 @@ void MDSCapGrant::parse_network()
  * Is the client *potentially* able to access this path?  Actual
  * permission will depend on uids/modes in the full is_capable.
  */
-bool MDSAuthCaps::path_capable(std::string_view inode_path) const
+bool MDSAuthCaps::path_capable(string_view inode_path) const
 {
   for (const auto &i : grants) {
     if (i.match.match_path(inode_path)) {
@@ -208,7 +209,7 @@ bool MDSAuthCaps::path_capable(std::string_view inode_path) const
  * This is true if any of the 'grant' clauses in the capability match the
  * requested path + op.
  */
-bool MDSAuthCaps::is_capable(std::string_view inode_path,
+bool MDSAuthCaps::is_capable(string_view inode_path,
                             uid_t inode_uid, gid_t inode_gid,
                             unsigned inode_mode,
                             uid_t caller_uid, gid_t caller_gid,
@@ -328,7 +329,7 @@ void MDSAuthCaps::set_allow_all()
                                 {}));
 }
 
-bool MDSAuthCaps::parse(std::string_view str, ostream *err)
+bool MDSAuthCaps::parse(string_view str, ostream *err)
 {
   // Special case for legacy caps
   if (str == "allow") {