diff options
author | Andreas Gruenbacher <agruen@linbit.com> | 2011-05-17 07:29:46 -0400 |
---|---|---|
committer | Philipp Reisner <philipp.reisner@linbit.com> | 2012-11-08 10:55:55 -0500 |
commit | 509100e6012db92f4af3796436b450447c6c8268 (patch) | |
tree | 161f5b29974425fac4fe3e865fbea438b91c2511 /include/linux/genl_magic_func.h | |
parent | 309f0b70ab789bf85c5f5f32dbc466d42f024747 (diff) |
drbd: Output signed / unsigned netlink fields correctly
Note: All input values are still treated as signed; unsigned long long values
are still broken.
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
Diffstat (limited to 'include/linux/genl_magic_func.h')
-rw-r--r-- | include/linux/genl_magic_func.h | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/include/linux/genl_magic_func.h b/include/linux/genl_magic_func.h index 94e839aafae3..2ae16126c6a4 100644 --- a/include/linux/genl_magic_func.h +++ b/include/linux/genl_magic_func.h | |||
@@ -78,12 +78,13 @@ static struct nla_policy s_name ## _nl_policy[] __read_mostly = \ | |||
78 | { s_fields }; | 78 | { s_fields }; |
79 | 79 | ||
80 | #undef __field | 80 | #undef __field |
81 | #define __field(attr_nr, attr_flag, name, nla_type, _type, __get, __put) \ | 81 | #define __field(attr_nr, attr_flag, name, nla_type, _type, __get, \ |
82 | __put, __is_signed) \ | ||
82 | [__nla_type(attr_nr)] = { .type = nla_type }, | 83 | [__nla_type(attr_nr)] = { .type = nla_type }, |
83 | 84 | ||
84 | #undef __array | 85 | #undef __array |
85 | #define __array(attr_nr, attr_flag, name, nla_type, _type, maxlen, \ | 86 | #define __array(attr_nr, attr_flag, name, nla_type, _type, maxlen, \ |
86 | __get, __put) \ | 87 | __get, __put, __is_signed) \ |
87 | [__nla_type(attr_nr)] = { .type = nla_type, \ | 88 | [__nla_type(attr_nr)] = { .type = nla_type, \ |
88 | .len = maxlen - (nla_type == NLA_NUL_STRING) }, | 89 | .len = maxlen - (nla_type == NLA_NUL_STRING) }, |
89 | 90 | ||
@@ -241,7 +242,8 @@ static int s_name ## _from_attrs_for_change(struct s_name *s, \ | |||
241 | } | 242 | } |
242 | 243 | ||
243 | #undef __field | 244 | #undef __field |
244 | #define __field(attr_nr, attr_flag, name, nla_type, type, __get, __put) \ | 245 | #define __field(attr_nr, attr_flag, name, nla_type, type, __get, __put, \ |
246 | __is_signed) \ | ||
245 | __assign(attr_nr, attr_flag, name, nla_type, type, \ | 247 | __assign(attr_nr, attr_flag, name, nla_type, type, \ |
246 | if (s) \ | 248 | if (s) \ |
247 | s->name = __get(nla); \ | 249 | s->name = __get(nla); \ |
@@ -249,7 +251,8 @@ static int s_name ## _from_attrs_for_change(struct s_name *s, \ | |||
249 | 251 | ||
250 | /* validate_nla() already checked nla_len <= maxlen appropriately. */ | 252 | /* validate_nla() already checked nla_len <= maxlen appropriately. */ |
251 | #undef __array | 253 | #undef __array |
252 | #define __array(attr_nr, attr_flag, name, nla_type, type, maxlen, __get, __put) \ | 254 | #define __array(attr_nr, attr_flag, name, nla_type, type, maxlen, \ |
255 | __get, __put, __is_signed) \ | ||
253 | __assign(attr_nr, attr_flag, name, nla_type, type, \ | 256 | __assign(attr_nr, attr_flag, name, nla_type, type, \ |
254 | if (s) \ | 257 | if (s) \ |
255 | s->name ## _len = \ | 258 | s->name ## _len = \ |
@@ -410,14 +413,16 @@ static inline int s_name ## _to_unpriv_skb(struct sk_buff *skb, \ | |||
410 | 413 | ||
411 | 414 | ||
412 | #undef __field | 415 | #undef __field |
413 | #define __field(attr_nr, attr_flag, name, nla_type, type, __get, __put) \ | 416 | #define __field(attr_nr, attr_flag, name, nla_type, type, __get, __put, \ |
417 | __is_signed) \ | ||
414 | if (!exclude_sensitive || !((attr_flag) & GENLA_F_SENSITIVE)) { \ | 418 | if (!exclude_sensitive || !((attr_flag) & GENLA_F_SENSITIVE)) { \ |
415 | DPRINT_FIELD(">>", nla_type, name, s, NULL); \ | 419 | DPRINT_FIELD(">>", nla_type, name, s, NULL); \ |
416 | __put(skb, attr_nr, s->name); \ | 420 | __put(skb, attr_nr, s->name); \ |
417 | } | 421 | } |
418 | 422 | ||
419 | #undef __array | 423 | #undef __array |
420 | #define __array(attr_nr, attr_flag, name, nla_type, type, maxlen, __get, __put) \ | 424 | #define __array(attr_nr, attr_flag, name, nla_type, type, maxlen, \ |
425 | __get, __put, __is_signed) \ | ||
421 | if (!exclude_sensitive || !((attr_flag) & GENLA_F_SENSITIVE)) { \ | 426 | if (!exclude_sensitive || !((attr_flag) & GENLA_F_SENSITIVE)) { \ |
422 | DPRINT_ARRAY(">>",nla_type, name, s, NULL); \ | 427 | DPRINT_ARRAY(">>",nla_type, name, s, NULL); \ |
423 | __put(skb, attr_nr, min_t(int, maxlen, \ | 428 | __put(skb, attr_nr, min_t(int, maxlen, \ |
@@ -431,9 +436,11 @@ static inline int s_name ## _to_unpriv_skb(struct sk_buff *skb, \ | |||
431 | /* Functions for initializing structs to default values. */ | 436 | /* Functions for initializing structs to default values. */ |
432 | 437 | ||
433 | #undef __field | 438 | #undef __field |
434 | #define __field(attr_nr, attr_flag, name, nla_type, type, __get, __put) | 439 | #define __field(attr_nr, attr_flag, name, nla_type, type, __get, __put, \ |
440 | __is_signed) | ||
435 | #undef __array | 441 | #undef __array |
436 | #define __array(attr_nr, attr_flag, name, nla_type, type, maxlen, __get, __put) | 442 | #define __array(attr_nr, attr_flag, name, nla_type, type, maxlen, \ |
443 | __get, __put, __is_signed) | ||
437 | #undef __u32_field_def | 444 | #undef __u32_field_def |
438 | #define __u32_field_def(attr_nr, attr_flag, name, default) \ | 445 | #define __u32_field_def(attr_nr, attr_flag, name, default) \ |
439 | x->name = default; | 446 | x->name = default; |