aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/netlink.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/net/netlink.h')
-rw-r--r--include/net/netlink.h22
1 files changed, 18 insertions, 4 deletions
diff --git a/include/net/netlink.h b/include/net/netlink.h
index ce5cba19c393..bcaf67b7a19d 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -3,6 +3,7 @@
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#include <linux/netlink.h> 5#include <linux/netlink.h>
6#include <linux/jiffies.h>
6 7
7/* ======================================================================== 8/* ========================================================================
8 * Netlink Messages and Attributes Interface (As Seen On TV) 9 * Netlink Messages and Attributes Interface (As Seen On TV)
@@ -500,14 +501,15 @@ static inline struct nlmsghdr *nlmsg_put_answer(struct sk_buff *skb,
500 501
501/** 502/**
502 * nlmsg_new - Allocate a new netlink message 503 * nlmsg_new - Allocate a new netlink message
503 * @size: maximum size of message 504 * @payload: size of the message payload
504 * @flags: the type of memory to allocate. 505 * @flags: the type of memory to allocate.
505 * 506 *
506 * Use NLMSG_GOODSIZE if size isn't know and you need a good default size. 507 * Use NLMSG_DEFAULT_SIZE if the size of the payload isn't known
508 * and a good default is needed.
507 */ 509 */
508static inline struct sk_buff *nlmsg_new(int size, gfp_t flags) 510static inline struct sk_buff *nlmsg_new(size_t payload, gfp_t flags)
509{ 511{
510 return alloc_skb(size, flags); 512 return alloc_skb(nlmsg_total_size(payload), flags);
511} 513}
512 514
513/** 515/**
@@ -828,6 +830,9 @@ static inline int nla_put_msecs(struct sk_buff *skb, int attrtype,
828#define NLA_PUT_U16(skb, attrtype, value) \ 830#define NLA_PUT_U16(skb, attrtype, value) \
829 NLA_PUT_TYPE(skb, u16, attrtype, value) 831 NLA_PUT_TYPE(skb, u16, attrtype, value)
830 832
833#define NLA_PUT_LE16(skb, attrtype, value) \
834 NLA_PUT_TYPE(skb, __le16, attrtype, value)
835
831#define NLA_PUT_U32(skb, attrtype, value) \ 836#define NLA_PUT_U32(skb, attrtype, value) \
832 NLA_PUT_TYPE(skb, u32, attrtype, value) 837 NLA_PUT_TYPE(skb, u32, attrtype, value)
833 838
@@ -874,6 +879,15 @@ static inline u16 nla_get_u16(struct nlattr *nla)
874} 879}
875 880
876/** 881/**
882 * nla_get_le16 - return payload of __le16 attribute
883 * @nla: __le16 netlink attribute
884 */
885static inline __le16 nla_get_le16(struct nlattr *nla)
886{
887 return *(__le16 *) nla_data(nla);
888}
889
890/**
877 * nla_get_u8 - return payload of u8 attribute 891 * nla_get_u8 - return payload of u8 attribute
878 * @nla: u8 netlink attribute 892 * @nla: u8 netlink attribute
879 */ 893 */