提交 d8f8c7a8 编写于 作者: D Daniel P. Berrange

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: NDaniel P. Berrange <berrange@redhat.com>
上级 24241c23
......@@ -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)
......
......@@ -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"
......
......@@ -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"
......
......@@ -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
......
......@@ -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"
......
......@@ -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;
......
......@@ -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
......
......@@ -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"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册