diff options
Diffstat (limited to 'backport-include/linux')
-rw-r--r-- | backport-include/linux/kernel.h | 4 | ||||
-rw-r--r-- | backport-include/linux/kref.h | 13 | ||||
-rw-r--r-- | backport-include/linux/skbuff.h | 17 | ||||
-rw-r--r-- | backport-include/linux/string.h | 4 | ||||
-rw-r--r-- | backport-include/linux/uio.h | 7 |
5 files changed, 45 insertions, 0 deletions
diff --git a/backport-include/linux/kernel.h b/backport-include/linux/kernel.h index 3ddeb13..4b2f153 100644 --- a/backport-include/linux/kernel.h +++ b/backport-include/linux/kernel.h @@ -206,6 +206,10 @@ int __must_check kstrtobool_from_user(const char __user *s, size_t count, bool * #endif +#if LINUX_VERSION_IS_LESS(4,5,0) +const char *kvasprintf_const(gfp_t gfp, const char *fmt, va_list args); +#endif /* < 4.4 */ + #if LINUX_VERSION_IS_LESS(3,14,0) static inline u32 reciprocal_scale(u32 val, u32 ep_ro) { diff --git a/backport-include/linux/kref.h b/backport-include/linux/kref.h new file mode 100644 index 0000000..631488f --- /dev/null +++ b/backport-include/linux/kref.h @@ -0,0 +1,13 @@ +#ifndef __BACKPORT_LINUX_KREF_H +#define __BACKPORT_LINUX_KREF_H +#include_next <linux/kref.h> + +#if LINUX_VERSION_IS_LESS(4,11,0) +#include <linux/refcount.h> +static inline unsigned int kref_read(const struct kref *kref) +{ + return refcount_read((const refcount_t *)&kref->refcount); +} +#endif /* < 4.11 */ + +#endif /* __BACKPORT_LINUX_KREF_H */ diff --git a/backport-include/linux/skbuff.h b/backport-include/linux/skbuff.h index 034206b..af40b8d 100644 --- a/backport-include/linux/skbuff.h +++ b/backport-include/linux/skbuff.h @@ -371,6 +371,23 @@ static inline void skb_put_u8(struct sk_buff *skb, u8 val) { *(u8 *)skb_put(skb, 1) = val; } + +static inline void *__skb_put_zero(struct sk_buff *skb, unsigned int len) +{ + void *tmp = __skb_put(skb, len); + + memset(tmp, 0, len); + return tmp; +} + +static inline void *__skb_put_data(struct sk_buff *skb, const void *data, + unsigned int len) +{ + void *tmp = __skb_put(skb, len); + + memcpy(tmp, data, len); + return tmp; +} #endif #endif /* __BACKPORT_SKBUFF_H */ diff --git a/backport-include/linux/string.h b/backport-include/linux/string.h index b85d9c7..b1d26d1 100644 --- a/backport-include/linux/string.h +++ b/backport-include/linux/string.h @@ -29,4 +29,8 @@ void memzero_explicit(void *s, size_t count); ssize_t strscpy(char *dest, const char *src, size_t count); #endif +#if LINUX_VERSION_IS_LESS(4,0,0) +extern void kfree_const(const void *x); +extern const char *kstrdup_const(const char *s, gfp_t gfp); +#endif #endif /* __BACKPORT_LINUX_STRING_H */ diff --git a/backport-include/linux/uio.h b/backport-include/linux/uio.h new file mode 100644 index 0000000..fe27e68 --- /dev/null +++ b/backport-include/linux/uio.h @@ -0,0 +1,7 @@ +#ifndef _BP_LINUX_UIO_H +#define _BP_LINUX_UIO_H +#include_next <linux/uio.h> + +bool _copy_from_iter_full(void *addr, size_t bytes, struct iov_iter *i); + +#endif /* _BP_LINUX_UIO_H */ |