Remove network constants out of internal.h

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 or the source file that uses them.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrange 2017-07-05 11:19:43 +01:00
parent 24241c236e
commit d8f8c7a83d
8 changed files with 21 additions and 16 deletions

View File

@ -65,22 +65,6 @@
# include "ignore-value.h"
# include "count-leading-zeros.h"
/* 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) == 0)
# define STRCASEEQ(a, b) (c_strcasecmp(a, b) == 0)

View File

@ -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"

View File

@ -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"

View File

@ -37,6 +37,7 @@
#include "nwfilter_learnipaddr.h"
#include "virnetdev.h"
#include "datatypes.h"
#include "virsocketaddr.h"
#include "virstring.h"
#define VIR_FROM_THIS VIR_FROM_NWFILTER

View File

@ -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"

View File

@ -32,6 +32,18 @@
# 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 INET_ADDRSTRLEN
# define INET_ADDRSTRLEN 16
# endif
# define VIR_LOOPBACK_IPV4_ADDR "127.0.0.1"
typedef struct {
union {
struct sockaddr sa;

View File

@ -581,6 +581,10 @@ char *virIndexToDiskName(int idx, const char *prefix)
# define AI_CANONIDN 0
#endif
#ifndef HOST_NAME_MAX
# define HOST_NAME_MAX 256
#endif
/* Who knew getting a hostname could be so delicate. In Linux (and Unices
* in general), many things depend on "hostname" returning a value that will
* resolve one way or another. In the modern world where networks frequently

View File

@ -31,6 +31,7 @@
#include "domain_conf.h"
#include "virtime.h"
#include "virhostcpu.h"
#include "virsocketaddr.h"
#include "storage/storage_driver.h"
#include "vz_sdk.h"