diff --git a/src/common/StackStringStream.h b/src/common/StackStringStream.h index 5eaea7e8d6b..c59f7d820c1 100644 --- a/src/common/StackStringStream.h +++ b/src/common/StackStringStream.h @@ -128,14 +128,17 @@ public: } } - sss& get_stream() { + sss& operator*() { return *osp; } - const sss& get_stream() const { + sss const& operator*() const { return *osp; } - std::string_view strv() const { - return osp->strv(); + sss* operator->() { + return osp.get(); + } + sss const* operator->() const { + return osp.get(); } private: diff --git a/src/log/Entry.h b/src/log/Entry.h index 2753b1942b5..a8479b53bee 100644 --- a/src/log/Entry.h +++ b/src/log/Entry.h @@ -62,14 +62,14 @@ public: ~MutableEntry() override = default; std::ostream& get_ostream() { - return cos.get_stream(); + return *cos; } std::string_view strv() const override { - return cos.get_stream().strv(); + return cos->strv(); } std::size_t size() const override { - return cos.get_stream().strv().size(); + return cos->strv().size(); } private: diff --git a/src/mds/MDSRank.cc b/src/mds/MDSRank.cc index a7bb5a50cfd..5a8e540c9d2 100644 --- a/src/mds/MDSRank.cc +++ b/src/mds/MDSRank.cc @@ -2948,9 +2948,9 @@ bool MDSRank::command_dirfrag_ls( f->open_object_section("frag"); f->dump_int("value", leaf.value()); f->dump_int("bits", leaf.bits()); - CachedStackStringStream ss; - ss.get_stream() << std::hex << leaf.value() << "/" << std::dec << leaf.bits(); - f->dump_string("str", ss.strv()); + CachedStackStringStream css; + *css << std::hex << leaf.value() << "/" << std::dec << leaf.bits(); + f->dump_string("str", css->strv()); f->close_section(); } f->close_section(); @@ -3199,12 +3199,11 @@ bool MDSRank::evict_client(int64_t session_id, auto& addr = session->info.inst.addr; { - CachedStackStringStream _ss; - auto& ss = _ss.get_stream(); - ss << "Evicting " << (blacklist ? "(and blacklisting) " : "") - << "client session " << session_id << " (" << addr << ")"; - dout(1) << ss.strv() << dendl; - clog->info() << ss.strv(); + CachedStackStringStream css; + *css << "Evicting " << (blacklist ? "(and blacklisting) " : "") + << "client session " << session_id << " (" << addr << ")"; + dout(1) << css->strv() << dendl; + clog->info() << css->strv(); } dout(4) << "Preparing blacklist command... (wait=" << wait << ")" << dendl;