The splits are getting easier, with fewer cleanups needed in virsh.h.
* tools/virsh-host.h: New file.
* tools/Makefile.am (virsh_SOURCES): Build it.
* tools/virsh-host.c: Use new header.
* tools/virsh.c: Likewise.
---
tools/Makefile.am | 2 +-
tools/virsh-host.c | 16 +++++++++++++++-
tools/virsh-host.h | 33 +++++++++++++++++++++++++++++++++
tools/virsh.c | 2 +-
4 files changed, 50 insertions(+), 3 deletions(-)
create mode 100644 tools/virsh-host.h
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 6b066f6..a3e5ff4 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -108,8 +108,8 @@ virsh_SOURCES = \
virsh.c virsh.h \
virsh-domain.c virsh-domain.h \
virsh-domain-monitor.c virsh-domain-monitor.h \
+ virsh-host.c virsh-host.h \
$(NULL)
-# virsh-host.c virsh-host.h \
# virsh-interface.c virsh-interface.h \
# virsh-network.c virsh-network.h \
# virsh-nodedev.c virsh-nodedev.h \
diff --git a/tools/virsh-host.c b/tools/virsh-host.c
index b09d9f9..e3cff8e 100644
--- a/tools/virsh-host.c
+++ b/tools/virsh-host.c
@@ -23,6 +23,20 @@
*
*/
+#include <config.h>
+#include "virsh-host.h"
+
+#include <libxml/parser.h>
+#include <libxml/tree.h>
+#include <libxml/xpath.h>
+#include <libxml/xmlsave.h>
+
+#include "internal.h"
+#include "buf.h"
+#include "memory.h"
+#include "util.h"
+#include "xml.h"
+
/*
* "capabilities" command
*/
@@ -819,7 +833,7 @@ cmdVersion(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
return true;
}
-static const vshCmdDef hostAndHypervisorCmds[] = {
+const vshCmdDef hostAndHypervisorCmds[] = {
{"capabilities", cmdCapabilities, NULL, info_capabilities, 0},
{"connect", cmdConnect, opts_connect, info_connect,
VSH_CMD_FLAG_NOCONNECT},
diff --git a/tools/virsh-host.h b/tools/virsh-host.h
new file mode 100644
index 0000000..8242f91
--- /dev/null
+++ b/tools/virsh-host.h
@@ -0,0 +1,33 @@
+/*
+ * virsh-host.h: Commands in "Host and Hypervisor" group.
+ *
+ * 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(a)redhat.com>
+ * Karel Zak <kzak(a)redhat.com>
+ * Daniel P. Berrange <berrange(a)redhat.com>
+ *
+ */
+
+#ifndef VIRSH_HOST_H
+# define VIRSH_HOST_H
+
+# include "virsh.h"
+
+extern const vshCmdDef hostAndHypervisorCmds[];
+
+#endif /* VIRSH_HOST_H */
diff --git a/tools/virsh.c b/tools/virsh.c
index fb1af42..793a357 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -76,6 +76,7 @@
#include "virsh-domain.h"
#include "virsh-domain-monitor.h"
+#include "virsh-host.h"
static char *progname;
@@ -2862,7 +2863,6 @@ vshParseArgv(vshControl *ctl, int argc, char **argv)
return true;
}
-#include "virsh-host.c"
#include "virsh-interface.c"
#include "virsh-network.c"
#include "virsh-nodedev.c"
--
1.7.11.4