Re: [RFC net-next 2/4] ynl: add the schema for the schemas

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 15 Aug 2022 22:09:11 +0200 Johannes Berg wrote:
> On Wed, 2022-08-10 at 19:23 -0700, Jakub Kicinski wrote:
> > 
> > +        attributes:
> > +          description: List of attributes in the space.
> > +          type: array
> > +          items:
> > +            type: object
> > +            required: [ name, type ]
> > +            additionalProperties: False
> > +            properties:
> > +              name:
> > +                type: string
> > +              type: &attr-type
> > +                enum: [ unused, flag, binary, u8, u16, u32, u64, s32, s64,
> > +                        nul-string, multi-attr, nest, array-nest, nest-type-value ]  
> 
> nest-type-value?

It's the incredibly inventive nesting format used in genetlink policy
dumps where the type of the sub-attr(s there are actually two levels)
carry a value (index of the policy and attribute) rather than denoting
a type :S :S :S

I really need to document the types, I know...

> > +              description:
> > +                description: Documentation of the attribute.
> > +                type: string
> > +              type-value:
> > +                description: Name of the value extracted from the type of a nest-type-value attribute.
> > +                type: array
> > +                items:
> > +                  type: string
> > +              len:
> > +                oneOf: [ { type: string }, { type: integer }]
> > +              sub-type: *attr-type
> > +              nested-attributes:
> > +                description: Name of the space (sub-space) used inside the attribute.
> > +                type: string  
> 
> Maybe expand that description a bit, it's not really accurate for
> "array-nest"?

Slightly guessing but I think I know what you mean -> the value of the
array is a nest with index as the type and then inside that is the
entry of the array with its attributes <- and that's where the space is
applied, not at the first nest level?

Right, I should probably put that in the docs rather than the schema,
array-nests are expected to strip one layer of nesting and put the
value taken from the type (:D) into an @idx member of the struct
representing the values of the array. Or at least that's what I do in
the C codegen.

Not that any of these beautiful, precious formats should be encouraged
going forward. multi-attr all the way!

> > +              enum:
> > +                description: Name of the enum used for the atttribute.  
> 
> typo - attribute

Thanks!

> Do you mean the "name of the enumeration" or the "name of the
> enumeration constant"? (per C99 concepts) I'm a bit confused? I guess
> you mean the "name of the enumeration constant" though I agree most
> people probably don't know the names from C99 (I had to look them up too
> for the sake of being precise here ...)

I meant the type. I think. When u32 carries values of an enum.
Enumeration constant for the attribute type is constructed from
it's name and the prefix/suffix kludge.



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux