From c0dbd5f3521a0dccb6cfcb2cd9cf506e808be7ea Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Mon, 20 Aug 2012 17:29:03 -0600 Subject: [PATCH] virsh: split out virsh-snapshot.c 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 a7350221b6..3cdebab252 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 c480d1b9db..aff91d3a8b 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 +#include "virsh-snapshot.h" + +#include + +#include +#include +#include +#include + +#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 0000000000..97e7811c51 --- /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 + * . + * + * Daniel Veillard + * Karel Zak + * Daniel P. Berrange + * + */ + +#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 a9745d7b32..8cbdd3e848 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[] = {