From 45a0bc103cd4d5863df815187692008d5323014d Mon Sep 17 00:00:00 2001 From: John Spray Date: Wed, 6 Apr 2016 12:42:36 +0100 Subject: [PATCH] mds: add operator<< for file_layout_t Signed-off-by: John Spray --- src/common/fs_types.cc | 9 +++++++++ src/include/fs_types.h | 2 ++ 2 files changed, 11 insertions(+) diff --git a/src/common/fs_types.cc b/src/common/fs_types.cc index 741e4f12331..95e9b389a2e 100644 --- a/src/common/fs_types.cc +++ b/src/common/fs_types.cc @@ -122,3 +122,12 @@ void file_layout_t::generate_test_instances(list& o) o.back()->pool_id = 3; o.back()->pool_ns = "myns"; } + +ostream& operator<<(ostream& out, const file_layout_t &layout) +{ + JSONFormatter f; + layout.dump(&f); + f.flush(out); + return out; +} + diff --git a/src/include/fs_types.h b/src/include/fs_types.h index 388508b1d5e..c9271cca058 100644 --- a/src/include/fs_types.h +++ b/src/include/fs_types.h @@ -103,4 +103,6 @@ WRITE_CLASS_ENCODER_FEATURES(file_layout_t) WRITE_EQ_OPERATORS_5(file_layout_t, stripe_unit, stripe_count, object_size, pool_id, pool_ns); +ostream& operator<<(ostream& out, const file_layout_t &layout); + #endif -- 2.47.3