]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mds: encode/decode the MDSCapMatch
authorXiubo Li <xiubli@redhat.com>
Tue, 20 Dec 2022 04:30:09 +0000 (12:30 +0800)
committerXiubo Li <xiubli@redhat.com>
Wed, 27 Mar 2024 00:42:40 +0000 (08:42 +0800)
Will send this to clients.

Fixes: https://tracker.ceph.com/issues/57154
Signed-off-by: Xiubo Li <xiubli@redhat.com>
(cherry picked from commit 53caf313957b414ab7fcc77ff23bd1470cca1724)

src/mds/MDSAuthCaps.h

index ba4b369a61b07edd79b8109ff863db8e3a5f517b..266bc27c7e806a16c84cba35a8273d46f3155c54 100644 (file)
@@ -19,6 +19,7 @@
 #include <string_view>
 #include <vector>
 
+#include "include/encoding.h"
 #include "include/common_fwd.h"
 #include "include/types.h"
 #include "common/debug.h"
@@ -145,6 +146,26 @@ struct MDSCapMatch {
    */
   bool match_path(std::string_view target_path) const;
 
+  void encode(ceph::buffer::list& bl) const {
+    ENCODE_START(1, 1, bl);
+    encode(uid, bl);
+    encode(gids, bl);
+    encode(path, bl);
+    encode(fs_name, bl);
+    encode(root_squash, bl);
+    ENCODE_FINISH(bl);
+  }
+
+  void decode(ceph::buffer::list::const_iterator& p) {
+    DECODE_START(1, p);
+    decode(uid, p);
+    decode(gids, p);
+    decode(path, p);
+    decode(fs_name, p);
+    decode(root_squash, p);
+    DECODE_FINISH(p);
+  }
+
   // Require UID to be equal to this, if !=MDS_AUTH_UID_ANY
   int64_t uid = MDS_AUTH_UID_ANY;
   std::vector<gid_t> gids;  // Use these GIDs
@@ -152,6 +173,7 @@ struct MDSCapMatch {
   std::string fs_name;
   bool root_squash=false;
 };
+WRITE_CLASS_ENCODER(MDSCapMatch)
 
 struct MDSCapGrant {
   MDSCapGrant(const MDSCapSpec &spec_, const MDSCapMatch &match_,