Skip to content

Commit

Permalink
drbd: Convert boolean flags on netlink from NLA_FLAG to NLA_U8
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Andreas Gruenbacher authored and Philipp Reisner committed Nov 8, 2012
1 parent 813472c commit a5d8e1f
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions include/linux/genl_magic_struct.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ enum {

/* possible field types */
#define __flg_field(attr_nr, attr_flag, name) \
__field(attr_nr, attr_flag, name, NLA_FLAG, char, \
nla_get_flag, __nla_put_flag)
__field(attr_nr, attr_flag, name, NLA_U8, char, \
nla_get_u8, NLA_PUT_U8)
#define __u8_field(attr_nr, attr_flag, name) \
__field(attr_nr, attr_flag, name, NLA_U8, unsigned char, \
nla_get_u8, NLA_PUT_U8)
Expand Down Expand Up @@ -118,12 +118,6 @@ enum {
#define __str_field_def(attr_nr, attr_flag, name, maxlen) \
__str_field(attr_nr, attr_flag, name, maxlen)

#define __nla_put_flag(skb, attrtype, value) \
do { \
if (value) \
NLA_PUT_FLAG(skb, attrtype); \
} while (0)

#define GENL_op_init(args...) args
#define GENL_doit(handler) \
.doit = handler, \
Expand Down

0 comments on commit a5d8e1f

Please sign in to comment.