diff options
author | Andreas Gruenbacher <agruen@linbit.com> | 2011-05-04 10:06:51 -0400 |
---|---|---|
committer | Philipp Reisner <philipp.reisner@linbit.com> | 2012-11-08 10:55:45 -0500 |
commit | a5d8e1fb9d22851de89bbf52db6b11c56b895dd4 (patch) | |
tree | e01243c9f44464e60955896f4041241ec886d649 | |
parent | 813472ced7fac734157fe5be1137ce2bac942902 (diff) |
drbd: Convert boolean flags on netlink from NLA_FLAG to NLA_U8
Flags of type NLA_FLAG are either present or absent, but do not have a
value by themselves. Use type NLA_U8 for our boolean flags instead, and
use the value to determine if the flag should be on or off.
On the drbdsetup command line, all those flags have an optional yes/no
argument which defaults to yes.
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
-rw-r--r-- | include/linux/genl_magic_struct.h | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/include/linux/genl_magic_struct.h b/include/linux/genl_magic_struct.h index ddbdd0a24476..b1ddbb5bd725 100644 --- a/include/linux/genl_magic_struct.h +++ b/include/linux/genl_magic_struct.h | |||
@@ -86,8 +86,8 @@ enum { | |||
86 | 86 | ||
87 | /* possible field types */ | 87 | /* possible field types */ |
88 | #define __flg_field(attr_nr, attr_flag, name) \ | 88 | #define __flg_field(attr_nr, attr_flag, name) \ |
89 | __field(attr_nr, attr_flag, name, NLA_FLAG, char, \ | 89 | __field(attr_nr, attr_flag, name, NLA_U8, char, \ |
90 | nla_get_flag, __nla_put_flag) | 90 | nla_get_u8, NLA_PUT_U8) |
91 | #define __u8_field(attr_nr, attr_flag, name) \ | 91 | #define __u8_field(attr_nr, attr_flag, name) \ |
92 | __field(attr_nr, attr_flag, name, NLA_U8, unsigned char, \ | 92 | __field(attr_nr, attr_flag, name, NLA_U8, unsigned char, \ |
93 | nla_get_u8, NLA_PUT_U8) | 93 | nla_get_u8, NLA_PUT_U8) |
@@ -118,12 +118,6 @@ enum { | |||
118 | #define __str_field_def(attr_nr, attr_flag, name, maxlen) \ | 118 | #define __str_field_def(attr_nr, attr_flag, name, maxlen) \ |
119 | __str_field(attr_nr, attr_flag, name, maxlen) | 119 | __str_field(attr_nr, attr_flag, name, maxlen) |
120 | 120 | ||
121 | #define __nla_put_flag(skb, attrtype, value) \ | ||
122 | do { \ | ||
123 | if (value) \ | ||
124 | NLA_PUT_FLAG(skb, attrtype); \ | ||
125 | } while (0) | ||
126 | |||
127 | #define GENL_op_init(args...) args | 121 | #define GENL_op_init(args...) args |
128 | #define GENL_doit(handler) \ | 122 | #define GENL_doit(handler) \ |
129 | .doit = handler, \ | 123 | .doit = handler, \ |