]> git.apps.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>
Wed, 21 Jun 2023 23:28:31 +0000 (04:58 +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>
src/mds/MDSAuthCaps.cc

index d983f2d58b19aa173041de5fb1b8004e4effe249..b0f07b153aaec1e717f28b39d1cd84cf88fcc1e7 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;
@@ -142,7 +143,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
@@ -174,7 +175,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)
@@ -200,7 +201,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)) {
@@ -218,7 +219,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,
@@ -338,7 +339,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") {