diff options
Diffstat (limited to 'include/net/netlink.h')
-rw-r--r-- | include/net/netlink.h | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/include/net/netlink.h b/include/net/netlink.h index 785f37a3b44e..09175d5d1fbf 100644 --- a/include/net/netlink.h +++ b/include/net/netlink.h | |||
@@ -98,6 +98,10 @@ | |||
98 | * nla_put_u16(skb, type, value) add u16 attribute to skb | 98 | * nla_put_u16(skb, type, value) add u16 attribute to skb |
99 | * nla_put_u32(skb, type, value) add u32 attribute to skb | 99 | * nla_put_u32(skb, type, value) add u32 attribute to skb |
100 | * nla_put_u64(skb, type, value) add u64 attribute to skb | 100 | * nla_put_u64(skb, type, value) add u64 attribute to skb |
101 | * nla_put_s8(skb, type, value) add s8 attribute to skb | ||
102 | * nla_put_s16(skb, type, value) add s16 attribute to skb | ||
103 | * nla_put_s32(skb, type, value) add s32 attribute to skb | ||
104 | * nla_put_s64(skb, type, value) add s64 attribute to skb | ||
101 | * nla_put_string(skb, type, str) add string attribute to skb | 105 | * nla_put_string(skb, type, str) add string attribute to skb |
102 | * nla_put_flag(skb, type) add flag attribute to skb | 106 | * nla_put_flag(skb, type) add flag attribute to skb |
103 | * nla_put_msecs(skb, type, jiffies) add msecs attribute to skb | 107 | * nla_put_msecs(skb, type, jiffies) add msecs attribute to skb |
@@ -121,6 +125,10 @@ | |||
121 | * nla_get_u16(nla) get payload for a u16 attribute | 125 | * nla_get_u16(nla) get payload for a u16 attribute |
122 | * nla_get_u32(nla) get payload for a u32 attribute | 126 | * nla_get_u32(nla) get payload for a u32 attribute |
123 | * nla_get_u64(nla) get payload for a u64 attribute | 127 | * nla_get_u64(nla) get payload for a u64 attribute |
128 | * nla_get_s8(nla) get payload for a s8 attribute | ||
129 | * nla_get_s16(nla) get payload for a s16 attribute | ||
130 | * nla_get_s32(nla) get payload for a s32 attribute | ||
131 | * nla_get_s64(nla) get payload for a s64 attribute | ||
124 | * nla_get_flag(nla) return 1 if flag is true | 132 | * nla_get_flag(nla) return 1 if flag is true |
125 | * nla_get_msecs(nla) get payload for a msecs attribute | 133 | * nla_get_msecs(nla) get payload for a msecs attribute |
126 | * | 134 | * |
@@ -160,6 +168,10 @@ enum { | |||
160 | NLA_NESTED_COMPAT, | 168 | NLA_NESTED_COMPAT, |
161 | NLA_NUL_STRING, | 169 | NLA_NUL_STRING, |
162 | NLA_BINARY, | 170 | NLA_BINARY, |
171 | NLA_S8, | ||
172 | NLA_S16, | ||
173 | NLA_S32, | ||
174 | NLA_S64, | ||
163 | __NLA_TYPE_MAX, | 175 | __NLA_TYPE_MAX, |
164 | }; | 176 | }; |
165 | 177 | ||
@@ -183,6 +195,8 @@ enum { | |||
183 | * NLA_NESTED_COMPAT Minimum length of structure payload | 195 | * NLA_NESTED_COMPAT Minimum length of structure payload |
184 | * NLA_U8, NLA_U16, | 196 | * NLA_U8, NLA_U16, |
185 | * NLA_U32, NLA_U64, | 197 | * NLA_U32, NLA_U64, |
198 | * NLA_S8, NLA_S16, | ||
199 | * NLA_S32, NLA_S64, | ||
186 | * NLA_MSECS Leaving the length field zero will verify the | 200 | * NLA_MSECS Leaving the length field zero will verify the |
187 | * given type fits, using it verifies minimum length | 201 | * given type fits, using it verifies minimum length |
188 | * just like "All other" | 202 | * just like "All other" |
@@ -879,6 +893,50 @@ static inline int nla_put_le64(struct sk_buff *skb, int attrtype, __le64 value) | |||
879 | } | 893 | } |
880 | 894 | ||
881 | /** | 895 | /** |
896 | * nla_put_s8 - Add a s8 netlink attribute to a socket buffer | ||
897 | * @skb: socket buffer to add attribute to | ||
898 | * @attrtype: attribute type | ||
899 | * @value: numeric value | ||
900 | */ | ||
901 | static inline int nla_put_s8(struct sk_buff *skb, int attrtype, s8 value) | ||
902 | { | ||
903 | return nla_put(skb, attrtype, sizeof(s8), &value); | ||
904 | } | ||
905 | |||
906 | /** | ||
907 | * nla_put_s16 - Add a s16 netlink attribute to a socket buffer | ||
908 | * @skb: socket buffer to add attribute to | ||
909 | * @attrtype: attribute type | ||
910 | * @value: numeric value | ||
911 | */ | ||
912 | static inline int nla_put_s16(struct sk_buff *skb, int attrtype, s16 value) | ||
913 | { | ||
914 | return nla_put(skb, attrtype, sizeof(s16), &value); | ||
915 | } | ||
916 | |||
917 | /** | ||
918 | * nla_put_s32 - Add a s32 netlink attribute to a socket buffer | ||
919 | * @skb: socket buffer to add attribute to | ||
920 | * @attrtype: attribute type | ||
921 | * @value: numeric value | ||
922 | */ | ||
923 | static inline int nla_put_s32(struct sk_buff *skb, int attrtype, s32 value) | ||
924 | { | ||
925 | return nla_put(skb, attrtype, sizeof(s32), &value); | ||
926 | } | ||
927 | |||
928 | /** | ||
929 | * nla_put_s64 - Add a s64 netlink attribute to a socket buffer | ||
930 | * @skb: socket buffer to add attribute to | ||
931 | * @attrtype: attribute type | ||
932 | * @value: numeric value | ||
933 | */ | ||
934 | static inline int nla_put_s64(struct sk_buff *skb, int attrtype, s64 value) | ||
935 | { | ||
936 | return nla_put(skb, attrtype, sizeof(s64), &value); | ||
937 | } | ||
938 | |||
939 | /** | ||
882 | * nla_put_string - Add a string netlink attribute to a socket buffer | 940 | * nla_put_string - Add a string netlink attribute to a socket buffer |
883 | * @skb: socket buffer to add attribute to | 941 | * @skb: socket buffer to add attribute to |
884 | * @attrtype: attribute type | 942 | * @attrtype: attribute type |
@@ -994,6 +1052,46 @@ static inline __be64 nla_get_be64(const struct nlattr *nla) | |||
994 | } | 1052 | } |
995 | 1053 | ||
996 | /** | 1054 | /** |
1055 | * nla_get_s32 - return payload of s32 attribute | ||
1056 | * @nla: s32 netlink attribute | ||
1057 | */ | ||
1058 | static inline s32 nla_get_s32(const struct nlattr *nla) | ||
1059 | { | ||
1060 | return *(s32 *) nla_data(nla); | ||
1061 | } | ||
1062 | |||
1063 | /** | ||
1064 | * nla_get_s16 - return payload of s16 attribute | ||
1065 | * @nla: s16 netlink attribute | ||
1066 | */ | ||
1067 | static inline s16 nla_get_s16(const struct nlattr *nla) | ||
1068 | { | ||
1069 | return *(s16 *) nla_data(nla); | ||
1070 | } | ||
1071 | |||
1072 | /** | ||
1073 | * nla_get_s8 - return payload of s8 attribute | ||
1074 | * @nla: s8 netlink attribute | ||
1075 | */ | ||
1076 | static inline s8 nla_get_s8(const struct nlattr *nla) | ||
1077 | { | ||
1078 | return *(s8 *) nla_data(nla); | ||
1079 | } | ||
1080 | |||
1081 | /** | ||
1082 | * nla_get_s64 - return payload of s64 attribute | ||
1083 | * @nla: s64 netlink attribute | ||
1084 | */ | ||
1085 | static inline s64 nla_get_s64(const struct nlattr *nla) | ||
1086 | { | ||
1087 | s64 tmp; | ||
1088 | |||
1089 | nla_memcpy(&tmp, nla, sizeof(tmp)); | ||
1090 | |||
1091 | return tmp; | ||
1092 | } | ||
1093 | |||
1094 | /** | ||
997 | * nla_get_flag - return payload of flag attribute | 1095 | * nla_get_flag - return payload of flag attribute |
998 | * @nla: flag netlink attribute | 1096 | * @nla: flag netlink attribute |
999 | */ | 1097 | */ |