Re: [PATCH 11/12] Move virDomain related APIs out of libvirt.c

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

 



On 10/22/2014 11:15 AM, Daniel P. Berrange wrote:
> Introduce a src/libvirt-domain.c file to hold all the
> methods related to the virDomain type.
> ---
>  docs/apibuild.py       |     2 +
>  po/POTFILES.in         |     1 +
>  src/Makefile.am        |     2 +
>  src/libvirt-domain.c   | 11112 ++++++++++++++++++++++++++++++++++++++++++
>  src/libvirt.c          | 12388 +++--------------------------------------------
>  src/libvirt_internal.h |     6 +
>  6 files changed, 11774 insertions(+), 11737 deletions(-)
>  create mode 100644 src/libvirt-domain.c

My trick for reviewing the earlier patches via a pre-process comparison
of lines added vs. lines removed failed on this one; you must have
reordered some functions or something similar that made the diff messy :(

> 
> diff --git a/docs/apibuild.py b/docs/apibuild.py
> index 1eb6fcf..a96260f 100755
> --- a/docs/apibuild.py
> +++ b/docs/apibuild.py
> @@ -24,6 +24,7 @@ included_files = {
>    "libvirt.h": "header with general libvirt API definitions",
>    "virterror.h": "header with error specific API definitions",
>    "libvirt.c": "Main interfaces for the libvirt library",
> +  "libvirt-domain.c": "Domain interfaces for the libvirt library",
>    "libvirt-domain-snapshot.c": "Domain snapshot interfaces for the libvirt library",
>    "libvirt-interface.c": "Interface interfaces for the libvirt library",
>    "libvirt-network.c": "Network interfaces for the libvirt library",
> @@ -73,6 +74,7 @@ ignored_functions = {
>    "virDomainMigratePrepareTunnel3": "private function for tunnelled migration",
>    "DllMain": "specific function for Win32",
>    "virTypedParamsValidate": "internal function in virtypedparam.c",
> +  "virTypedParameterValidateSet": "internal function in virtypedparam.c",

This hunk feels unrelated, or maybe worth doing in its own patch. [1]


> +++ b/src/libvirt.c
> @@ -52,7 +52,6 @@
>  #include "viruuid.h"
>  #include "viralloc.h"
>  #include "configmake.h"
> -#include "intprops.h"
>  #include "virconf.h"
>  #if WITH_GNUTLS
>  # if WITH_GNUTLS_GCRYPT
> @@ -1500,6 +1499,48 @@ virConnectSupportsFeature(virConnectPtr conn, int feature)
>  }
>  
>  
> +/* Helper function called to validate incoming client array on any
> + * interface that sets typed parameters in the hypervisor.  */
> +int
> +virTypedParameterValidateSet(virConnectPtr conn,
> +                             virTypedParameterPtr params,
> +                             int nparams)

Ah. You left this function in place, but changed it from 'static int' to
'int', which in turn caused diff to think you re-arranged its location...


> @@ -1755,41 +1796,34 @@ virConnectGetMaxVcpus(virConnectPtr conn,
>  
>  
>  /**
> - * virConnectListDomains:
> + * virNodeGetInfo:
>   * @conn: pointer to the hypervisor connection
> - * @ids: array to collect the list of IDs of active domains
> - * @maxids: size of @ids
> - *
> - * Collect the list of active domains, and store their IDs in array @ids
> + * @info: pointer to a virNodeInfo structure allocated by the user
>   *
> - * For inactive domains, see virConnectListDefinedDomains().  For more
> - * control over the results, see virConnectListAllDomains().
> + * Extract hardware information about the node.
>   *
> - * Returns the number of domains found or -1 in case of error.  Note that
> - * this command is inherently racy; a domain can be started between a
> - * call to virConnectNumOfDomains() and this call; you are only guaranteed
> - * that all currently active domains were listed if the return is less
> - * than @maxids.
> + * Returns 0 in case of success and -1 in case of failure.
>   */
>  int
> -virConnectListDomains(virConnectPtr conn, int *ids, int maxids)
> +virNodeGetInfo(virConnectPtr conn, virNodeInfoPtr info)

followed by all sorts of junk like this.

> +++ b/src/libvirt_internal.h
> @@ -285,4 +285,10 @@ int virDomainMigrateConfirm3Params(virDomainPtr domain,
>                                     int cookieinlen,
>                                     unsigned int flags,
>                                     int cancelled);
> +
> +int
> +virTypedParameterValidateSet(virConnectPtr conn,
> +                             virTypedParameterPtr params,
> +                             int nparams);
> +
>  #endif
> 

[1] If you don't mind, I'd rather make exposing this helper function be
it's own patch, leaving this patch to just be code motion.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]