diff options
author | Andreas Gruenbacher <agruen@linbit.com> | 2011-05-03 14:56:09 +0200 |
---|---|---|
committer | Philipp Reisner <philipp.reisner@linbit.com> | 2012-11-08 16:55:38 +0100 |
commit | b966b5dd8e17e6c105ca55533fd412de5d5b429e (patch) | |
tree | 5597a93a0753ccd2476f4ba9ff31de5eeb09d83c /include/linux/genl_magic_func.h | |
parent | d8cd289dbe69ce9b8115d6f200ceff657e5dafa0 (diff) | |
download | linux-stable-b966b5dd8e17e6c105ca55533fd412de5d5b429e.tar.gz linux-stable-b966b5dd8e17e6c105ca55533fd412de5d5b429e.tar.bz2 linux-stable-b966b5dd8e17e6c105ca55533fd412de5d5b429e.zip |
drbd: Generate the drbd_set_*_defaults() functions from drbd_genl.h
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 | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/include/linux/genl_magic_func.h b/include/linux/genl_magic_func.h index e458282a3728..e908f1c50355 100644 --- a/include/linux/genl_magic_func.h +++ b/include/linux/genl_magic_func.h @@ -427,6 +427,32 @@ static inline int s_name ## _to_unpriv_skb(struct sk_buff *skb, \ #include GENL_MAGIC_INCLUDE_FILE + +/* Functions for initializing structs to default values. */ + +#undef __field +#define __field(attr_nr, attr_flag, name, nla_type, type, __get, __put) +#undef __array +#define __array(attr_nr, attr_flag, name, nla_type, type, maxlen, __get, __put) +#undef __u32_field_def +#define __u32_field_def(attr_nr, attr_flag, name, default) \ + x->name = default; +#undef __flg_field_def +#define __flg_field_def(attr_nr, attr_flag, name, default) \ + x->name = default; +#undef __str_field_def +#define __str_field_def(attr_nr, attr_flag, name, maxlen) \ + memset(x->name, 0, sizeof(x->name)); \ + x->name ## _len = 0; +#undef GENL_struct +#define GENL_struct(tag_name, tag_number, s_name, s_fields) \ +static void set_ ## s_name ## _defaults(struct s_name *x) __attribute__((unused)); \ +static void set_ ## s_name ## _defaults(struct s_name *x) { \ +s_fields \ +} + +#include GENL_MAGIC_INCLUDE_FILE + #endif /* __KERNEL__ */ /* }}}1 */ |