diff mbox series

[RFC,iproute2-next,v1,3/5] libnetlink: Add helper for getting a __s32 from netlink msgs

Message ID 20180714000611.1179-4-vinicius.gomes@intel.com
State RFC, archived
Delegated to: David Ahern
Headers show
Series net/sched: Introduce the taprio scheduler | expand

Commit Message

Vinicius Costa Gomes July 14, 2018, 12:06 a.m. UTC
From: Jesus Sanchez-Palencia <jesus.sanchez-palencia@intel.com>

This function retrieves a signed 32-bit integer from a netlink message
and returns it.

Signed-off-by: Jesus Sanchez-Palencia <jesus.sanchez-palencia@intel.com>
---
 include/libnetlink.h | 7 +++++++
 1 file changed, 7 insertions(+)
diff mbox series

Patch

diff --git a/include/libnetlink.h b/include/libnetlink.h
index 88164975..114a816e 100644
--- a/include/libnetlink.h
+++ b/include/libnetlink.h
@@ -185,6 +185,13 @@  static inline __u64 rta_getattr_u64(const struct rtattr *rta)
 	memcpy(&tmp, RTA_DATA(rta), sizeof(__u64));
 	return tmp;
 }
+static inline __s32 rta_getattr_s32(const struct rtattr *rta)
+{
+	__s32 tmp;
+
+	memcpy(&tmp, RTA_DATA(rta), sizeof(__s32));
+	return tmp;
+}
 static inline __s64 rta_getattr_s64(const struct rtattr *rta)
 {
 	__s64 tmp;