diff mbox series

[2/3] libnl-tiny: Add NLA_PUT_S32()

Message ID 20211212211735.2457250-2-hauke@hauke-m.de
State Accepted
Delegated to: Hauke Mehrtens
Headers show
Series [1/3] mac80211: Update to version 5.15.6 | expand

Commit Message

Hauke Mehrtens Dec. 12, 2021, 9:17 p.m. UTC
This function is used by iw 5.16.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 package/libs/libnl-tiny/Makefile              |  2 +-
 .../patches/0001-attr.h-Add-NLA_PUT_S32.patch | 62 +++++++++++++++++++
 2 files changed, 63 insertions(+), 1 deletion(-)
 create mode 100644 package/libs/libnl-tiny/patches/0001-attr.h-Add-NLA_PUT_S32.patch
diff mbox series

Patch

diff --git a/package/libs/libnl-tiny/Makefile b/package/libs/libnl-tiny/Makefile
index bdb496c48e60..7fe8b5c5f708 100644
--- a/package/libs/libnl-tiny/Makefile
+++ b/package/libs/libnl-tiny/Makefile
@@ -8,7 +8,7 @@ 
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=libnl-tiny
-PKG_RELEASE:=2
+PKG_RELEASE:=3
 
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_URL=$(PROJECT_GIT)/project/libnl-tiny.git
diff --git a/package/libs/libnl-tiny/patches/0001-attr.h-Add-NLA_PUT_S32.patch b/package/libs/libnl-tiny/patches/0001-attr.h-Add-NLA_PUT_S32.patch
new file mode 100644
index 000000000000..517d4b5c1565
--- /dev/null
+++ b/package/libs/libnl-tiny/patches/0001-attr.h-Add-NLA_PUT_S32.patch
@@ -0,0 +1,62 @@ 
+From f4e190cfed119fcf8db4870b0a86dd6ba95034a8 Mon Sep 17 00:00:00 2001
+From: Hauke Mehrtens <hauke@hauke-m.de>
+Date: Sun, 21 Nov 2021 00:08:55 +0100
+Subject: [PATCH] attr.h: Add NLA_PUT_S32
+
+This function is used by iw now.
+
+Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
+---
+ include/netlink/attr.h | 34 ++++++++++++++++++++++++++++++++++
+ 1 file changed, 34 insertions(+)
+
+--- a/include/netlink/attr.h
++++ b/include/netlink/attr.h
+@@ -299,6 +299,31 @@ static inline uint16_t nla_get_u16(struc
+ }
+ 
+ /**
++ * Add 32 bit signed integer attribute to netlink message.
++ * @arg msg             Netlink message.
++ * @arg attrtype        Attribute type.
++ * @arg value           Numeric value to store as payload.
++ *
++ * @see nla_put
++ * @return 0 on success or a negative error code.
++ */
++static inline int nla_put_s32(struct nl_msg *msg, int attrtype, int32_t value)
++{
++	return nla_put(msg, attrtype, sizeof(int32_t), &value);
++}
++
++/**
++ * Return payload of 32 bit signed integer attribute.
++ * @arg nla             32 bit integer attribute.
++ *
++ * @return Payload as 32 bit integer.
++ */
++static inline int32_t nla_get_s32(struct nlattr *nla)
++{
++	return *(int32_t *) nla_data(nla);
++}
++
++/**
+  * Add 32 bit integer attribute to netlink message.
+  * @arg msg		Netlink message.
+  * @arg attrtype	Attribute type.
+@@ -632,6 +657,15 @@ static inline size_t nla_strlcpy(char *d
+ 	NLA_PUT_TYPE(msg, uint16_t, attrtype, value)
+ 
+ /**
++ * Add 32 bit signed integer attribute to netlink message.
++ * @arg msg		Netlink message.
++ * @arg attrtype	Attribute type.
++ * @arg value		Numeric value.
++ */
++#define NLA_PUT_S32(msg, attrtype, value) \
++	NLA_PUT_TYPE(msg, int32_t, attrtype, value)
++
++/**
+  * Add 32 bit integer attribute to netlink message.
+  * @arg msg		Netlink message.
+  * @arg attrtype	Attribute type.