Re: [PATCH v2 3/5] Remove network constants out of internal.h

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

 



On Wed, Jul 05, 2017 at 12:58:49 +0100, Daniel Berrange wrote:
> The HOST_NAME_MAX, INET_ADDRSTRLEN and VIR_LOOPBACK_IPV4_ADDR
> constants are only used by a handful of files, so are better
> kept in virsocketaddr.h
> 
> Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
> ---
>  src/internal.h                         | 16 ----------------
>  src/libxl/libxl_conf.c                 |  1 +
>  src/nwfilter/nwfilter_dhcpsnoop.c      |  1 +
>  src/nwfilter/nwfilter_gentech_driver.c |  1 +
>  src/qemu/qemu_conf.c                   |  1 +
>  src/util/virsocketaddr.h               | 16 ++++++++++++++++
>  src/util/virutil.c                     |  1 +
>  src/vz/vz_sdk.c                        |  1 +
>  8 files changed, 22 insertions(+), 16 deletions(-)
> 

[...]

> diff --git a/src/util/virsocketaddr.h b/src/util/virsocketaddr.h
> index 43a3706..ae76166 100644
> --- a/src/util/virsocketaddr.h
> +++ b/src/util/virsocketaddr.h
> @@ -32,6 +32,22 @@
>  #  include <sys/un.h>
>  # endif
>  
> +/* On architectures which lack these limits, define them (ie. Cygwin).
> + * Note that the libvirt code should be robust enough to handle the
> + * case where actual value is longer than these limits (eg. by setting
> + * length correctly in second argument to gethostname and by always
> + * using strncpy instead of strcpy).
> + */
> +# ifndef HOST_NAME_MAX
> +#  define HOST_NAME_MAX 256

I'm not entirely convinced that this semantically belongs to
virsocketaddr.h

At least in the virlog.c usage case it is not used in any way in regards
to network communication.

> +# endif
> +
> +# ifndef INET_ADDRSTRLEN
> +#  define INET_ADDRSTRLEN 16
> +# endif
> +
> +# define VIR_LOOPBACK_IPV4_ADDR "127.0.0.1"
> +
>  typedef struct {
>      union {
>          struct sockaddr sa;

ACK to the rest though.

Attachment: signature.asc
Description: PGP 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]
  Powered by Linux