From 99ae57f8418a45991a8c41b9f0dcb52218fc19a4 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Mon, 20 Aug 2012 07:46:38 -0600 Subject: [PATCH] virsh: split out virsh-domain-monitor.c 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 b8858920cc..6b066f63bc 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 52e44c9275..4f00e65867 100644 --- a/tools/virsh-domain-monitor.c +++ b/tools/virsh-domain-monitor.c @@ -23,7 +23,20 @@ * */ +#include +#include "virsh-domain-monitor.h" + +#include +#include +#include +#include + +#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 0000000000..e322006c06 --- /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 + * . + * + * Daniel Veillard + * Karel Zak + * Daniel P. Berrange + * + */ + +#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 94ac1aa886..e949dcffab 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 904ff33ccb..fb1af42b9d 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -75,6 +75,7 @@ #include "virtypedparam.h" #include "virsh-domain.h" +#include "virsh-domain-monitor.h" static char *progname; @@ -2861,7 +2862,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 764369e982..24d2020f41 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)