net: ynl: prefix uAPI header include with uapi/
Subsystems (4)
Jakub Kicinski
maintainerPATCH 1/1 net: ynl: prefix uAPI header include with uapi/
To keep things simple we used to include the uAPI header in the kernel in the #include <linux/$family.h> format. This works well enough, most of the genl families should have headers in include/net/ so linux/$family.h ends up referring to the uAPI header, anyway. And if it doesn't no big deal, we'll just include more info than we need.
Unless that is there is a naming conflict. Someone recently created include/linux/psp.h which will be a problem when supporting the PSP protocol. (I'm talking about work-in-progress patches, but it's just a proof that assuming lack of name conflicts was overly optimistic.)
---
CC: [email protected]
--- net/core/netdev-genl-gen.c | 2 +- net/core/netdev-genl-gen.h | 2 +- net/handshake/genl.c | 2 +- net/handshake/genl.h | 2 +- net/ipv4/fou_nl.c | 2 +- net/ipv4/fou_nl.h | 2 +- tools/net/ynl/ynl-gen-c.py | 4 +++- 7 files changed, 9 insertions(+), 7 deletions(-)
net/core/netdev-genl-gen.c +1 -1
@@ -8,7 +8,7 @@#include "netdev-genl-gen.h" -#include <linux/netdev.h> +#include <uapi/linux/netdev.h> /* NETDEV_CMD_DEV_GET - do */ static const struct nla_policy netdev_dev_get_nl_policy[NETDEV_A_DEV_IFINDEX +1 ] = {
net/core/netdev-genl-gen.h +1 -1
@@ -9,7 +9,7 @@#include <net/netlink.h> #include <net/genetlink.h> -#include <linux/netdev.h> +#include <uapi/linux/netdev.h> int netdev_nl_dev_get_doit (struct sk_buff *skb,struct genl_info *info);int netdev_nl_dev_get_dumpit (struct sk_buff *skb,struct netlink_callback *cb);
net/handshake/genl.c +1 -1
@@ -8,7 +8,7 @@#include "genl.h" -#include <linux/handshake.h> +#include <uapi/linux/handshake.h> /* HANDSHAKE_CMD_ACCEPT - do */ static const struct nla_policy handshake_accept_nl_policy[HANDSHAKE_A_ACCEPT_HANDLER_CLASS +1 ] = {
net/handshake/genl.h +1 -1
@@ -9,7 +9,7 @@#include <net/netlink.h> #include <net/genetlink.h> -#include <linux/handshake.h> +#include <uapi/linux/handshake.h> int handshake_nl_accept_doit (struct sk_buff *skb,struct genl_info *info);int handshake_nl_done_doit (struct sk_buff *skb,struct genl_info *info);
net/ipv4/fou_nl.c +1 -1
@@ -8,7 +8,7 @@#include "fou_nl.h" -#include <linux/fou.h> +#include <uapi/linux/fou.h> /* Global operation policy for fou */ const struct nla_policy fou_nl_policy[FOU_ATTR_IFINDEX +1 ] = {
net/ipv4/fou_nl.h +1 -1
@@ -9,7 +9,7 @@#include <net/netlink.h> #include <net/genetlink.h> -#include <linux/fou.h> +#include <uapi/linux/fou.h> /* Global operation policy for fou */ extern const struct nla_policy fou_nl_policy[FOU_ATTR_IFINDEX +1 ];
tools/net/ynl/ynl-gen-c.py +3 -1
@@ -2101,7 +2101,9 @@ _C_KW = { if args.out_file: cw.p(f'#include "{os.path.basename(args.out_file[:-2])}.h"') cw.nl() - headers = [parsed.uapi_header] + headers = ['uapi/' + parsed.uapi_header] + else: + headers = [parsed.uapi_header] for definition in parsed['definitions']: if 'header' in definition: headers.append(definition['header'])
Signature · 1 line
2.40.1
Quoted 7 lines · Jakub Kicinski
To keep things simple we used to include the uAPI header in the kernel in the #include <
linux/$family.h> format. This works well enough, most of the genl families should have headers ininclude/net/solinux/$family.hends up referring to the uAPI header, anyway. And if it doesn't no big deal, we'll just include more info than we need.
Quoted 7 lines
Unless that is there is a naming conflict. Someone recently created
include/linux/psp.hwhich will be a problem when supporting the PSP protocol. (I'm talking about work-in-progress patches, but it's just a proof that assuming lack of name conflicts was overly optimistic.)Signed-off-by Jakub Kicinski <[email protected]>
This patch was applied to netdev/net-next.git (main) by David S. Miller <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by David S. Miller <[email protected]>:
Quoted 8 lines · On Wed, 24 May 2023 10:09:01 -0700 you wrote:
To keep things simple we used to include the uAPI header in the kernel in the #include <
linux/$family.h> format. This works well enough, most of the genl families should have headers ininclude/net/solinux/$family.hends up referring to the uAPI header, anyway. And if it doesn't no big deal, we'll just include more info than we need.[...]
Here is the summary with links:
- [net-next] net: ynl: prefix uAPI header include with uapi/
https://git.kernel.org/netdev/net-next/c/9b66ee06e5ca
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html