[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231218142310.1f10f8f4@kernel.org>
Date: Mon, 18 Dec 2023 14:23:10 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: Hangbin Liu <liuhangbin@...il.com>
Cc: netdev@...r.kernel.org, Paolo Abeni <pabeni@...hat.com>
Subject: Re: [PATCH net-next 2/3] tools: ynl-gen: support using defines in
checks
On Sat, 16 Dec 2023 16:44:30 +0800 Hangbin Liu wrote:
> On Fri, Dec 15, 2023 at 06:08:24PM -0800, Jakub Kicinski wrote:
> > On Fri, 15 Dec 2023 11:50:08 +0800 Hangbin Liu wrote:
> > > - pattern: ^[0-9A-Za-z_]+( - 1)?$
> > > + pattern: ^[0-9A-Za-z_-]+( - 1)?$
> >
> > Why the '-' ? Could you add an example of the define you're trying to
> > match to the commit message?
> For team driver, there is a define like:
>
> #define TEAM_STRING_MAX_LEN 32
>
> So I'd like to define it in yaml like:
>
> definitions:
> -
> name: string-max-len
> type: const
> value: 32
>
> And use it in the attribute-sets like
>
> attribute-sets:
> -
> name: attr-option
> name-prefix: team-attr-option-
> attributes:
> -
> name: unspec
> type: unused
> value: 0
> -
> name: name
> type: string
> checks:
> len: string-max-len
>
> With this patch it will be converted to
>
> [TEAM_ATTR_OPTION_NAME] = { .type = NLA_STRING, .len = TEAM_STRING_MAX_LEN, }
Ah, I see. The spec match needs to work on names before they go thru
c_upper(). The patch makes sense:
Reviewed-by: Jakub Kicinski <kuba@...nel.org>
Powered by blists - more mailing lists