[libvirt] [PATCH 4/7] Introduce vircommandpriv.h for functions used by tests

Daniel P. Berrange berrange at redhat.com
Wed Mar 12 14:24:54 UTC 2014


On Wed, Mar 12, 2014 at 02:08:14PM +0100, Ján Tomko wrote:
> So far it's just virCommandSetDryRun.
> ---
>  src/Makefile.am                |  2 +-
>  src/util/vircommand.c          |  2 +-
>  src/util/vircommand.h          |  2 --
>  src/util/vircommandpriv.h      | 28 ++++++++++++++++++++++++++++
>  tests/virkmodtest.c            |  2 +-
>  tests/virnetdevbandwidthtest.c |  2 +-
>  6 files changed, 32 insertions(+), 6 deletions(-)
>  create mode 100644 src/util/vircommandpriv.h
> 1
> diff --git a/src/Makefile.am b/src/Makefile.am
> index a88b258..25b33a7 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 db4166f..7a799f2 100644
> --- a/src/util/vircommand.c
> +++ b/src/util/vircommand.c
> @@ -40,7 +40,7 @@
>  # include <sys/apparmor.h>
>  #endif
>  
> -#include "vircommand.h"
> +#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 7485edc..10b4fa2 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 0000000..2fbf3de
> --- /dev/null
> +++ b/src/util/vircommandpriv.h
> @@ -0,0 +1,28 @@
> +/*
> + * 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
> + * <http://www.gnu.org/licenses/>.
> + *
> + */
> +

Also add in

#ifndef __VIR_COMMAND_PRIV_H_ALLOW__
# error "vircommandpriv.h may only be included by vircommand.c or test suites"
#endif

and then make vircommand.c and any relevant test suites #define
this symbol before including the file.

> +#ifndef __VIR_COMMAND_PRIV_H__
> +# define __VIR_COMMAND_PRIV_H__
> +
> +# include "vircommand.h"
> +
> +void virCommandSetDryRun(virBufferPtr buf);
> +#endif /* __VIR_COMMAND_PRIV_H__ */


ACK with that change.

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list