From: Xiubo Li Date: Tue, 20 Dec 2022 04:30:09 +0000 (+0800) Subject: mds: encode/decode the MDSCapMatch X-Git-Tag: testing/wip-pdonnell-testing-20240430.123648-reef-debug~91^2~23 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2685602850d288c9857b66a1eee32884c05793a8;p=ceph-ci.git mds: encode/decode the MDSCapMatch Will send this to clients. Fixes: https://tracker.ceph.com/issues/57154 Signed-off-by: Xiubo Li (cherry picked from commit 53caf313957b414ab7fcc77ff23bd1470cca1724) --- diff --git a/src/mds/MDSAuthCaps.h b/src/mds/MDSAuthCaps.h index ba4b369a61b..266bc27c7e8 100644 --- a/src/mds/MDSAuthCaps.h +++ b/src/mds/MDSAuthCaps.h @@ -19,6 +19,7 @@ #include #include +#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 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_,