]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-dencoder: filepath
authorSage Weil <sage.weil@dreamhost.com>
Mon, 6 Feb 2012 05:28:17 +0000 (21:28 -0800)
committerSage Weil <sage@newdream.net>
Mon, 6 Feb 2012 21:34:05 +0000 (13:34 -0800)
Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
src/include/filepath.h
src/test/encoding/types.h

index f26235e280e6650b19fcea856d1199635424e763..884707591977c9e80e1d48555b10a90e37d7aef9 100644 (file)
@@ -16,7 +16,6 @@
 #ifndef CEPH_FILEPATH_H
 #define CEPH_FILEPATH_H
 
-
 /*
  * BUG:  /a/b/c is equivalent to a/b/c in dentry-breakdown, but not string.
  *   -> should it be different?  how?  should this[0] be "", with depth 4?
@@ -32,6 +31,9 @@ using namespace std;
 #include "buffer.h"
 #include "encoding.h"
 
+#include "common/Formatter.h"
+
+
 class filepath {
   inodeno_t ino;   // base inode.  ino=0 implies pure relative path.
   string path;     // relative path.
@@ -195,6 +197,17 @@ class filepath {
     ::decode(path, blp);
     encoded = true;
   }
+  void dump(Formatter *f) const {
+    f->dump_unsigned("base_ino", ino);
+    f->dump_string("relative_path", path);
+  }
+  static void generate_test_instances(list<filepath*>& o) {
+    o.push_back(new filepath);
+    o.push_back(new filepath("/usr/bin", 0));
+    o.push_back(new filepath("/usr/sbin", 1));
+    o.push_back(new filepath("var/log", 1));
+    o.push_back(new filepath("foo/bar", 101));
+  }
 };
 
 WRITE_CLASS_ENCODER(filepath)
index 86c99682be97d1f8d6183b64f87149f6e30cdb23..f2cda3fd3e448f372cbb06e8a8ef1a5e194f094a 100644 (file)
@@ -1,6 +1,9 @@
 #include "include/CompatSet.h"
 TYPE(CompatSet)
 
+#include "include/filepath.h"
+TYPE(filepath)
+
 #include "msg/msg_types.h"
 TYPE(entity_name_t)
 TYPE(entity_addr_t)