[libvirt] [PATCH v5 6/9] nss: Implement _nss_libvirt_gethostbyname3_r

Daniel P. Berrange berrange at redhat.com
Tue Mar 15 17:19:27 UTC 2016


On Tue, Mar 15, 2016 at 06:05:53PM +0100, Michal Privoznik wrote:
> The implementation is pretty straightforward. Moreover, because
> of the nature of things, gethostbyname_r and gethostbyname2_r can
> be implemented at the same time too.
> 
> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> ---
>  config-post.h              |  24 ++++
>  src/Makefile.am            |  57 ++++++++
>  src/util/virfile.c         |   3 +-
>  src/util/virfile.h         |  10 +-
>  src/util/virlease.c        |   1 +
>  tests/Makefile.am          |   2 +-
>  tools/Makefile.am          |   5 +
>  tools/nss/libvirt_nss.c    | 336 ++++++++++++++++++++++++++++++++++++++++++++-
>  tools/nss/libvirt_nss.h    |  14 +-
>  tools/nss/libvirt_nss.syms |   4 +-
>  10 files changed, 447 insertions(+), 9 deletions(-)
> 
> diff --git a/src/util/virfile.c b/src/util/virfile.c
> index 0bba850..f0412c6 100644
> --- a/src/util/virfile.c
> +++ b/src/util/virfile.c
> @@ -67,7 +67,6 @@
>  #include "virlog.h"
>  #include "virprocess.h"
>  #include "virstring.h"
> -#include "virstoragefile.h"

Yep, this is bogus anyway since its already in the header

>  #include "virutil.h"
>  
>  #include "c-ctype.h"
> @@ -554,7 +553,7 @@ int virFileUpdatePerm(const char *path,
>  
>  
>  #if defined(__linux__) && HAVE_DECL_LO_FLAGS_AUTOCLEAR && \
> -    !defined(LIBVIRT_SETUID_RPC_CLIENT)
> +    !defined(LIBVIRT_SETUID_RPC_CLIENT) && !defined(LIBVIRT_NSS)
>  
>  # if HAVE_DECL_LOOP_CTL_GET_FREE
>  
> diff --git a/src/util/virfile.h b/src/util/virfile.h
> index 312f226..50a3995 100644
> --- a/src/util/virfile.h
> +++ b/src/util/virfile.h
> @@ -30,7 +30,15 @@
>  # include <dirent.h>
>  
>  # include "internal.h"
> -# include "virstoragefile.h"
> +
> +/* Okay, this is not nice, but we want resulting nss module as
> + * small as possible. Including virstoragefile.h would drag in
> + * libxml2 dependencies which is unfavorable. */
> +# ifdef LIBVIRT_NSS
> +#  define virStorageFileFormat int
> +# else
> +#  include "virstoragefile.h"
> +# endif

I don't think this is needed. The header file merely uses the
enum declaration which is fine. You only get the dep on libxml2
if you actually build the virstoragefile.c

> diff --git a/src/util/virlease.c b/src/util/virlease.c
> index 910c003..920ebaf 100644
> --- a/src/util/virlease.c
> +++ b/src/util/virlease.c
> @@ -30,6 +30,7 @@
>  #include "virstring.h"
>  #include "virerror.h"
>  #include "viralloc.h"
> +#include "virutil.h"

Unrelated change

>  
>  #define VIR_FROM_THIS VIR_FROM_NETWORK
>  
> diff --git a/tests/Makefile.am b/tests/Makefile.am
> index 90981dc..55e8432 100644
> --- a/tests/Makefile.am
> +++ b/tests/Makefile.am
> @@ -65,7 +65,7 @@ GNULIB_LIBS = \
>         ../gnulib/lib/libgnu.la
>  
>  LDADDS = \
> -        $(WARN_CFLAGS) \
> +	$(WARN_CFLAGS) \
>  	$(NO_INDIRECT_LDFLAGS) \
>  	$(PROBES_O) \
>  	$(GNULIB_LIBS) \

Unrelated cleanup.

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