From 45be7663899a80f001e9db1f887595551ba6c773 Mon Sep 17 00:00:00 2001 From: Varsha Rao Date: Mon, 14 Oct 2019 23:04:42 +0530 Subject: [PATCH] mds: Reorganize class members in MDSAuthCaps header Fixes: https://tracker.ceph.com/issues/42311 Signed-off-by: Varsha Rao --- src/mds/MDSAuthCaps.h | 39 ++++++++++++++++++--------------------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/src/mds/MDSAuthCaps.h b/src/mds/MDSAuthCaps.h index cc1006cdf669e..36c7130cd22b1 100644 --- a/src/mds/MDSAuthCaps.h +++ b/src/mds/MDSAuthCaps.h @@ -11,8 +11,6 @@ * Foundation. See file COPYING. * */ - - #ifndef MDS_AUTH_CAPS_H #define MDS_AUTH_CAPS_H @@ -35,8 +33,6 @@ enum { MAY_SNAPSHOT = (1 << 7), }; -class CephContext; - // what we can do struct MDSCapSpec { static const unsigned ALL = (1 << 0); @@ -92,10 +88,6 @@ private: struct MDSCapMatch { static const int64_t MDS_AUTH_UID_ANY = -1; - int64_t uid; // Require UID to be equal to this, if !=MDS_AUTH_UID_ANY - std::vector gids; // Use these GIDs - std::string path; // Require path to be child of this (may be "" or "/" for any) - MDSCapMatch() : uid(MDS_AUTH_UID_ANY) {} MDSCapMatch(int64_t uid_, std::vector& gids_) : uid(uid_), gids(gids_) {} explicit MDSCapMatch(const std::string &path_) @@ -127,18 +119,13 @@ struct MDSCapMatch { * @param target_path filesystem path without leading '/' */ bool match_path(std::string_view target_path) const; + + int64_t uid; // Require UID to be equal to this, if !=MDS_AUTH_UID_ANY + std::vector gids; // Use these GIDs + std::string path; // Require path to be child of this (may be "" or "/" for any) }; struct MDSCapGrant { - MDSCapSpec spec; - MDSCapMatch match; - - std::string network; - - entity_addr_t network_parsed; - unsigned network_prefix = 0; - bool network_valid = true; - MDSCapGrant(const MDSCapSpec &spec_, const MDSCapMatch &match_, boost::optional n) : spec(spec_), match(match_) { @@ -150,13 +137,21 @@ struct MDSCapGrant { MDSCapGrant() {} void parse_network(); + + MDSCapSpec spec; + MDSCapMatch match; + + std::string network; + + entity_addr_t network_parsed; + unsigned network_prefix = 0; + bool network_valid = true; }; +class CephContext; + class MDSAuthCaps { - CephContext *cct = nullptr; - std::vector grants; - public: MDSAuthCaps() = default; explicit MDSAuthCaps(CephContext *cct_) : cct(cct_) {} @@ -180,9 +175,11 @@ public: bool path_capable(std::string_view inode_path) const; friend std::ostream &operator<<(std::ostream &out, const MDSAuthCaps &cap); +private: + CephContext *cct = nullptr; + std::vector grants; }; - std::ostream &operator<<(std::ostream &out, const MDSCapMatch &match); std::ostream &operator<<(std::ostream &out, const MDSCapSpec &spec); std::ostream &operator<<(std::ostream &out, const MDSCapGrant &grant); -- 2.39.5