[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [libvirt-php PATCH v2 02/11] Split up the bindings for libvirt connection API



On 08/03/2017 08:35 PM, Dawid Zamirski wrote:
> * add libvirt-connection.h and libvirt-connection.c
> * move all libvirt_connect_* function declarations and definitions to
>   above files
> * other minor adjusments to libvirt-php.h and util.h to keep the code
>   compilable while the code is being moved around.
> ---
>  src/Makefile.am          |   3 +-
>  src/libvirt-connection.c | 885 +++++++++++++++++++++++++++++++++++++++++++++
>  src/libvirt-connection.h |  83 +++++
>  src/libvirt-php.c        | 919 +----------------------------------------------
>  src/libvirt-php.h        |  95 ++---
>  src/util.h               |   7 -
>  6 files changed, 1025 insertions(+), 967 deletions(-)
>  create mode 100644 src/libvirt-connection.c
>  create mode 100644 src/libvirt-connection.h
> 
> diff --git a/src/Makefile.am b/src/Makefile.am
> index bbee667..0819dc6 100644
> --- a/src/Makefile.am
> +++ b/src/Makefile.am
> @@ -21,7 +21,8 @@ libvirt_php_la_SOURCES = \
>  	util.c util.h	\
>  	vncfunc.c vncfunc.h	\
>  	sockets.c sockets.h \
> -	libvirt-php.c libvirt-php.h
> +	libvirt-php.c libvirt-php.h \
> +	libvirt-connection.c libvirt-connection.h
>  libvirt_php_la_CFLAGS = \
>  	$(AM_CFLAGS) \
>  	-DCOMPILE_DL_LIBVIRT=1
> diff --git a/src/libvirt-connection.c b/src/libvirt-connection.c
> new file mode 100644
> index 0000000..bcebd44
> --- /dev/null
> +++ b/src/libvirt-connection.c
> @@ -0,0 +1,885 @@
> +/*
> + * libvirt-connection.c: The PHP bindings to libvirt connection API
> + *
> + * See COPYING for the license of this software
> + */
> +
> +#include <libvirt/libvirt.h>
> +
> +#include "libvirt-connection.h"
> +
> +DEBUG_INIT("connection");
> +
> +/*
> + * Private function name:   free_resources_on_connection
> + * Since version:           0.4.2
> + * Description:             Function is used to free all the resources assigned to the connection identified by conn
> + * Arguments:               @conn [virConnectPtr]: libvirt connection pointer
> + * Returns:                 None
> + */
> +static void
> +free_resources_on_connection(virConnectPtr conn TSRMLS_DC)
> +{
> +    int binding_resources_count = 0;
> +    resource_info *binding_resources;
> +    int i;
> +
> +    binding_resources_count = LIBVIRT_G(binding_resources_count);
> +    binding_resources = LIBVIRT_G(binding_resources);
> +
> +    for (i = 0; i < binding_resources_count; i++) {
> +        if ((binding_resources[i].overwrite == 0) && (binding_resources[i].conn == conn))
> +            free_resource(binding_resources[i].type, binding_resources[i].mem TSRMLS_CC);
> +    }
> +}

I'm getting a lot of compile errors after this patch. For instance:

libvirt-connection.c: In function ‘free_resources_on_connection’:
libvirt-connection.c:24:5: error: unknown type name ‘resource_info’
     resource_info *binding_resources;
     ^

I'm moving the fix from the next patch into this one.

Michal


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]