Re: [PATCH net-next v5 3/9] lib: packing: add pack_fields() and unpack_fields()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Nov 11, 2024 at 5:08 PM Jacob Keller <jacob.e.keller@xxxxxxxxx> wrote:
>
> From: Vladimir Oltean <vladimir.oltean@xxxxxxx>
>
> 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





[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux