All of lore.kernel.org
 help / color / mirror / Atom feed
From: Donald Hunter <donald.hunter@gmail.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: davem@davemloft.net,  netdev@vger.kernel.org,
	 edumazet@google.com, pabeni@redhat.com,  andrew+netdev@lunn.ch,
	 horms@kernel.org, almasrymina@google.com,  sdf@fomichev.me
Subject: Re: [PATCH net-next 4/5] tools: ynl-gen: print setters for multi-val attrs
Date: Wed, 23 Jul 2025 10:15:19 +0100	[thread overview]
Message-ID: <m2h5z39sk8.fsf@gmail.com> (raw)
In-Reply-To: <20250722161927.3489203-5-kuba@kernel.org>

Jakub Kicinski <kuba@kernel.org> writes:

> For basic types we "flatten" setters. If a request "a" has a simple
> nest "b" with value "val" we print helpers like:
>
>  req_set_a_b(struct a *req, int val)
>  {
>    req->_present.a = 1;
>    req->b._present.val = 1;
>    req->b.val = ...
>  }
>
> This is not possible for multi-attr because they have to be allocated
> dynamically by the user. Print "object level" setters so that user
> preparing the object doesn't have to futz with the presence bits
> and other YNL internals.
>
> Add the ability to pass in the variable name to generated setters.
> Using "req" here doesn't feel right, while the attr is part of a request
> it's not the request itself, so it seems cleaner to call it "obj".
>
> Example:
>
>  static inline void
>  netdev_queue_id_set_id(struct netdev_queue_id *obj, __u32 id)
>  {
> 	obj->_present.id = 1;
> 	obj->id = id;
>  }
>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Reviewed-by: Donald Hunter <donald.hunter@gmail.com>

  reply	other threads:[~2025-07-23  9:16 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-22 16:19 [PATCH net-next 0/5] tools: ynl-gen: print setters for multi-val attrs Jakub Kicinski
2025-07-22 16:19 ` [PATCH net-next 1/5] tools: ynl-gen: don't add suffix for pure types Jakub Kicinski
2025-07-23  8:52   ` Donald Hunter
2025-07-22 16:19 ` [PATCH net-next 2/5] tools: ynl-gen: move free printing to the print_type_full() helper Jakub Kicinski
2025-07-23  8:58   ` Donald Hunter
2025-07-22 16:19 ` [PATCH net-next 3/5] tools: ynl-gen: print alloc helper for multi-val attrs Jakub Kicinski
2025-07-23  9:07   ` Donald Hunter
2025-07-22 16:19 ` [PATCH net-next 4/5] tools: ynl-gen: print setters " Jakub Kicinski
2025-07-23  9:15   ` Donald Hunter [this message]
2025-07-22 16:19 ` [PATCH net-next 5/5] selftests: drv-net: devmem: use new mattr ynl helpers Jakub Kicinski
2025-07-22 21:05   ` Mina Almasry
2025-07-23  9:15   ` Donald Hunter
2025-07-22 23:37 ` [PATCH net-next 0/5] tools: ynl-gen: print setters for multi-val attrs Stanislav Fomichev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2h5z39sk8.fsf@gmail.com \
    --to=donald.hunter@gmail.com \
    --cc=almasrymina@google.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sdf@fomichev.me \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.