summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHauke Mehrtens <hauke@hauke-m.de>2015-12-04 22:16:22 +0100
committerHauke Mehrtens <hauke@hauke-m.de>2016-02-18 22:14:39 +0100
commit6fb3580fa43faf7643f0460ad0cd288253c7983c (patch)
tree4b81b7c5a17c2533b1ede20b07a1eac6cce42016
parent005b70fd55bf066e13feba6eeacae463480dd5b8 (diff)
header: add sk_set_bit() and sk_clear_bit()
Upstream commit: 74ec2bcbe4e072baf6d7fc9d78be6df52cdf05cd This adds the sk_set_bit() and sk_clear_bit() functions in addition to the renaming of SOCK_ASYNC_NOSPACE and SOCK_ASYNC_WAITDATA. This is needed since upstream commit 9cd3e072b0be "net: rename SOCK_ASYNC_NOSPACE and SOCK_ASYNC_WAITDATA" Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
-rw-r--r--backport/backport-include/linux/net.h7
-rw-r--r--backport/backport-include/net/sock.h16
2 files changed, 23 insertions, 0 deletions
diff --git a/backport/backport-include/linux/net.h b/backport/backport-include/linux/net.h
index 4d9250b8..6d2af69a 100644
--- a/backport/backport-include/linux/net.h
+++ b/backport/backport-include/linux/net.h
@@ -102,4 +102,11 @@ bool __net_get_random_once(void *buf, int nbytes, bool *done,
__sock_create(net, family, type, proto, res, 1)
#endif
+#ifndef SOCKWQ_ASYNC_NOSPACE
+#define SOCKWQ_ASYNC_NOSPACE SOCK_ASYNC_NOSPACE
+#endif
+#ifndef SOCKWQ_ASYNC_WAITDATA
+#define SOCKWQ_ASYNC_WAITDATA SOCK_ASYNC_WAITDATA
+#endif
+
#endif /* __BACKPORT_LINUX_NET_H */
diff --git a/backport/backport-include/net/sock.h b/backport/backport-include/net/sock.h
index caca6d1b..490b68cc 100644
--- a/backport/backport-include/net/sock.h
+++ b/backport/backport-include/net/sock.h
@@ -47,4 +47,20 @@
#define sk_alloc(net, family, priority, prot, kern) sk_alloc(net, family, priority, prot)
#endif
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,5,0)
+#define sk_set_bit LINUX_BACKPORT(sk_set_bit)
+static inline void sk_set_bit(int nr, struct sock *sk)
+{
+ set_bit(nr, &sk->sk_socket->flags);
+}
+#endif /* < 4.5 */
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,5,0)
+#define sk_clear_bit LINUX_BACKPORT(sk_clear_bit)
+static inline void sk_clear_bit(int nr, struct sock *sk)
+{
+ clear_bit(nr, &sk->sk_socket->flags);
+}
+#endif /* < 4.5 */
+
#endif /* __BACKPORT_NET_SOCK_H */