[PATCH 17/4] virsh: split out virsh-snapshot.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Almost done with the splits.

* tools/virsh-snapshot.h: New file.
* tools/Makefile.am (virsh_SOURCES): Build it.
* tools/virsh.c: Use new header.
* tools/virsh-snapshot.c: Likewise.
---
 tools/Makefile.am      |  2 +-
 tools/virsh-snapshot.c | 21 +++++++++++++++++++--
 tools/virsh-snapshot.h | 33 +++++++++++++++++++++++++++++++++
 tools/virsh.c          |  2 +-
 4 files changed, 54 insertions(+), 4 deletions(-)
 create mode 100644 tools/virsh-snapshot.h

diff --git a/tools/Makefile.am b/tools/Makefile.am
index a735022..3cdebab 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -115,8 +115,8 @@ virsh_SOURCES =							\
 		virsh-nwfilter.c virsh-nwfilter.h		\
 		virsh-pool.c virsh-pool.h			\
 		virsh-secret.c virsh-secret.h			\
+		virsh-snapshot.c virsh-snapshot.h		\
 		$(NULL)
-#		virsh-snapshot.c virsh-snapshot.h		\
 #		virsh-volume.c virsh-volume.h			\
 #

diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c
index c480d1b..aff91d3 100644
--- a/tools/virsh-snapshot.c
+++ b/tools/virsh-snapshot.c
@@ -1,5 +1,5 @@
 /*
- * virsh-domain.c: Commands to manage domain snapshot
+ * virsh-snapshot.c: Commands to manage domain snapshot
  *
  * Copyright (C) 2005, 2007-2012 Red Hat, Inc.
  *
@@ -23,6 +23,23 @@
  *
  */

+#include <config.h>
+#include "virsh-snapshot.h"
+
+#include <assert.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 "virsh-domain.h"
+#include "xml.h"
+
 /* Helper for snapshot-create and snapshot-create-as */
 static bool
 vshSnapshotCreate(vshControl *ctl, virDomainPtr dom, const char *buffer,
@@ -1597,7 +1614,7 @@ cleanup:
     return ret;
 }

-static const vshCmdDef snapshotCmds[] = {
+const vshCmdDef snapshotCmds[] = {
     {"snapshot-create", cmdSnapshotCreate, opts_snapshot_create,
      info_snapshot_create, 0},
     {"snapshot-create-as", cmdSnapshotCreateAs, opts_snapshot_create_as,
diff --git a/tools/virsh-snapshot.h b/tools/virsh-snapshot.h
new file mode 100644
index 0000000..97e7811
--- /dev/null
+++ b/tools/virsh-snapshot.h
@@ -0,0 +1,33 @@
+/*
+ * virsh-snapshot.h: Commands to manage domain snapshot
+ *
+ * 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@xxxxxxxxxx>
+ *  Karel Zak <kzak@xxxxxxxxxx>
+ *  Daniel P. Berrange <berrange@xxxxxxxxxx>
+ *
+ */
+
+#ifndef VIRSH_SNAPSHOT_H
+# define VIRSH_SNAPSHOT_H
+
+# include "virsh.h"
+
+extern const vshCmdDef snapshotCmds[];
+
+#endif /* VIRSH_SNAPSHOT_H */
diff --git a/tools/virsh.c b/tools/virsh.c
index a9745d7..8cbdd3e 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -83,6 +83,7 @@
 #include "virsh-nwfilter.h"
 #include "virsh-pool.h"
 #include "virsh-secret.h"
+#include "virsh-snapshot.h"

 static char *progname;

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

-#include "virsh-snapshot.c"
 #include "virsh-volume.c"

 static const vshCmdDef virshCmds[] = {
-- 
1.7.11.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]