From 7b91dc3ecd97d8efca6d049d8a85db1a828124ae Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A1n=20Tomko?= Date: Tue, 11 Mar 2014 11:59:58 +0100 Subject: [PATCH] Introduce vircommandpriv.h for functions used by tests So far it's just virCommandSetDryRun. --- src/Makefile.am | 2 +- src/util/vircommand.c | 3 ++- src/util/vircommand.h | 2 -- src/util/vircommandpriv.h | 32 ++++++++++++++++++++++++++++++++ tests/virkmodtest.c | 3 ++- tests/virnetdevbandwidthtest.c | 3 ++- 6 files changed, 39 insertions(+), 6 deletions(-) create mode 100644 src/util/vircommandpriv.h diff --git a/src/Makefile.am b/src/Makefile.am index a88b258b72..25b33a7f03 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -91,7 +91,7 @@ UTIL_SOURCES = \ util/virbuffer.c util/virbuffer.h \ util/vircgroup.c util/vircgroup.h util/vircgrouppriv.h \ util/virclosecallbacks.c util/virclosecallbacks.h \ - util/vircommand.c util/vircommand.h \ + util/vircommand.c util/vircommand.h util/vircommandpriv.h \ util/virconf.c util/virconf.h \ util/vircrypto.c util/vircrypto.h \ util/virdbus.c util/virdbus.h util/virdbuspriv.h \ diff --git a/src/util/vircommand.c b/src/util/vircommand.c index db4166f521..fd7b713807 100644 --- a/src/util/vircommand.c +++ b/src/util/vircommand.c @@ -40,7 +40,8 @@ # include #endif -#include "vircommand.h" +#define __VIR_COMMAND_PRIV_H_ALLOW__ +#include "vircommandpriv.h" #include "viralloc.h" #include "virerror.h" #include "virutil.h" diff --git a/src/util/vircommand.h b/src/util/vircommand.h index 7485edcaeb..10b4fa22a4 100644 --- a/src/util/vircommand.h +++ b/src/util/vircommand.h @@ -186,6 +186,4 @@ void virCommandAbort(virCommandPtr cmd); void virCommandFree(virCommandPtr cmd); void virCommandDoAsyncIO(virCommandPtr cmd); - -void virCommandSetDryRun(virBufferPtr buf); #endif /* __VIR_COMMAND_H__ */ diff --git a/src/util/vircommandpriv.h b/src/util/vircommandpriv.h new file mode 100644 index 0000000000..80247b2efd --- /dev/null +++ b/src/util/vircommandpriv.h @@ -0,0 +1,32 @@ +/* + * vircommandpriv.h: Functions for testing virCommand APIs + * + * Copyright (C) 2014 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 + * . + * + */ + +#ifndef __VIR_COMMAND_PRIV_H_ALLOW__ +# error "vircommandpriv.h may only be included by vircommand.c or test suites" +#endif + +#ifndef __VIR_COMMAND_PRIV_H__ +# define __VIR_COMMAND_PRIV_H__ + +# include "vircommand.h" + +void virCommandSetDryRun(virBufferPtr buf); +#endif /* __VIR_COMMAND_PRIV_H__ */ diff --git a/tests/virkmodtest.c b/tests/virkmodtest.c index c6f5a728a0..eaf1b75c78 100644 --- a/tests/virkmodtest.c +++ b/tests/virkmodtest.c @@ -23,7 +23,8 @@ #ifdef __linux__ # include -# include "vircommand.h" +# define __VIR_COMMAND_PRIV_H_ALLOW__ +# include "vircommandpriv.h" # include "virkmod.h" # include "virstring.h" diff --git a/tests/virnetdevbandwidthtest.c b/tests/virnetdevbandwidthtest.c index 073fdf88b6..38dfbc1ef6 100644 --- a/tests/virnetdevbandwidthtest.c +++ b/tests/virnetdevbandwidthtest.c @@ -21,7 +21,8 @@ #include #include "testutils.h" -#include "vircommand.h" +#define __VIR_COMMAND_PRIV_H_ALLOW__ +#include "vircommandpriv.h" #include "virnetdevbandwidth.h" #include "netdev_bandwidth_conf.c" -- 2.47.2