From 95796a3db97111d05f868605d938dc3e1b35868c Mon Sep 17 00:00:00 2001 From: John Spray Date: Thu, 25 Jun 2015 09:47:46 +0100 Subject: [PATCH] mds: add a ceph_file_layout wrapper for dencoder So that we can decode it from tests. This should go away at some point when encoding of these raw-encoded structures is modernized. Signed-off-by: John Spray --- src/mds/mdstypes.cc | 6 ++++++ src/mds/mdstypes.h | 18 ++++++++++++++++++ src/test/encoding/types.h | 1 + 3 files changed, 25 insertions(+) diff --git a/src/mds/mdstypes.cc b/src/mds/mdstypes.cc index 55257644da9e4..370b11671e97a 100644 --- a/src/mds/mdstypes.cc +++ b/src/mds/mdstypes.cc @@ -1078,3 +1078,9 @@ void MDSCacheObject::dump_states(Formatter *f) const if (state_test(STATE_REJOINUNDEF)) f->dump_string("state", "rejoinundef"); } + +void ceph_file_layout_wrapper::dump(Formatter *f) const +{ + ::dump(static_cast(*this), f); +} + diff --git a/src/mds/mdstypes.h b/src/mds/mdstypes.h index 0bffe4bec9b62..55fd69eeb2689 100644 --- a/src/mds/mdstypes.h +++ b/src/mds/mdstypes.h @@ -1577,7 +1577,25 @@ inline std::ostream& operator<<(std::ostream& out, mdsco_db_line_prefix o) { return out; } +class ceph_file_layout_wrapper : public ceph_file_layout +{ +public: + void encode(bufferlist &bl) const + { + ::encode(static_cast(*this), bl); + } + + void decode(bufferlist::iterator &p) + { + ::decode(static_cast(*this), p); + } + + static void generate_test_instances(std::list& ls) + { + } + void dump(Formatter *f) const; +}; diff --git a/src/test/encoding/types.h b/src/test/encoding/types.h index cb06b15f32e80..dccce4bdc583d 100644 --- a/src/test/encoding/types.h +++ b/src/test/encoding/types.h @@ -169,6 +169,7 @@ TYPE(cap_reconnect_t) TYPE(inode_backtrace_t) TYPE(inode_backpointer_t) TYPE(quota_info_t) +TYPE(ceph_file_layout_wrapper) #include "mds/CInode.h" TYPE(InodeStore) -- 2.39.5