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.
This commit is contained in:
Eric Blake 2012-08-20 07:46:38 -06:00
parent 2f8a09fbce
commit 99ae57f841
6 changed files with 54 additions and 6 deletions

View File

@ -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 \

View File

@ -23,7 +23,20 @@
*
*/
#include <config.h>
#include "virsh-domain-monitor.h"
#include <libxml/parser.h>
#include <libxml/tree.h>
#include <libxml/xpath.h>
#include <libxml/xmlsave.h>
#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},

View File

@ -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
* <http://www.gnu.org/licenses/>.
*
* Daniel Veillard <veillard@redhat.com>
* Karel Zak <kzak@redhat.com>
* Daniel P. Berrange <berrange@redhat.com>
*
*/
#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 */

View File

@ -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"

View File

@ -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"

View File

@ -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)