mirror of
https://github.com/hanwckf/immortalwrt-mt798x.git
synced 2025-01-10 03:09:08 +08:00
kernel: fix swconfig compilation with kernels 5.2+
This is related to the upstream kernel change 3b0f31f2b8c9 ("genetlink: make policy common to family"). Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
This commit is contained in:
parent
d22c1755fc
commit
b49f2113cc
@ -1001,55 +1001,75 @@ static struct genl_ops swconfig_ops[] = {
|
|||||||
{
|
{
|
||||||
.cmd = SWITCH_CMD_LIST_GLOBAL,
|
.cmd = SWITCH_CMD_LIST_GLOBAL,
|
||||||
.doit = swconfig_list_attrs,
|
.doit = swconfig_list_attrs,
|
||||||
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 2, 0)
|
||||||
.policy = switch_policy,
|
.policy = switch_policy,
|
||||||
|
#endif
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.cmd = SWITCH_CMD_LIST_VLAN,
|
.cmd = SWITCH_CMD_LIST_VLAN,
|
||||||
.doit = swconfig_list_attrs,
|
.doit = swconfig_list_attrs,
|
||||||
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 2, 0)
|
||||||
.policy = switch_policy,
|
.policy = switch_policy,
|
||||||
|
#endif
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.cmd = SWITCH_CMD_LIST_PORT,
|
.cmd = SWITCH_CMD_LIST_PORT,
|
||||||
.doit = swconfig_list_attrs,
|
.doit = swconfig_list_attrs,
|
||||||
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 2, 0)
|
||||||
.policy = switch_policy,
|
.policy = switch_policy,
|
||||||
|
#endif
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.cmd = SWITCH_CMD_GET_GLOBAL,
|
.cmd = SWITCH_CMD_GET_GLOBAL,
|
||||||
.doit = swconfig_get_attr,
|
.doit = swconfig_get_attr,
|
||||||
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 2, 0)
|
||||||
.policy = switch_policy,
|
.policy = switch_policy,
|
||||||
|
#endif
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.cmd = SWITCH_CMD_GET_VLAN,
|
.cmd = SWITCH_CMD_GET_VLAN,
|
||||||
.doit = swconfig_get_attr,
|
.doit = swconfig_get_attr,
|
||||||
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 2, 0)
|
||||||
.policy = switch_policy,
|
.policy = switch_policy,
|
||||||
|
#endif
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.cmd = SWITCH_CMD_GET_PORT,
|
.cmd = SWITCH_CMD_GET_PORT,
|
||||||
.doit = swconfig_get_attr,
|
.doit = swconfig_get_attr,
|
||||||
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 2, 0)
|
||||||
.policy = switch_policy,
|
.policy = switch_policy,
|
||||||
|
#endif
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.cmd = SWITCH_CMD_SET_GLOBAL,
|
.cmd = SWITCH_CMD_SET_GLOBAL,
|
||||||
.flags = GENL_ADMIN_PERM,
|
.flags = GENL_ADMIN_PERM,
|
||||||
.doit = swconfig_set_attr,
|
.doit = swconfig_set_attr,
|
||||||
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 2, 0)
|
||||||
.policy = switch_policy,
|
.policy = switch_policy,
|
||||||
|
#endif
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.cmd = SWITCH_CMD_SET_VLAN,
|
.cmd = SWITCH_CMD_SET_VLAN,
|
||||||
.flags = GENL_ADMIN_PERM,
|
.flags = GENL_ADMIN_PERM,
|
||||||
.doit = swconfig_set_attr,
|
.doit = swconfig_set_attr,
|
||||||
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 2, 0)
|
||||||
.policy = switch_policy,
|
.policy = switch_policy,
|
||||||
|
#endif
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.cmd = SWITCH_CMD_SET_PORT,
|
.cmd = SWITCH_CMD_SET_PORT,
|
||||||
.flags = GENL_ADMIN_PERM,
|
.flags = GENL_ADMIN_PERM,
|
||||||
.doit = swconfig_set_attr,
|
.doit = swconfig_set_attr,
|
||||||
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 2, 0)
|
||||||
.policy = switch_policy,
|
.policy = switch_policy,
|
||||||
|
#endif
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
.cmd = SWITCH_CMD_GET_SWITCH,
|
.cmd = SWITCH_CMD_GET_SWITCH,
|
||||||
.dumpit = swconfig_dump_switches,
|
.dumpit = swconfig_dump_switches,
|
||||||
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 2, 0)
|
||||||
.policy = switch_policy,
|
.policy = switch_policy,
|
||||||
|
#endif
|
||||||
.done = swconfig_done,
|
.done = swconfig_done,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -1062,6 +1082,9 @@ static struct genl_family switch_fam = {
|
|||||||
.hdrsize = 0,
|
.hdrsize = 0,
|
||||||
.version = 1,
|
.version = 1,
|
||||||
.maxattr = SWITCH_ATTR_MAX,
|
.maxattr = SWITCH_ATTR_MAX,
|
||||||
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 2, 0)
|
||||||
|
.policy = switch_policy,
|
||||||
|
#endif
|
||||||
.module = THIS_MODULE,
|
.module = THIS_MODULE,
|
||||||
.ops = swconfig_ops,
|
.ops = swconfig_ops,
|
||||||
.n_ops = ARRAY_SIZE(swconfig_ops),
|
.n_ops = ARRAY_SIZE(swconfig_ops),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user