Merge branch 'master' into next
[sliver-openvswitch.git] / datapath / linux-2.6 / compat-2.6 / include / net / netlink.h
1 #ifndef __NET_NETLINK_WRAPPER_H
2 #define __NET_NETLINK_WRAPPER_H 1
3
4 #include_next <net/netlink.h>
5
6 #ifndef HAVE_NLA_NUL_STRING
7 #define NLA_NUL_STRING NLA_STRING
8
9 static inline int VERIFY_NUL_STRING(struct nlattr *attr)
10 {
11         return (!attr || (nla_len(attr)
12                           && memchr(nla_data(attr), '\0', nla_len(attr)))
13                 ? 0 : EINVAL);
14 }
15 #else
16 static inline int VERIFY_NUL_STRING(struct nlattr *attr)
17 {
18         return 0;
19 }
20 #endif  /* !HAVE_NLA_NUL_STRING */
21
22
23 #ifndef NLA_PUT_BE16
24 #define NLA_PUT_BE16(skb, attrtype, value) \
25         NLA_PUT_TYPE(skb, __be16, attrtype, value)
26 #endif  /* !NLA_PUT_BE16 */
27
28
29 #ifndef HAVE_NLA_GET_BE16
30 /**
31  * nla_get_be16 - return payload of __be16 attribute
32  * @nla: __be16 netlink attribute
33  */
34 static inline __be16 nla_get_be16(struct nlattr *nla)
35 {
36         return *(__be16 *) nla_data(nla);
37 }
38 #endif  /* !HAVE_NLA_GET_BE16 */
39
40 #endif /* net/netlink.h */