]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: add encode/decode functions to MonCaps
authorGreg Farnum <gregf@hq.newdream.net>
Tue, 16 Mar 2010 16:34:19 +0000 (09:34 -0700)
committerGreg Farnum <gregf@hq.newdream.net>
Tue, 16 Mar 2010 18:18:26 +0000 (11:18 -0700)
src/mon/MonCaps.h

index c7fdad28abf2bb30f3782884402df57d767cf368..63cb76e5e78d3f2ea57ae713b984ee318508e2d4 100644 (file)
@@ -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();
 }