From 9f59a1edf08a601039109cc1e83b969feb90baff Mon Sep 17 00:00:00 2001 From: Greg Farnum Date: Tue, 16 Mar 2010 09:34:19 -0700 Subject: [PATCH] mon: add encode/decode functions to MonCaps --- src/mon/MonCaps.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/mon/MonCaps.h b/src/mon/MonCaps.h index c7fdad28abf2b..63cb76e5e78d3 100644 --- a/src/mon/MonCaps.h +++ b/src/mon/MonCaps.h @@ -23,6 +23,7 @@ #define __MONCAPS_H #include "include/types.h" +//#include "" #define MON_CAP_R 0x1 #define MON_CAP_W 0x2 @@ -38,7 +39,18 @@ struct MonCap { rwx_t allow; rwx_t deny; MonCap() : allow(0), deny(0) {} + + void encode(bufferlist& bl) const { + ::encode(allow, bl); + ::encode(deny, bl); + } + + void decode(bufferlist::iterator& bl) { + ::decode(allow, bl); + ::decode(deny, bl); + } }; +WRITE_RAW_ENCODER(MonCap); struct MonCaps { string text; @@ -59,8 +71,28 @@ public: __u64 auid=CEPH_AUTH_UID_DEFAULT); void set_allow_all(bool allow) { allow_all = allow; } void set_auid(__u64 uid) { auid = uid; } + + void encode(bufferlist& bl) const { + ::encode(text, bl); + ::encode(default_action, bl); + ::encode(services_map, bl); + ::encode(pool_auid_map, bl); + ::encode(allow_all, bl); + ::encode(auid, bl); + } + + void decode(bufferlist::iterator& bl) { + ::decode(text, bl); + ::decode(default_action, bl); + ::decode(services_map, bl); + ::decode(pool_auid_map, bl); + ::decode(allow_all, bl); + ::decode(auid, bl); + } }; +WRITE_CLASS_ENCODER(MonCaps); + inline ostream& operator<<(ostream& out, const MonCaps& m) { return out << m.get_str(); } -- 2.39.5