compat: backport netlink changes used in the nl80211 cleanup
PATCH 1/1 compat: backport netlink changes used in the nl80211 cleanup
---
include/linux/compat-2.6.37.h +59 -0
@@ -45,6 +45,65 @@ static inline void skb_checksum_none_ass#define pcmcia_enable_device (link) pcmcia_request_configuration(link, &link->conf) +#include <net/genetlink.h> + +struct compat_genl_info { +struct genl_info *info; + +u32 snd_seq; +u32 snd_pid; +struct genlmsghdr *genlhdr; +struct nlattr **attrs; +void *user_ptr[2 ]; +}; +#define genl_info compat_genl_info + +struct compat_genl_ops { +struct genl_ops ops; + +u8 cmd; +u8 internal_flags; +unsigned int flags; +const struct nla_policy *policy; + +int (*doit)(struct sk_buff *skb,struct genl_info *info); +int (*dumpit)(struct sk_buff *skb,struct netlink_callback *cb); +int (*done)(struct netlink_callback *cb); +}; +#define genl_ops compat_genl_ops + +struct compat_genl_family { +struct genl_family family; + +struct list_head list; + +unsigned int id, hdrsize, version, maxattr; +const char *name; +bool netnsok; + +struct nlattr **attrbuf; + +int (*pre_doit)(struct genl_ops *ops,struct sk_buff *skb, +struct genl_info *info); + +void (*post_doit)(struct genl_ops *ops,struct sk_buff *skb, +struct genl_info *info); +}; + +#define genl_family compat_genl_family + +#define genl_register_family_with_ops compat_genl_register_family_with_ops + +int genl_register_family_with_ops (struct genl_family *family, +struct genl_ops *ops,size_t n_ops); + +#define genl_unregister_family (_family) genl_unregister_family(&(_family)->family) +#define genl_info_net (_info) genl_info_net((_info)->info) +#define genlmsg_reply (_msg, _info) genlmsg_reply(_msg, (_info)->info) +#define genlmsg_put (_skb, _pid, _seq, _fam, _flags, _cmd) genlmsg_put(_skb, _pid, _seq, &(_fam)->family, _flags, _cmd) +#define genl_register_mc_group (_fam, _grp) genl_register_mc_group(&(_fam)->family, _grp) +#define genl_unregister_mc_group (_fam, _grp) genl_unregister_mc_group(&(_fam)->family, _grp) +#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37)) */ #endif /* LINUX_26_37_COMPAT_H */
compat/compat-2.6.37.c +94 -0
98 lines not on this page · raw message
PATCH v2 1/1 compat: backport netlink changes used in the nl80211 cleanup
---
v2:
- fix genl_unregister_family wrapper (removes the family from the internal list)
- fix error handling in doit ops
include/linux/compat-2.6.37.h +62 -0
@@ -45,6 +45,68 @@ static inline void skb_checksum_none_ass#define pcmcia_enable_device (link) pcmcia_request_configuration(link, &link->conf) +#include <net/genetlink.h> + +struct compat_genl_info { +struct genl_info *info; + +u32 snd_seq; +u32 snd_pid; +struct genlmsghdr *genlhdr; +struct nlattr **attrs; +void *user_ptr[2 ]; +}; +#define genl_info compat_genl_info + +struct compat_genl_ops { +struct genl_ops ops; + +u8 cmd; +u8 internal_flags; +unsigned int flags; +const struct nla_policy *policy; + +int (*doit)(struct sk_buff *skb,struct genl_info *info); +int (*dumpit)(struct sk_buff *skb,struct netlink_callback *cb); +int (*done)(struct netlink_callback *cb); +}; +#define genl_ops compat_genl_ops + +struct compat_genl_family { +struct genl_family family; + +struct list_head list; + +unsigned int id, hdrsize, version, maxattr; +const char *name; +bool netnsok; + +struct nlattr **attrbuf; + +int (*pre_doit)(struct genl_ops *ops,struct sk_buff *skb, +struct genl_info *info); + +void (*post_doit)(struct genl_ops *ops,struct sk_buff *skb, +struct genl_info *info); +}; + +#define genl_family compat_genl_family + +#define genl_register_family_with_ops compat_genl_register_family_with_ops + +int genl_register_family_with_ops (struct genl_family *family, +struct genl_ops *ops,size_t n_ops); + +#define genl_unregister_family compat_genl_unregister_family + +int genl_unregister_family (struct genl_family *family); + +#define genl_info_net (_info) genl_info_net((_info)->info) +#define genlmsg_reply (_msg, _info) genlmsg_reply(_msg, (_info)->info) +#define genlmsg_put (_skb, _pid, _seq, _fam, _flags, _cmd) genlmsg_put(_skb, _pid, _seq, &(_fam)->family, _flags, _cmd) +#define genl_register_mc_group (_fam, _grp) genl_register_mc_group(&(_fam)->family, _grp) +#define genl_unregister_mc_group (_fam, _grp) genl_unregister_mc_group(&(_fam)->family, _grp) +#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37)) */ #endif /* LINUX_26_37_COMPAT_H */
compat/compat-2.6.37.c +110 -0
114 lines not on this page · raw message
PATCH v3 1/1 compat: backport netlink changes used in the nl80211 cleanup
---
v2:
- fix genl_unregister_family wrapper (removes the family from the internal list)
- fix error handling in doit ops
v3:
- fix a theoretical race in family unregister
include/linux/compat-2.6.37.h +62 -0
@@ -45,6 +45,68 @@ static inline void skb_checksum_none_ass#define pcmcia_enable_device (link) pcmcia_request_configuration(link, &link->conf) +#include <net/genetlink.h> + +struct compat_genl_info { +struct genl_info *info; + +u32 snd_seq; +u32 snd_pid; +struct genlmsghdr *genlhdr; +struct nlattr **attrs; +void *user_ptr[2 ]; +}; +#define genl_info compat_genl_info + +struct compat_genl_ops { +struct genl_ops ops; + +u8 cmd; +u8 internal_flags; +unsigned int flags; +const struct nla_policy *policy; + +int (*doit)(struct sk_buff *skb,struct genl_info *info); +int (*dumpit)(struct sk_buff *skb,struct netlink_callback *cb); +int (*done)(struct netlink_callback *cb); +}; +#define genl_ops compat_genl_ops + +struct compat_genl_family { +struct genl_family family; + +struct list_head list; + +unsigned int id, hdrsize, version, maxattr; +const char *name; +bool netnsok; + +struct nlattr **attrbuf; + +int (*pre_doit)(struct genl_ops *ops,struct sk_buff *skb, +struct genl_info *info); + +void (*post_doit)(struct genl_ops *ops,struct sk_buff *skb, +struct genl_info *info); +}; + +#define genl_family compat_genl_family + +#define genl_register_family_with_ops compat_genl_register_family_with_ops + +int genl_register_family_with_ops (struct genl_family *family, +struct genl_ops *ops,size_t n_ops); + +#define genl_unregister_family compat_genl_unregister_family + +int genl_unregister_family (struct genl_family *family); + +#define genl_info_net (_info) genl_info_net((_info)->info) +#define genlmsg_reply (_msg, _info) genlmsg_reply(_msg, (_info)->info) +#define genlmsg_put (_skb, _pid, _seq, _fam, _flags, _cmd) genlmsg_put(_skb, _pid, _seq, &(_fam)->family, _flags, _cmd) +#define genl_register_mc_group (_fam, _grp) genl_register_mc_group(&(_fam)->family, _grp) +#define genl_unregister_mc_group (_fam, _grp) genl_unregister_mc_group(&(_fam)->family, _grp) +#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37)) */ #endif /* LINUX_26_37_COMPAT_H */
compat/compat-2.6.37.c +112 -0
116 lines not on this page · raw message
Quoted 1 line · Felix Fietkau
+#define
genl_info_net(_info)genl_info_net((_info)->info)
Need this instead:
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,32)
/* compat for even older kernels already defines this to &init_net */ #define genl_info_net(_info) genl_info_net((_info)->info) #endif
johannes
PATCH v4 1/1 compat: backport netlink changes used in the nl80211 cleanup
In reply to Felix Fietkau---
v2:
- fix genl_unregister_family wrapper (removes the family from the internal list)
- fix error handling in doit ops
v3:
- fix a theoretical race in family unregister
v4:
- remove old genl_register_family_with_ops implementation
- fix genl_info_net redefinition
tested on 2.6.30
include/linux/compat-2.6.37.h +65 -0
@@ -45,6 +45,71 @@ static inline void skb_checksum_none_ass#define pcmcia_enable_device (link) pcmcia_request_configuration(link, &link->conf) +#include <net/genetlink.h> + +struct compat_genl_info { +struct genl_info *info; + +u32 snd_seq; +u32 snd_pid; +struct genlmsghdr *genlhdr; +struct nlattr **attrs; +void *user_ptr[2 ]; +}; +#define genl_info compat_genl_info + +struct compat_genl_ops { +struct genl_ops ops; + +u8 cmd; +u8 internal_flags; +unsigned int flags; +const struct nla_policy *policy; + +int (*doit)(struct sk_buff *skb,struct genl_info *info); +int (*dumpit)(struct sk_buff *skb,struct netlink_callback *cb); +int (*done)(struct netlink_callback *cb); +}; +#define genl_ops compat_genl_ops + +struct compat_genl_family { +struct genl_family family; + +struct list_head list; + +unsigned int id, hdrsize, version, maxattr; +const char *name; +bool netnsok; + +struct nlattr **attrbuf; + +int (*pre_doit)(struct genl_ops *ops,struct sk_buff *skb, +struct genl_info *info); + +void (*post_doit)(struct genl_ops *ops,struct sk_buff *skb, +struct genl_info *info); +}; + +#define genl_family compat_genl_family + +#define genl_register_family_with_ops compat_genl_register_family_with_ops + +int genl_register_family_with_ops (struct genl_family *family, +struct genl_ops *ops,size_t n_ops); + +#define genl_unregister_family compat_genl_unregister_family + +int genl_unregister_family (struct genl_family *family); + +#if (LINUX_VERSION_CODE >=KERNEL_VERSION (2 ,6 ,32 )) +#define genl_info_net (_info) genl_info_net((_info)->info) +#endif + +#define genlmsg_reply (_msg, _info) genlmsg_reply(_msg, (_info)->info) +#define genlmsg_put (_skb, _pid, _seq, _fam, _flags, _cmd) genlmsg_put(_skb, _pid, _seq, &(_fam)->family, _flags, _cmd) +#define genl_register_mc_group (_fam, _grp) genl_register_mc_group(&(_fam)->family, _grp) +#define genl_unregister_mc_group (_fam, _grp) genl_unregister_mc_group(&(_fam)->family, _grp) +#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37)) */ #endif /* LINUX_26_37_COMPAT_H */
compat/compat-2.6.37.c +112 -0
116 lines not on this page · raw message
compat/compat-2.6.31.c deleted +0 -64
64 lines not on this page · raw message
include/linux/compat-2.6.31.h +0 -4
@@ -114,10 +114,6 @@ static inline struct rtable *skb_rtable(return (struct rtable *)skb_dst (skb); } -extern int genl_register_family_with_ops (struct genl_family *family, -struct genl_ops *ops,size_t n_ops); - -/* Backport threaded IRQ support */ static inline
compat/Makefile +0 -1
@@ -23,7 +23,6 @@ compat-$(CONFIG_COMPAT_KERNEL_27) += com compat-$(CONFIG_COMPAT_KERNEL_28) += compat-2.6.28.o compat-$(CONFIG_COMPAT_KERNEL_29) += compat-2.6.29.o compat-$(CONFIG_COMPAT_KERNEL_30) += compat-2.6.30.o -compat-$(CONFIG_COMPAT_KERNEL_31) += compat-2.6.31.o compat-$(CONFIG_COMPAT_KERNEL_32) += compat-2.6.32.o compat-$(CONFIG_COMPAT_KERNEL_33) += compat-2.6.33.o compat-$(CONFIG_COMPAT_KERNEL_35) += compat-2.6.35.o