]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/osd: improve the const correctness 36857/head
authorKefu Chai <kchai@redhat.com>
Thu, 27 Aug 2020 14:22:04 +0000 (22:22 +0800)
committerKefu Chai <kchai@redhat.com>
Mon, 31 Aug 2020 13:18:13 +0000 (21:18 +0800)
it should suffice to pass a `const OSD&` to the ctor of `OsdStatusHook`

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/crimson/admin/osd_admin.cc
src/crimson/osd/osd.cc

index 5f7c987fd25bb5d9ad02ac56e6e7d98e8546a0b1..4848897f290e2bdf3a18442dfc4f9f330f43358c 100644 (file)
@@ -34,7 +34,7 @@ std::unique_ptr<AdminSocketHook> make_asok_hook(Args&&... args)
  */
 class OsdStatusHook : public AdminSocketHook {
 public:
-  explicit OsdStatusHook(crimson::osd::OSD& osd) :
+  explicit OsdStatusHook(const crimson::osd::OSD& osd) :
     AdminSocketHook{"status", "", "OSD status"},
     osd(osd)
   {}
@@ -49,10 +49,10 @@ public:
     return seastar::make_ready_future<tell_result_t>(f.get());
   }
 private:
-  crimson::osd::OSD& osd;
+  const crimson::osd::OSD& osd;
 };
 template std::unique_ptr<AdminSocketHook>
-make_asok_hook<OsdStatusHook>(crimson::osd::OSD& osd);
+make_asok_hook<OsdStatusHook>(const crimson::osd::OSD& osd);
 
 /**
  * An OSD admin hook: send beacon
index 68e7d56f46e92de6f882651662d466697154d3ee..84bdf114b3e2221a0a432d99990c88bab3251393 100644 (file)
@@ -427,7 +427,7 @@ seastar::future<> OSD::start_asok_admin()
   return asok->start(asok_path).then([this] {
     return seastar::when_all_succeed(
       asok->register_admin_commands(),
-      asok->register_command(make_asok_hook<OsdStatusHook>(*this)),
+      asok->register_command(make_asok_hook<OsdStatusHook>(std::as_const(*this))),
       asok->register_command(make_asok_hook<SendBeaconHook>(*this)),
       asok->register_command(make_asok_hook<FlushPgStatsHook>(*this)),
       asok->register_command(make_asok_hook<DumpPGStateHistory>(std::as_const(*this))));