Subject: Re: [PATCH] netlink: specs: add specification for NBD

From: Donald Hunter <[email-masked]>
Date: Wed, 18 Feb 2026 11:28:44 +0000

Hristo Venev <[email-masked]> writes:

> On Tue, 2026-02-17 at 12:17 +0000, Donald Hunter wrote:
>> There are yamllint errors:
>> 
>> make -C tools/net/ynl lint
>> make: Entering directory '/home/donaldh/net-next/tools/net/ynl'
>> yamllint ../../../Documentation/netlink/specs
>> ../../../Documentation/netlink/specs/nbd.yaml
>>   159:81    error    line too long (104 > 80 characters)  (line-
>> length)
>>   169:6     error    syntax error: expected <block end>, but found
>> '<block mapping start>' (syntax)
>>   170:7     error    wrong indentation: expected 5 but found 6 
>> (indentation)
>
> Thanks, I will fix the lint errors in v2.
>
>> > +doc: See :file:`drivers/block/nbd.c`
>> 
>> Prefer to see a meaningful doc string here.
>
> I will add more proper documentation in v2. I couldn't find any
> existing documentation of this netlink interface, so I guess I will
> write it myself.
>
>> > +attribute-sets:
>> > +  -
>> > +    name: nbd-attrs
>> > +    name-prefix: nbd-attr-
>> > +    doc: Configuration policy attributes, used for CONNECT
>> > +    attributes:
>> > +      -
>> > +        name: unspec
>> > +        value: 0
>> > +        type: unused
>> 
>> No need for unspec in the attribute list, ynl codegen does the right
>> thing.
>
> For me `pyynl.ynl_gen_c --mode uapi --header` no longer generates
> `NBD_ATTR_UNSPEC` if I remove this. Is there a YNL property to specify
> the name of the zero value of the attribute set? If not, should I
> remove it anyway, changing the generated header?

Oh sorry, if your goal is 100% equivalence then I guess you need it. We
have the same in "fou" for example.

>> > +operations:
>> > +  enum-model: unified
>> > +  name-prefix: nbd-cmd-
>> > +  list:
>> > +    -
>> > +      name: unspec
>> > +      value: 0
>> > +      doc: NBD_CMD_UNSPEC
>
> A similar question applies here. If I remove this, `pyynl.ynl_gen_c
> --mode uapi --header` no longer generates `NBD_CMD_UNSPEC`. Is there a
> YNL property to generate it? If not, should I remove it anyway?

You'll need to keep it for equivalence.

>> > +    -
>> > +      name: connect
>> > +      doc: See :file:`drivers/block/nbd.c`,
>> > :code:`nbd_genl_connect()`
>> 
>> Prefer to see meaningful doc string (same for other ops)
>
> I guess I will have to document the four operations in v2 as well.
>
>> > +      attribute-set: nbd-attrs
>> > +      dont-validate: [strict]
>>
>> nbd.c has strict & dump, should this be [strict, dump] ? (same for
>> other ops)
>
> The NBD operations don't have `dump`, only `do`, so adding `dump` to
> `dont-validate` does not change the output of `pyynl.ynl_gen_c --mode
> kernel --source`. Should I add it anyway?

Ah, so it's redundant in nbd.c.

Thanks,
Donald.