aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/Makefile.am2
-rw-r--r--tools/virsh-nodedev.c16
-rw-r--r--tools/virsh-nodedev.h33
-rw-r--r--tools/virsh.c8
-rw-r--r--tools/virsh.h6
5 files changed, 57 insertions, 8 deletions
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 595d64a66..0b3e08048 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -111,8 +111,8 @@ virsh_SOURCES = \
virsh-host.c virsh-host.h \
virsh-interface.c virsh-interface.h \
virsh-network.c virsh-network.h \
+ virsh-nodedev.c virsh-nodedev.h \
$(NULL)
-# virsh-nodedev.c virsh-nodedev.h \
# virsh-nwfilter.c virsh-nwfilter.h \
# virsh-pool.c virsh-pool.h \
# virsh-secret.c virsh-secret.h \
diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c
index 1398fbdfc..bcdc3d8f9 100644
--- a/tools/virsh-nodedev.c
+++ b/tools/virsh-nodedev.c
@@ -23,6 +23,20 @@
*
*/
+#include <config.h>
+#include "virsh-nodedev.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"
+
/*
* "nodedev-create" command
*/
@@ -381,7 +395,7 @@ cmdNodeDeviceReset(vshControl *ctl, const vshCmd *cmd)
return ret;
}
-static const vshCmdDef nodedevCmds[] = {
+const vshCmdDef nodedevCmds[] = {
{"nodedev-create", cmdNodeDeviceCreate, opts_node_device_create,
info_node_device_create, 0},
{"nodedev-destroy", cmdNodeDeviceDestroy, opts_node_device_destroy,
diff --git a/tools/virsh-nodedev.h b/tools/virsh-nodedev.h
new file mode 100644
index 000000000..fa3cf4f89
--- /dev/null
+++ b/tools/virsh-nodedev.h
@@ -0,0 +1,33 @@
+/*
+ * virsh-nodedev.h: Commands in node device 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@redhat.com>
+ * Karel Zak <kzak@redhat.com>
+ * Daniel P. Berrange <berrange@redhat.com>
+ *
+ */
+
+#ifndef VIRSH_NODEDEV_H
+# define VIRSH_NODEDEV_H
+
+# include "virsh.h"
+
+extern const vshCmdDef nodedevCmds[];
+
+#endif /* VIRSH_NODEDEV_H */
diff --git a/tools/virsh.c b/tools/virsh.c
index 2a9c673a2..364ca2586 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -79,6 +79,7 @@
#include "virsh-host.h"
#include "virsh-interface.h"
#include "virsh-network.h"
+#include "virsh-nodedev.h"
static char *progname;
@@ -416,10 +417,6 @@ cmdHelp(vshControl *ctl, const vshCmd *cmd)
/* Tree listing helpers. */
-/* Given an index, return either the name of that device (non-NULL) or
- * of its parent (NULL if a root). */
-typedef const char * (*vshTreeLookup)(int devid, bool parent, void *opaque);
-
static int
vshTreePrintInternal(vshControl *ctl,
vshTreeLookup lookup,
@@ -487,7 +484,7 @@ cleanup:
return ret;
}
-static int
+int
vshTreePrint(vshControl *ctl, vshTreeLookup lookup, void *opaque,
int num_devices, int devid)
{
@@ -2817,7 +2814,6 @@ vshParseArgv(vshControl *ctl, int argc, char **argv)
return true;
}
-#include "virsh-nodedev.c"
#include "virsh-nwfilter.c"
#include "virsh-pool.c"
#include "virsh-secret.c"
diff --git a/tools/virsh.h b/tools/virsh.h
index 818d51546..698899d0d 100644
--- a/tools/virsh.h
+++ b/tools/virsh.h
@@ -296,6 +296,12 @@ typedef enum {
VSH_BYMAC = (1 << 4),
} vshLookupByFlags;
+/* Given an index, return either the name of that device (non-NULL) or
+ * of its parent (NULL if a root). */
+typedef const char * (*vshTreeLookup)(int devid, bool parent, void *opaque);
+int vshTreePrint(vshControl *ctl, vshTreeLookup lookup, void *opaque,
+ int num_devices, int devid);
+
void vshPrintExtra(vshControl *ctl, const char *format, ...)
ATTRIBUTE_FMT_PRINTF(2, 3);
void vshDebug(vshControl *ctl, int level, const char *format, ...)