]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mds: refactor out fs_name match in MDSAuthCaps
authorPatrick Donnelly <pdonnell@redhat.com>
Thu, 2 May 2024 12:55:36 +0000 (08:55 -0400)
committerPatrick Donnelly <pdonnell@redhat.com>
Tue, 7 May 2024 12:19:27 +0000 (08:19 -0400)
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
src/mds/MDSAuthCaps.h

index 26958b49acd3441657f4f9fe4eb6a7983ed57573..bca063ecb33f840a414b5701b126320bafa0e76e 100644 (file)
@@ -158,6 +158,10 @@ struct MDSCapMatch {
   bool match_path(std::string_view target_path) const;
   std::string to_string();
 
+  bool match_fs(std::string_view target_fs) const {
+    return fs_name == target_fs || fs_name.empty() || fs_name == "*";
+  }
+
   void encode(ceph::buffer::list& bl) const {
     ENCODE_START(1, 1, bl);
     encode(uid, bl);
@@ -276,8 +280,7 @@ public:
     }
 
     for (const MDSCapGrant &g : grants) {
-      if (g.match.fs_name == fs_name || g.match.fs_name.empty() ||
-         g.match.fs_name == "*") {
+      if (g.match.match_fs(fs_name)) {
        if (mask & MAY_READ && g.spec.allow_read()) {
          return true;
        }