]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
common: dumpers for ceph_{file,dir}_layout
authorSage Weil <sage@inktank.com>
Mon, 12 Nov 2012 19:03:33 +0000 (11:03 -0800)
committerSage Weil <sage@inktank.com>
Mon, 12 Nov 2012 23:05:52 +0000 (15:05 -0800)
Signed-off-by: Sage Weil <sage@inktank.com>
src/Makefile.am
src/common/types.cc [new file with mode: 0644]
src/include/types.h

index c97fc8f4e3a0a70966f19cf154bc046a294bda88..e599d7c16db6a18f97f7d4ce632543f02a4a6d75 100644 (file)
@@ -1181,6 +1181,7 @@ libcommon_files = \
        common/admin_socket.cc \
        common/admin_socket_client.cc \
        common/escape.c \
+       common/types.cc \
        common/Clock.cc \
        common/Throttle.cc \
        common/Timer.cc \
diff --git a/src/common/types.cc b/src/common/types.cc
new file mode 100644 (file)
index 0000000..c5482e1
--- /dev/null
@@ -0,0 +1,23 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- 
+// vim: ts=8 sw=2 smarttab
+
+#include "include/types.h"
+#include "common/Formatter.h"
+
+void dump(const ceph_file_layout& l, Formatter *f)
+{
+  f->dump_unsigned("stripe_unit", l.fl_stripe_unit);
+  f->dump_unsigned("stripe_count", l.fl_stripe_count);
+  f->dump_unsigned("object_size", l.fl_object_size);
+  if (l.fl_cas_hash)
+    f->dump_unsigned("cas_hash", l.fl_cas_hash);
+  if (l.fl_object_stripe_unit)
+    f->dump_unsigned("object_stripe_unit", l.fl_object_stripe_unit);
+  if (l.fl_pg_pool)
+    f->dump_unsigned("pg_pool", l.fl_pg_pool);
+}
+
+void dump(const ceph_dir_layout& dl, Formatter *f)
+{
+  f->dump_unsigned("dir_hash", dl.dl_dir_hash);
+}
index 4f82f31fe5821748a19202039bfc870e946fd010..c783b6e93ce9866f002a0f6ddaa8613f2320d21f 100644 (file)
@@ -353,6 +353,13 @@ static inline bool file_mode_is_readonly(int mode) {
 // dentries
 #define MAX_DENTRY_LEN 255
 
+// --
+namespace ceph {
+  class Formatter;
+}
+void dump(const ceph_file_layout& l, ceph::Formatter *f);
+void dump(const ceph_dir_layout& l, ceph::Formatter *f);
+
 
 // --