netlink: Add nla_put_net{16,32,64}() helpers.
authorDavid S. Miller <davem@davemloft.net>
Sun, 1 Apr 2012 23:11:31 +0000 (19:11 -0400)
committerDavid S. Miller <davem@davemloft.net>
Mon, 2 Apr 2012 08:33:41 +0000 (04:33 -0400)
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/netlink.h

index fce17f6538cc49392010e0ca1371dc90e50a7da3..73656aa8faaad86393031dce0c99a7e5b69435d2 100644 (file)
@@ -782,6 +782,17 @@ static inline int nla_put_be16(struct sk_buff *skb, int attrtype, __be16 value)
        return nla_put(skb, attrtype, sizeof(__be16), &value);
 }
 
+/**
+ * nla_put_net16 - Add 16-bit network byte order netlink attribute to a socket buffer
+ * @skb: socket buffer to add attribute to
+ * @attrtype: attribute type
+ * @value: numeric value
+ */
+static inline int nla_put_net16(struct sk_buff *skb, int attrtype, __be16 value)
+{
+       return nla_put_be16(skb, attrtype | NLA_F_NET_BYTEORDER, value);
+}
+
 /**
  * nla_put_u32 - Add a u32 netlink attribute to a socket buffer
  * @skb: socket buffer to add attribute to
@@ -804,6 +815,17 @@ static inline int nla_put_be32(struct sk_buff *skb, int attrtype, __be32 value)
        return nla_put(skb, attrtype, sizeof(__be32), &value);
 }
 
+/**
+ * nla_put_net32 - Add 32-bit network byte order netlink attribute to a socket buffer
+ * @skb: socket buffer to add attribute to
+ * @attrtype: attribute type
+ * @value: numeric value
+ */
+static inline int nla_put_net32(struct sk_buff *skb, int attrtype, __be32 value)
+{
+       return nla_put_be32(skb, attrtype | NLA_F_NET_BYTEORDER, value);
+}
+
 /**
  * nla_put_u64 - Add a u64 netlink attribute to a socket buffer
  * @skb: socket buffer to add attribute to
@@ -826,6 +848,17 @@ static inline int nla_put_be64(struct sk_buff *skb, int attrtype, __be64 value)
        return nla_put(skb, attrtype, sizeof(__be64), &value);
 }
 
+/**
+ * nla_put_net64 - Add 64-bit network byte order netlink attribute to a socket buffer
+ * @skb: socket buffer to add attribute to
+ * @attrtype: attribute type
+ * @value: numeric value
+ */
+static inline int nla_put_net64(struct sk_buff *skb, int attrtype, __be64 value)
+{
+       return nla_put_be64(skb, attrtype | NLA_F_NET_BYTEORDER, value);
+}
+
 /**
  * nla_put_string - Add a string netlink attribute to a socket buffer
  * @skb: socket buffer to add attribute to
This page took 0.0272 seconds and 5 git commands to generate.