]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: client_writeable_range_t now uses modern encoding
authorGreg Farnum <greg@inktank.com>
Thu, 17 Jan 2013 18:28:15 +0000 (10:28 -0800)
committerGreg Farnum <greg@inktank.com>
Tue, 5 Feb 2013 21:29:05 +0000 (13:29 -0800)
Signed-off-by: Sage Weil <sage@inktank.com>
Signed-off-by: Greg Farnum <greg@inktank.com>
src/mds/mdstypes.cc
src/mds/mdstypes.h
src/test/encoding/types.h

index cb8a69e8197259572a83fca0676c393fe60f8451..f27d769fd73f79a6a0ffef99a2a689b55578c8cd 100644 (file)
@@ -182,3 +182,45 @@ ostream& operator<<(ostream &out, const nest_info_t &n)
   return out;
 }
 
+
+/*
+ * client_writeable_range_t
+ */
+
+void client_writeable_range_t::encode(bufferlist &bl) const
+{
+  ENCODE_START(2, 2, bl);
+  ::encode(range, bl);
+  ::encode(follows, bl);
+  ENCODE_FINISH(bl);
+}
+
+void client_writeable_range_t::decode(bufferlist::iterator& bl)
+{
+  DECODE_START_LEGACY_COMPAT_LEN(2, 2, 2, bl);
+  ::decode(range, bl);
+  ::decode(follows, bl);
+  DECODE_FINISH(bl);
+}
+
+void client_writeable_range_t::dump(Formatter *f) const
+{
+  f->dump_unsigned("first", range.first);
+  f->dump_unsigned("last", range.last);
+  f->dump_unsigned("follows", follows);
+}
+
+void client_writeable_range_t::generate_test_instances(list<client_writeable_range_t*>& ls)
+{
+  ls.push_back(new client_writeable_range_t);
+  ls.push_back(new client_writeable_range_t);
+  ls.back()->range.first = 123;
+  ls.back()->range.last = 456;
+  ls.back()->follows = 12;
+}
+
+ostream& operator<<(ostream& out, const client_writeable_range_t& r)
+{
+  return out << r.range << "@" << r.follows;
+}
+
index 8cce66f9a6977631aa6eb6c7263fcb29df5095a9..8435a59e4b5babd3eb398b862d1bcfbb8788b82d 100644 (file)
@@ -307,29 +307,24 @@ inline bool operator==(const byte_range_t& l, const byte_range_t& r) {
 }
 
 
+/*
+ * client_writeable_range_t
+ */
 struct client_writeable_range_t {
   byte_range_t range;
   snapid_t follows;     // aka "data+metadata flushed thru"
 
-  void encode(bufferlist &bl) const {
-    __u8 v = 1;
-    ::encode(v, bl);
-    ::encode(range, bl);
-    ::encode(follows, bl);
-  }
-  void decode(bufferlist::iterator& bl) {
-    __u8 v;
-    ::decode(v, bl);
-    ::decode(range, bl);
-    ::decode(follows, bl);
-  }
+  client_writeable_range_t() : follows(0) {}
+
+  void encode(bufferlist &bl) const;
+  void decode(bufferlist::iterator& bl);
+  void dump(Formatter *f) const;
+  static void generate_test_instances(list<client_writeable_range_t*>& ls);
 };
 WRITE_CLASS_ENCODER(client_writeable_range_t)
 
-inline ostream& operator<<(ostream& out, const client_writeable_range_t& r)
-{
-  return out << r.range << "@" << r.follows;
-}
+ostream& operator<<(ostream& out, const client_writeable_range_t& r);
+
 inline bool operator==(const client_writeable_range_t& l, const client_writeable_range_t& r) {
   return l.range == r.range && l.follows == r.follows;
 }
index 28940f79962c503441e58129d34542accd9d03b0..ebe3d69611aae694a6e866614ece7bf25b2fa1bb 100644 (file)
@@ -100,6 +100,7 @@ TYPE(sr_t)*/
 TYPE(file_layout_policy_t)
 TYPE(frag_info_t)
 TYPE(nest_info_t)
+TYPE(client_writeable_range_t)
 
 #ifdef WITH_RADOSGW