]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/MgrContext: move JSONCommand to separate header
authorMax Kellermann <max.kellermann@ionos.com>
Tue, 19 Aug 2025 12:15:00 +0000 (14:15 +0200)
committerMax Kellermann <max.kellermann@ionos.com>
Tue, 16 Sep 2025 10:42:05 +0000 (12:42 +0200)
To reduce header dependency on ceph_json.h.

Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
src/mgr/JSONCommand.h [new file with mode: 0644]
src/mgr/Mgr.cc
src/mgr/MgrContext.h

diff --git a/src/mgr/JSONCommand.h b/src/mgr/JSONCommand.h
new file mode 100644 (file)
index 0000000..2efc8e1
--- /dev/null
@@ -0,0 +1,40 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+/*
+ * Ceph - scalable distributed file system
+ *
+ * Copyright (C) 2016 John Spray <john.spray@redhat.com>
+ *
+ * This is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software
+ * Foundation.  See file COPYING.
+ */
+
+#ifndef MGR_JSON_COMMAND_H_
+#define MGR_JSON_COMMAND_H_
+
+#include "MgrContext.h"
+#include "common/ceph_json.h"
+
+class JSONCommand : public Command
+{
+public:
+  json_spirit::mValue json_result;
+
+  void wait() override
+  {
+    Command::wait();
+
+    if (r == 0) {
+      bool read_ok = json_spirit::read(
+          outbl.to_str(), json_result);
+      if (!read_ok) {
+        r = -EINVAL;
+      }
+    }
+  }
+};
+
+#endif
+
index 0225527c5eda31790a4170976bdceaa851d31a2f..fc9b649f32196f0b34ed7b439b07c3af192b2f93 100644 (file)
@@ -37,6 +37,7 @@
 
 #include "MgrContext.h"
 #include "DaemonServer.h"
+#include "JSONCommand.h"
 #include "PyModule.h"
 #include "Mgr.h"
 
index a5490bef3d6768e7a4b251a728f66522e1d96add..d9fdcab59347ee1235272c8c595e64b4c0a59069 100644 (file)
@@ -16,7 +16,6 @@
 
 #include <memory>
 
-#include "common/ceph_json.h"
 #include "common/Cond.h"
 #include "mon/MonClient.h"
 
@@ -49,25 +48,5 @@ public:
   virtual ~Command() {}
 };
 
-
-class JSONCommand : public Command
-{
-public:
-  json_spirit::mValue json_result;
-
-  void wait() override
-  {
-    Command::wait();
-
-    if (r == 0) {
-      bool read_ok = json_spirit::read(
-          outbl.to_str(), json_result);
-      if (!read_ok) {
-        r = -EINVAL;
-      }
-    }
-  }
-};
-
 #endif