CLEANUP: build: rename some build macros to use the USE_* ones
We still have quite a number of build macros which are mapped 1:1 to a
USE_something setting in the makefile but which have a different name.
This patch cleans this up by renaming them to use the USE_something
one, allowing to clean up the makefile and make it more obvious when
reading the code what build option needs to be added.
The following renames were done :
ENABLE_POLL -> USE_POLL
ENABLE_EPOLL -> USE_EPOLL
ENABLE_KQUEUE -> USE_KQUEUE
ENABLE_EVPORTS -> USE_EVPORTS
TPROXY -> USE_TPROXY
NETFILTER -> USE_NETFILTER
NEED_CRYPT_H -> USE_CRYPT_H
CONFIG_HAP_CRYPT -> USE_LIBCRYPT
CONFIG_HAP_NS -> DUSE_NS
CONFIG_HAP_LINUX_SPLICE -> USE_LINUX_SPLICE
CONFIG_HAP_LINUX_TPROXY -> USE_LINUX_TPROXY
CONFIG_HAP_LINUX_VSYSCALL -> USE_LINUX_VSYSCALL
diff --git a/include/common/accept4.h b/include/common/accept4.h
index 8981b92..7304213 100644
--- a/include/common/accept4.h
+++ b/include/common/accept4.h
@@ -42,7 +42,7 @@
#endif
#if defined(USE_MY_ACCEPT4) || (!defined(SYS_ACCEPT4) && !defined(__NR_accept4))
-#if defined(CONFIG_HAP_LINUX_VSYSCALL) && defined(__linux__) && defined(__i386__)
+#if defined(USE_LINUX_VSYSCALL) && defined(__linux__) && defined(__i386__)
/* The syscall is redefined somewhere else */
extern int accept4(int sockfd, struct sockaddr *addr, socklen_t *addrlen, int flags);
#elif ACCEPT4_USE_SOCKETCALL
diff --git a/include/common/compat.h b/include/common/compat.h
index 088b2c9..14996c8 100644
--- a/include/common/compat.h
+++ b/include/common/compat.h
@@ -90,7 +90,7 @@
/* On Linux 2.4 and above, MSG_TRUNC can be used on TCP sockets to drop any
* pending data. Let's rely on NETFILTER to detect if this is supported.
*/
-#ifdef NETFILTER
+#ifdef USE_NETFILTER
#define MSG_TRUNC_CLEARS_INPUT
#endif
@@ -117,14 +117,14 @@
#define TIMER_INVALID ((timer_t)(unsigned long)(0xfffffffful))
#endif
-#if defined(TPROXY) && defined(NETFILTER)
+#if defined(USE_TPROXY) && defined(USE_NETFILTER)
#include <linux/types.h>
#include <linux/netfilter_ipv6.h>
#include <linux/netfilter_ipv4.h>
#endif
/* On Linux, IP_TRANSPARENT and/or IP_FREEBIND generally require a kernel patch */
-#if defined(CONFIG_HAP_LINUX_TPROXY)
+#if defined(USE_LINUX_TPROXY)
#if !defined(IP_FREEBIND)
#define IP_FREEBIND 15
#endif /* !IP_FREEBIND */
@@ -134,7 +134,7 @@
#if !defined(IPV6_TRANSPARENT)
#define IPV6_TRANSPARENT 75
#endif /* !IPV6_TRANSPARENT */
-#endif /* CONFIG_HAP_LINUX_TPROXY */
+#endif /* USE_LINUX_TPROXY */
#if defined(IP_FREEBIND) \
|| defined(IP_BINDANY) \
@@ -148,9 +148,9 @@
/* We'll try to enable SO_REUSEPORT on Linux 2.4 and 2.6 if not defined.
* There are two families of values depending on the architecture. Those
* are at least valid on Linux 2.4 and 2.6, reason why we'll rely on the
- * NETFILTER define.
+ * USE_NETFILTER define.
*/
-#if !defined(SO_REUSEPORT) && defined(NETFILTER)
+#if !defined(SO_REUSEPORT) && defined(USE_NETFILTER)
#if (SO_REUSEADDR == 2)
#define SO_REUSEPORT 15
#elif (SO_REUSEADDR == 0x0004)
diff --git a/include/common/epoll.h b/include/common/epoll.h
index cc395cd..f45aa4f 100644
--- a/include/common/epoll.h
+++ b/include/common/epoll.h
@@ -29,7 +29,7 @@
#ifndef _COMMON_EPOLL_H
#define _COMMON_EPOLL_H
-#if defined (__linux__) && defined(ENABLE_EPOLL)
+#if defined (__linux__) && defined(USE_EPOLL)
#ifndef USE_MY_EPOLL
#include <sys/epoll.h>
@@ -70,7 +70,7 @@
} data;
};
-#if defined(CONFIG_HAP_LINUX_VSYSCALL) && defined(__linux__) && defined(__i386__)
+#if defined(USE_LINUX_VSYSCALL) && defined(__linux__) && defined(__i386__)
/* Those are our self-defined functions */
extern int epoll_create(int size);
extern int epoll_ctl(int epfd, int op, int fd, struct epoll_event * event);
@@ -94,7 +94,7 @@
#endif /* USE_MY_EPOLL */
-#endif /* __linux__ && ENABLE_EPOLL */
+#endif /* __linux__ && USE_EPOLL */
#endif /* _COMMON_EPOLL_H */
diff --git a/include/common/namespace.h b/include/common/namespace.h
index 7aacff9..41931ff 100644
--- a/include/common/namespace.h
+++ b/include/common/namespace.h
@@ -4,7 +4,7 @@
#include <stdlib.h>
#include <ebistree.h>
-#ifdef CONFIG_HAP_NS
+#ifdef USE_NS
struct netns_entry
{
@@ -28,6 +28,6 @@
return socket(domain, type, protocol);
}
-#endif /* CONFIG_HAP_NS */
+#endif /* USE_NS */
#endif /* _NAMESPACE_H */
diff --git a/include/common/splice.h b/include/common/splice.h
index ea29b16..760b6ba 100644
--- a/include/common/splice.h
+++ b/include/common/splice.h
@@ -23,7 +23,7 @@
#ifndef _COMMON_SPLICE_H
#define _COMMON_SPLICE_H
-#if defined (__linux__) && defined(CONFIG_HAP_LINUX_SPLICE)
+#if defined (__linux__) && defined(USE_LINUX_SPLICE)
#include <errno.h>
#include <unistd.h>
@@ -49,7 +49,7 @@
#if defined(USE_MY_SPLICE)
-#if defined(CONFIG_HAP_LINUX_VSYSCALL) && defined(__linux__) && defined(__i386__)
+#if defined(USE_LINUX_VSYSCALL) && defined(__linux__) && defined(__i386__)
/* The syscall is redefined somewhere else */
extern int splice(int fdin, loff_t *off_in, int fdout, loff_t *off_out, size_t len, unsigned long flags);
#else
@@ -71,7 +71,7 @@
#endif /* USE_MY_SPLICE */
-#endif /* __linux__ && CONFIG_HAP_LINUX_SPLICE */
+#endif /* __linux__ && USE_LINUX_SPLICE */
#endif /* _COMMON_SPLICE_H */