[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK7LNARAsyOparQ1YxgPh9S4A-uzF04k+91t7Xy1jdTy6uT+Vg@mail.gmail.com>
Date: Thu, 14 Nov 2024 05:32:46 +0900
From: Masahiro Yamada <masahiroy@...nel.org>
To: Jacob Keller <jacob.e.keller@...el.com>
Cc: Vladimir Oltean <olteanv@...il.com>, Andrew Morton <akpm@...ux-foundation.org>,
Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Tony Nguyen <anthony.l.nguyen@...el.com>, Przemek Kitszel <przemyslaw.kitszel@...el.com>,
netdev <netdev@...r.kernel.org>, linux-kbuild@...r.kernel.org,
Vladimir Oltean <vladimir.oltean@....com>
Subject: Re: [PATCH net-next v5 3/9] lib: packing: add pack_fields() and unpack_fields()
On Mon, Nov 11, 2024 at 5:08 PM Jacob Keller <jacob.e.keller@...el.com> wrote:
>
> From: Vladimir Oltean <vladimir.oltean@....com>
>
> This is new API which caters to the following requirements:
>
> - Pack or unpack a large number of fields to/from a buffer with a small
> code footprint. The current alternative is to open-code a large number
> of calls to pack() and unpack(), or to use packing() to reduce that
> number to half. But packing() is not const-correct.
>
> - Use unpacked numbers stored in variables smaller than u64. This
> reduces the rodata footprint of the stored field arrays.
>
> - Perform error checking at compile time, rather than runtime, and return
> void from the API functions. Because the C preprocessor can't generat
> variable length code (loops), we can't easily use macros to implement the
> overlap checks at compile time.
>
> Instead, check for field ordering and overlap in modpost.
This is over-engineering.
modpost should not be bothered just for a small library like this.
Please do sanity checks within lib/packing.c
--
Best Regards
Masahiro Yamada
Powered by blists - more mailing lists