From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
To: Jakub Kicinski <kuba@kernel.org>, davem@davemloft.net
Cc: netdev@vger.kernel.org, edumazet@google.com, pabeni@redhat.com,
donald.hunter@gmail.com, jiri@resnulli.us, sdf@google.com
Subject: Re: [PATCH net-next v2 02/15] tools: ynl: create local attribute helpers
Date: Tue, 27 Feb 2024 12:05:31 +0100 [thread overview]
Message-ID: <8047ae8d-e2c0-4818-942d-2581ab56ad6d@6wind.com> (raw)
In-Reply-To: <20240226212021.1247379-3-kuba@kernel.org>
Le 26/02/2024 à 22:20, Jakub Kicinski a écrit :
> Don't use mnl attr helpers, we're trying to remove the libmnl
> dependency. Create both signed and unsigned helpers, libmnl
> had unsigned helpers, so code generator no longer needs
> the mnl_type() hack.
>
> The new helpers are written from first principles, but are
> hopefully not too buggy.
>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> --
> v2:
> - NLA_ALIGN(sizeof(struct nlattr)) -> NLA_HDRLEN;
> - ...put_strz() -> ...put_str()
> - use ynl_attr_data() in ynl_attr_get_{str,s8,u8}()
[snip]
> +static inline __s8 ynl_attr_get_s8(const struct nlattr *attr)
> +{
> + return *(__s8 *)ynl_attr_data(attr);
> +}
> +
> +static inline __s16 ynl_attr_get_s16(const struct nlattr *attr)
> +{
> + __s16 tmp;
> +
> + memcpy(&tmp, (unsigned char *)(attr + 1), sizeof(tmp));
The same would work here, am I wrong?
return *(__s16 *)ynl_attr_data(attr);
Same for all kind of int.
next prev parent reply other threads:[~2024-02-27 11:05 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-26 21:20 [PATCH net-next v2 00/15] tools: ynl: stop using libmnl Jakub Kicinski
2024-02-26 21:20 ` [PATCH net-next v2 01/15] tools: ynl: give up on libmnl for auto-ints Jakub Kicinski
2024-02-27 10:38 ` Nicolas Dichtel
2024-02-26 21:20 ` [PATCH net-next v2 02/15] tools: ynl: create local attribute helpers Jakub Kicinski
2024-02-27 11:05 ` Nicolas Dichtel [this message]
2024-02-27 14:56 ` Jakub Kicinski
2024-02-27 15:10 ` Nicolas Dichtel
2024-02-26 21:20 ` [PATCH net-next v2 03/15] tools: ynl: create local for_each helpers Jakub Kicinski
2024-02-26 21:20 ` [PATCH net-next v2 04/15] tools: ynl: create local nlmsg access helpers Jakub Kicinski
2024-02-26 21:20 ` [PATCH net-next v2 05/15] tools: ynl: create local ARRAY_SIZE() helper Jakub Kicinski
2024-02-26 21:20 ` [PATCH net-next v2 06/15] tools: ynl: make yarg the first member of struct ynl_dump_state Jakub Kicinski
2024-02-26 21:20 ` [PATCH net-next v2 07/15] tools: ynl-gen: remove unused parse code Jakub Kicinski
2024-02-26 21:20 ` [PATCH net-next v2 08/15] tools: ynl: wrap recv() + mnl_cb_run2() into a single helper Jakub Kicinski
2024-02-26 21:20 ` [PATCH net-next v2 09/15] tools: ynl: use ynl_sock_read_msgs() for ACK handling Jakub Kicinski
2024-02-26 21:20 ` [PATCH net-next v2 10/15] tools: ynl: stop using mnl_cb_run2() Jakub Kicinski
2024-02-27 11:06 ` Nicolas Dichtel
2024-02-26 21:20 ` [PATCH net-next v2 11/15] tools: ynl: switch away from mnl_cb_t Jakub Kicinski
2024-02-26 21:20 ` [PATCH net-next v2 12/15] tools: ynl: switch away from MNL_CB_* Jakub Kicinski
2024-02-26 21:20 ` [PATCH net-next v2 13/15] tools: ynl: stop using mnl socket helpers Jakub Kicinski
2024-02-26 21:20 ` [PATCH net-next v2 14/15] tools: ynl: remove the libmnl dependency Jakub Kicinski
2024-02-26 21:20 ` [PATCH net-next v2 15/15] tools: ynl: use MSG_DONTWAIT for getting notifications Jakub Kicinski
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=8047ae8d-e2c0-4818-942d-2581ab56ad6d@6wind.com \
--to=nicolas.dichtel@6wind.com \
--cc=davem@davemloft.net \
--cc=donald.hunter@gmail.com \
--cc=edumazet@google.com \
--cc=jiri@resnulli.us \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sdf@google.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).