[PATCH 03/21] header: skbuff: add skb_put_zero(), skb_put_data() and skb_put_u8()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



These functions were added in kernel 4.13 and are used by many driver
now.

This was added in the following upsteram comits:
e45a79da863c19 ("skbuff/mac80211: introduce and use skb_put_zero()")
59ae1d127ac0ae ("networking: introduce and use skb_put_data()")
634fef61076d64 ("networking: add and use skb_put_u8()")

Signed-off-by: Hauke Mehrtens <hauke@xxxxxxxxxx>
---
 backport/backport-include/linux/skbuff.h | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/backport/backport-include/linux/skbuff.h b/backport/backport-include/linux/skbuff.h
index dc957487..09894a96 100644
--- a/backport/backport-include/linux/skbuff.h
+++ b/backport/backport-include/linux/skbuff.h
@@ -315,4 +315,30 @@ __u32 skb_get_hash_perturb(const struct sk_buff *skb, u32 perturb)
 
 #endif
 
+#if LINUX_VERSION_IS_LESS(4,13,0)
+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;
+}
+
+static inline void skb_put_u8(struct sk_buff *skb, u8 val)
+{
+	*(u8 *)skb_put(skb, 1) = val;
+}
+#endif
+
 #endif /* __BACKPORT_SKBUFF_H */
-- 
2.11.0

--
To unsubscribe from this list: send the line "unsubscribe backports" in



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux