From nobody Thu Jul 3 10:28:19 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1499255963779414.918086387328; Wed, 5 Jul 2017 04:59:23 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5344C4E327; Wed, 5 Jul 2017 11:59:20 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2ED166C213; Wed, 5 Jul 2017 11:59:20 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id D82601800C94; Wed, 5 Jul 2017 11:59:19 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v65Bx3C7006408 for ; Wed, 5 Jul 2017 07:59:03 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7D44D6C205; Wed, 5 Jul 2017 11:59:03 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.42.22.189]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9D4C45D962; Wed, 5 Jul 2017 11:59:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 5344C4E327 Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 5344C4E327 From: "Daniel P. Berrange" To: libvir-list@redhat.com Date: Wed, 5 Jul 2017 12:58:49 +0100 Message-Id: <20170705115851.13792-4-berrange@redhat.com> In-Reply-To: <20170705115851.13792-1-berrange@redhat.com> References: <20170705115851.13792-1-berrange@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 3/5] Remove network constants out of internal.h X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 05 Jul 2017 11:59:20 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" 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 --- 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/internal.h b/src/internal.h index 69dff41..2b8cc09 100644 --- a/src/internal.h +++ b/src/internal.h @@ -65,22 +65,6 @@ # include "ignore-value.h" # include "count-leading-zeros.h" =20 -/* 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 -# endif - -# ifndef INET_ADDRSTRLEN -# define INET_ADDRSTRLEN 16 -# endif - -# define VIR_LOOPBACK_IPV4_ADDR "127.0.0.1" - /* String equality tests, suggested by Jim Meyering. */ # define STREQ(a, b) (strcmp(a, b) =3D=3D 0) # define STRCASEEQ(a, b) (c_strcasecmp(a, b) =3D=3D 0) diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c index 938e09d..a85bc71 100644 --- a/src/libxl/libxl_conf.c +++ b/src/libxl/libxl_conf.c @@ -42,6 +42,7 @@ #include "viralloc.h" #include "viruuid.h" #include "vircommand.h" +#include "virsocketaddr.h" #include "libxl_domain.h" #include "libxl_conf.h" #include "libxl_utils.h" diff --git a/src/nwfilter/nwfilter_dhcpsnoop.c b/src/nwfilter/nwfilter_dhcp= snoop.c index 702abe1..4436e39 100644 --- a/src/nwfilter/nwfilter_dhcpsnoop.c +++ b/src/nwfilter/nwfilter_dhcpsnoop.c @@ -65,6 +65,7 @@ #include "virnetdev.h" #include "virfile.h" #include "viratomic.h" +#include "virsocketaddr.h" #include "virthreadpool.h" #include "configmake.h" #include "virtime.h" diff --git a/src/nwfilter/nwfilter_gentech_driver.c b/src/nwfilter/nwfilter= _gentech_driver.c index 82e20de..3d809fb 100644 --- a/src/nwfilter/nwfilter_gentech_driver.c +++ b/src/nwfilter/nwfilter_gentech_driver.c @@ -37,6 +37,7 @@ #include "nwfilter_learnipaddr.h" #include "virnetdev.h" #include "datatypes.h" +#include "virsocketaddr.h" #include "virstring.h" =20 #define VIR_FROM_THIS VIR_FROM_NWFILTER diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 73c33d6..a65c92a 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -49,6 +49,7 @@ #include "cpu/cpu.h" #include "domain_nwfilter.h" #include "virfile.h" +#include "virsocketaddr.h" #include "virstring.h" #include "viratomic.h" #include "storage_conf.h" 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 # endif =20 +/* 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 +# endif + +# ifndef INET_ADDRSTRLEN +# define INET_ADDRSTRLEN 16 +# endif + +# define VIR_LOOPBACK_IPV4_ADDR "127.0.0.1" + typedef struct { union { struct sockaddr sa; diff --git a/src/util/virutil.c b/src/util/virutil.c index e4de4ca..88fff64 100644 --- a/src/util/virutil.c +++ b/src/util/virutil.c @@ -81,6 +81,7 @@ #include "virprocess.h" #include "virstring.h" #include "virutil.h" +#include "virsocketaddr.h" =20 verify(sizeof(gid_t) <=3D sizeof(unsigned int) && sizeof(uid_t) <=3D sizeof(unsigned int)); diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c index 0aa1a30..c5f11a4 100644 --- a/src/vz/vz_sdk.c +++ b/src/vz/vz_sdk.c @@ -31,6 +31,7 @@ #include "domain_conf.h" #include "virtime.h" #include "virhostcpu.h" +#include "virsocketaddr.h" =20 #include "storage/storage_driver.h" #include "vz_sdk.h" --=20 2.9.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list