//using std::cout;
+#ifdef ENCODE_DUMP
+# include <stdio.h>
+# include <sys/types.h>
+# include <sys/stat.h>
+# include <fcntl.h>
+# define ENCODE_STR(x) #x
+# define ENCODE_STRINGIFY(x) ENCODE_STR(x)
+# define DENC_DUMP_PRE(Type) \
+ char *__denc_dump_pre = p.get_pos();
+# define DENC_DUMP_POST(Type) \
+ do { \
+ static int i = 0; \
+ i++; \
+ int bits = 0; \
+ for (unsigned t = i; t; bits++) \
+ t &= t - 1; \
+ if (bits > 2) \
+ break; \
+ char fn[200]; \
+ snprintf(fn, sizeof(fn), \
+ ENCODE_STRINGIFY(ENCODE_DUMP) "/%s__%d.%x", #Type, \
+ getpid(), i++); \
+ int fd = ::open(fn, O_WRONLY|O_TRUNC|O_CREAT, 0644); \
+ if (fd >= 0) { \
+ size_t len = p.get_pos() - __denc_dump_pre; \
+ int r = ::write(fd, __denc_dump_pre, len); \
+ (void)r; \
+ ::close(fd); \
+ } \
+ } while (0)
+#else
+# define DENC_DUMP_PRE(Type)
+# define DENC_DUMP_POST(Type)
+#endif
+
/*
_denc_friend(*this, p); \
} \
void encode(bufferlist::contiguous_appender& p) const { \
+ DENC_DUMP_PRE(Type); \
_denc_friend(*this, p); \
+ DENC_DUMP_POST(Type); \
} \
void decode(buffer::ptr::iterator& p) { \
_denc_friend(*this, p); \
_denc_friend(*this, p, f); \
} \
void encode(bufferlist::contiguous_appender& p, uint64_t f) const { \
+ DENC_DUMP_PRE(Type); \
_denc_friend(*this, p, f); \
+ DENC_DUMP_POST(Type); \
} \
void decode(buffer::ptr::iterator& p, uint64_t f=0) { \
_denc_friend(*this, p, f); \