Re: [PATCH v6 1/2] net/handshake: Create a NETLINK service for handling handshake requests

Chuck Lever III
2023-03-04T17:25:32Z

> On Mar 3, 2023, at 9:21 PM, Jakub Kicinski <kuba@kernel.org> wrote:
>
> On Fri, 03 Mar 2023 13:51:31 -0500 Chuck Lever wrote:
>
>> +static const struct genl_split_ops handshake_nl_ops[] = {
>> + {
>> + .cmd = HANDSHAKE_CMD_ACCEPT,
>> + .doit = handshake_nl_accept_doit,
>> + .policy = handshake_accept_nl_policy,
>> + .maxattr = HANDSHAKE_A_ACCEPT_HANDLER_CLASS,
>> + .flags = GENL_ADMIN_PERM | GENL_CMD_CAP_DO,
>> + },
>> + {
>> + .cmd = HANDSHAKE_CMD_DONE,
>> + .doit = handshake_nl_done_doit,
>> + .policy = handshake_done_nl_policy,
>> + .maxattr = HANDSHAKE_A_DONE_MAX,
>> + .flags = GENL_CMD_CAP_DO,
>> + },
>> +};
>> +
>> +static const struct genl_multicast_group handshake_nl_mcgrps[] = {
>> + [HANDSHAKE_HANDLER_CLASS_NONE] = { .name = HANDSHAKE_MCGRP_NONE, },
>> +};
>> +
>> +static struct genl_family __ro_after_init handshake_genl_family = {
>> + .hdrsize = 0,
>> + .name = HANDSHAKE_FAMILY_NAME,
>> + .version = HANDSHAKE_FAMILY_VERSION,
>> + .netnsok = true,
>> + .parallel_ops = true,
>> + .n_mcgrps = ARRAY_SIZE(handshake_nl_mcgrps),
>> + .n_split_ops = ARRAY_SIZE(handshake_nl_ops),
>> + .split_ops = handshake_nl_ops,
>> + .mcgrps = handshake_nl_mcgrps,
>> + .module = THIS_MODULE,
>> +};
>
> You're not auto-generating the family, ops, and policies?
> Any reason?

I couldn't find a way to have the generated source appear
in the middle of a source file. But I see that's not the
way others are doing it, so I have added separate files
under net/handshake for the generated source and header
material. Two things, though:

1. I don't see a generated struct genl_family.

2. The SPDX tags in the generated source files is "BSD
3-clause", but the tag in my spec is "GPL-2.0 with
syscall note". Oddly, the generated uapi header still
has the latter (correct) tag.

--
Chuck Lever