Skip to content

Commit

Permalink
netlink: specs: add display-hint to schema definitions
Browse files Browse the repository at this point in the history
Add a display-hint property to the netlink schema that is for providing
optional hints to generic netlink clients about how to display attribute
values. A display-hint on an attribute definition is intended for
letting a client such as ynl know that, for example, a u32 should be
rendered as an ipv4 address. The display-hint enumeration includes a
small number of networking domain-specific value types.

Signed-off-by: Donald Hunter <donald.hunter@gmail.com>
Link: https://lore.kernel.org/r/20230623201928.14275-2-donald.hunter@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Donald Hunter authored and Jakub Kicinski committed Jun 24, 2023
1 parent 2ffecf1 commit 737eab7
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
6 changes: 6 additions & 0 deletions Documentation/netlink/genetlink-c.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,12 @@ properties:
description: Max length for a string or a binary attribute.
$ref: '#/$defs/len-or-define'
sub-type: *attr-type
display-hint: &display-hint
description: |
Optional format indicator that is intended only for choosing
the right formatting mechanism when displaying values of this
type.
enum: [ hex, mac, fddi, ipv4, ipv6, uuid ]
# Start genetlink-c
name-prefix:
type: string
Expand Down
11 changes: 10 additions & 1 deletion Documentation/netlink/genetlink-legacy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ properties:
name:
type: string
type:
enum: [ u8, u16, u32, u64, s8, s16, s32, s64, string ]
description: The netlink attribute type
enum: [ u8, u16, u32, u64, s8, s16, s32, s64, string, binary ]
len:
$ref: '#/$defs/len-or-define'
byte-order:
Expand All @@ -130,6 +131,12 @@ properties:
enum:
description: Name of the enum type used for the attribute.
type: string
display-hint: &display-hint
description: |
Optional format indicator that is intended only for choosing
the right formatting mechanism when displaying values of this
type.
enum: [ hex, mac, fddi, ipv4, ipv6, uuid ]
# End genetlink-legacy

attribute-sets:
Expand Down Expand Up @@ -179,6 +186,7 @@ properties:
name:
type: string
type: &attr-type
description: The netlink attribute type
enum: [ unused, pad, flag, binary, u8, u16, u32, u64, s32, s64,
string, nest, array-nest, nest-type-value ]
doc:
Expand Down Expand Up @@ -226,6 +234,7 @@ properties:
description: Max length for a string or a binary attribute.
$ref: '#/$defs/len-or-define'
sub-type: *attr-type
display-hint: *display-hint
# Start genetlink-c
name-prefix:
type: string
Expand Down
6 changes: 6 additions & 0 deletions Documentation/netlink/genetlink.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,12 @@ properties:
description: Max length for a string or a binary attribute.
$ref: '#/$defs/len-or-define'
sub-type: *attr-type
display-hint: &display-hint
description: |
Optional format indicator that is intended only for choosing
the right formatting mechanism when displaying values of this
type.
enum: [ hex, mac, fddi, ipv4, ipv6, uuid ]

# Make sure name-prefix does not appear in subsets (subsets inherit naming)
dependencies:
Expand Down

0 comments on commit 737eab7

Please sign in to comment.