[libvirt] [PATCH 7/4] virsh: split out virsh-domain-monitor.c

Eric Blake eblake at redhat.com
Mon Aug 20 13:58:55 UTC 2012


Another file worth compiling on its own instead of by .c inclusion.

* tools/virsh-domain-monitor.h: New file.
* tools/Makefile.am (virsh_SOURCES): Build it.
* tools/virsh.h (vshGetDomainDescription): Move to correct
header.
* tools/virsh-domain-monitor.c: Use new header.
* tools/virsh.c: Likewise.
* tools/virsh-domain.c: Likewise.
---
 tools/Makefile.am            |  2 +-
 tools/virsh-domain-monitor.c | 15 ++++++++++++++-
 tools/virsh-domain-monitor.h | 37 +++++++++++++++++++++++++++++++++++++
 tools/virsh-domain.c         |  1 +
 tools/virsh.c                |  2 +-
 tools/virsh.h                |  3 ---
 6 files changed, 54 insertions(+), 6 deletions(-)
 create mode 100644 tools/virsh-domain-monitor.h

diff --git a/tools/Makefile.am b/tools/Makefile.am
index b885892..6b066f6 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -107,8 +107,8 @@ virsh_SOURCES =							\
 		console.c console.h				\
 		virsh.c virsh.h					\
 		virsh-domain.c virsh-domain.h			\
+		virsh-domain-monitor.c virsh-domain-monitor.h	\
 		$(NULL)
-#		virsh-domain-monitor.c virsh-domain-monitor.h	\
 #		virsh-host.c virsh-host.h			\
 #		virsh-interface.c virsh-interface.h		\
 #		virsh-network.c virsh-network.h			\
diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c
index 52e44c9..4f00e65 100644
--- a/tools/virsh-domain-monitor.c
+++ b/tools/virsh-domain-monitor.c
@@ -23,7 +23,20 @@
  *
  */

+#include <config.h>
+#include "virsh-domain-monitor.h"
+
+#include <libxml/parser.h>
+#include <libxml/tree.h>
+#include <libxml/xpath.h>
+#include <libxml/xmlsave.h>
+
+#include "internal.h"
+#include "conf/domain_conf.h"
 #include "intprops.h"
+#include "memory.h"
+#include "virmacaddr.h"
+#include "xml.h"

 static const char *
 vshDomainIOErrorToString(int error)
@@ -1683,7 +1696,7 @@ cleanup:
 }
 #undef FILTER

-static const vshCmdDef domMonitoringCmds[] = {
+const vshCmdDef domMonitoringCmds[] = {
     {"domblkerror", cmdDomBlkError, opts_domblkerror, info_domblkerror, 0},
     {"domblkinfo", cmdDomblkinfo, opts_domblkinfo, info_domblkinfo, 0},
     {"domblklist", cmdDomblklist, opts_domblklist, info_domblklist, 0},
diff --git a/tools/virsh-domain-monitor.h b/tools/virsh-domain-monitor.h
new file mode 100644
index 0000000..e322006
--- /dev/null
+++ b/tools/virsh-domain-monitor.h
@@ -0,0 +1,37 @@
+/*
+ * virsh-domain-monitor.h: Commands to monitor domain status
+ *
+ * Copyright (C) 2005, 2007-2012 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library;  If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ *  Daniel Veillard <veillard at redhat.com>
+ *  Karel Zak <kzak at redhat.com>
+ *  Daniel P. Berrange <berrange at redhat.com>
+ *
+ */
+
+#ifndef VIRSH_DOMAIN_MONITOR_H
+# define VIRSH_DOMAIN_MONITOR_H
+
+# include "virsh.h"
+
+char *vshGetDomainDescription(vshControl *ctl, virDomainPtr dom,
+                              bool title, unsigned int flags)
+    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
+
+extern const vshCmdDef domMonitoringCmds[];
+
+#endif /* VIRSH_DOMAIN_MONITOR_H */
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index d102378..bf707c4 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -48,6 +48,7 @@
 #include "virfile.h"
 #include "virkeycode.h"
 #include "virmacaddr.h"
+#include "virsh-domain-monitor.h"
 #include "virterror_internal.h"
 #include "virtypedparam.h"
 #include "xml.h"
diff --git a/tools/virsh.c b/tools/virsh.c
index 95a8bf6..89ccdb1 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -79,6 +79,7 @@
 #include "virtypedparam.h"

 #include "virsh-domain.h"
+#include "virsh-domain-monitor.h"

 static char *progname;

@@ -2870,7 +2871,6 @@ vshParseArgv(vshControl *ctl, int argc, char **argv)
     return true;
 }

-#include "virsh-domain-monitor.c"
 #include "virsh-host.c"
 #include "virsh-interface.c"
 #include "virsh-network.c"
diff --git a/tools/virsh.h b/tools/virsh.h
index 764369e..24d2020 100644
--- a/tools/virsh.h
+++ b/tools/virsh.h
@@ -286,9 +286,6 @@ int vshCommandOptScaledInt(const vshCmd *cmd, const char *name,
 bool vshCommandOptBool(const vshCmd *cmd, const char *name);
 const vshCmdOpt *vshCommandOptArgv(const vshCmd *cmd,
                                    const vshCmdOpt *opt);
-char *vshGetDomainDescription(vshControl *ctl, virDomainPtr dom,
-                              bool title, unsigned int flags)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;

 # define VSH_BYID     (1 << 1)
 # define VSH_BYUUID   (1 << 2)
-- 
1.7.11.4




More information about the libvir-list mailing list