Repository : ssh://git@open-mesh.org/batman-adv
On branch : maint
commit ce9e5e7c06c71f98b01704a66e4987a41ae14919 Author: Linus Torvalds torvalds@linux-foundation.org Date: Sun Feb 11 14:34:03 2018 -0800
batman-adv: do bulk POLL* -> EPOLL* replacement
This is the mindless scripted replacement of kernel use of POLL* variables as described by Al, done by this script:
for V in IN OUT PRI ERR RDNORM RDBAND WRNORM WRBAND HUP RDHUP NVAL MSG; do L=`git grep -l -w POLL$V | grep -v '^t' | grep -v /um/ | grep -v '^sa' | grep -v '/poll.h$'|grep -v '^D'` for f in $L; do sed -i "-es/^([^"]*)(<POLL$V>)/\1E\2/" $f; done done
with de-mangling cleanups yet to come.
NOTE! On almost all architectures, the EPOLL* constants have the same values as the POLL* constants do. But they keyword here is "almost". For various bad reasons they aren't the same, and epoll() doesn't actually work quite correctly in some cases due to this on Sparc et al.
The next patch from Al will sort out the final differences, and we should be all done.
Scripted-by: Al Viro viro@zeniv.linux.org.uk Signed-off-by: Linus Torvalds torvalds@linux-foundation.org [sven@narfation.org: Add compat code] Signed-off-by: Sven Eckelmann sven@narfation.org
ce9e5e7c06c71f98b01704a66e4987a41ae14919 compat-include/linux/{export.h => eventpoll.h} | 12 ++++----- .../uapi/linux/{nl80211.h => eventpoll.h} | 31 ++++++++++++++-------- net/batman-adv/icmp_socket.c | 2 +- net/batman-adv/log.c | 2 +- 4 files changed, 28 insertions(+), 19 deletions(-)
diff --git a/compat-include/linux/export.h b/compat-include/linux/eventpoll.h similarity index 78% copy from compat-include/linux/export.h copy to compat-include/linux/eventpoll.h index 5fb590f..40a7203 100644 --- a/compat-include/linux/export.h +++ b/compat-include/linux/eventpoll.h @@ -19,12 +19,12 @@ * of the Linux kernel. */
-#ifndef _NET_BATMAN_ADV_COMPAT_LINUX_EXPORT_H_ -#define _NET_BATMAN_ADV_COMPAT_LINUX_EXPORT_H_ +#ifndef _NET_BATMAN_ADV_COMPAT_LINUX_EVENTPOLL_H_ +#define _NET_BATMAN_ADV_COMPAT_LINUX_EVENTPOLL_H_
#include <linux/version.h> -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) -#include_next <linux/export.h> -#endif +#include_next <linux/eventpoll.h>
-#endif /* _NET_BATMAN_ADV_COMPAT_LINUX_EXPORT_H_ */ +#include <uapi/linux/eventpoll.h> + +#endif /* _NET_BATMAN_ADV_COMPAT_LINUX_EVENTPOLL_H_ */ diff --git a/compat-include/uapi/linux/nl80211.h b/compat-include/uapi/linux/eventpoll.h similarity index 50% copy from compat-include/uapi/linux/nl80211.h copy to compat-include/uapi/linux/eventpoll.h index 724ab2a..331687a 100644 --- a/compat-include/uapi/linux/nl80211.h +++ b/compat-include/uapi/linux/eventpoll.h @@ -19,23 +19,32 @@ * of the Linux kernel. */
-#ifndef _NET_BATMAN_ADV_COMPAT_UAPI_LINUX_NL80211_H_ -#define _NET_BATMAN_ADV_COMPAT_UAPI_LINUX_NL80211_H_ +#ifndef _NET_BATMAN_ADV_COMPAT_UAPI_LINUX_EVENTPOLL_H_ +#define _NET_BATMAN_ADV_COMPAT_UAPI_LINUX_EVENTPOLL_H_
#include <linux/version.h> +#include <linux/types.h> #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 7, 0) -#include_next <uapi/linux/nl80211.h> +#include_next <uapi/linux/eventpoll.h> #else -#include <linux/nl80211.h> +#include <linux/eventpoll.h> #endif
-#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 0, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0)
-/* for batadv_v_elp_get_throughput which would have used - * STATION_INFO_EXPECTED_THROUGHPUT in Linux 4.0.0 - */ -#define NL80211_STA_INFO_EXPECTED_THROUGHPUT 28 +#define EPOLLIN (__force __poll_t)0x00000001 +#define EPOLLPRI (__force __poll_t)0x00000002 +#define EPOLLOUT (__force __poll_t)0x00000004 +#define EPOLLERR (__force __poll_t)0x00000008 +#define EPOLLHUP (__force __poll_t)0x00000010 +#define EPOLLNVAL (__force __poll_t)0x00000020 +#define EPOLLRDNORM (__force __poll_t)0x00000040 +#define EPOLLRDBAND (__force __poll_t)0x00000080 +#define EPOLLWRNORM (__force __poll_t)0x00000100 +#define EPOLLWRBAND (__force __poll_t)0x00000200 +#define EPOLLMSG (__force __poll_t)0x00000400 +#define EPOLLRDHUP (__force __poll_t)0x00002000
-#endif /* < KERNEL_VERSION(4, 0, 0) */ +#endif /* < KERNEL_VERSION(4, 12, 0) */
-#endif /* _NET_BATMAN_ADV_COMPAT_UAPI_LINUX_NL80211_H_ */ +#endif /* _NET_BATMAN_ADV_COMPAT_UAPI_LINUX_EVENTPOLL_H_ */ diff --git a/net/batman-adv/icmp_socket.c b/net/batman-adv/icmp_socket.c index 3396414..7d5e9ab 100644 --- a/net/batman-adv/icmp_socket.c +++ b/net/batman-adv/icmp_socket.c @@ -304,7 +304,7 @@ static __poll_t batadv_socket_poll(struct file *file, poll_table *wait) poll_wait(file, &socket_client->queue_wait, wait);
if (socket_client->queue_len > 0) - return POLLIN | POLLRDNORM; + return EPOLLIN | EPOLLRDNORM;
return 0; } diff --git a/net/batman-adv/log.c b/net/batman-adv/log.c index 0132696..52d8a4b 100644 --- a/net/batman-adv/log.c +++ b/net/batman-adv/log.c @@ -193,7 +193,7 @@ static __poll_t batadv_log_poll(struct file *file, poll_table *wait) poll_wait(file, &debug_log->queue_wait, wait);
if (!batadv_log_empty(debug_log)) - return POLLIN | POLLRDNORM; + return EPOLLIN | EPOLLRDNORM;
return 0; }