[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <5e2b3c47-7117-4529-a54e-e634d40b7763@intel.com>
Date: Thu, 4 Jul 2024 09:23:25 +0200
From: Przemek Kitszel <przemyslaw.kitszel@...el.com>
To: Jakub Kicinski <kuba@...nel.org>
CC: Jiri Pirko <jiri@...nulli.us>, "netdev@...r.kernel.org"
<netdev@...r.kernel.org>
Subject: Re: [RFC net-next] generate boilerplate impls such as
devlink_resource_register()
On 7/4/24 02:51, Jakub Kicinski wrote:
> On Wed, 3 Jul 2024 12:13:58 +0200 Przemek Kitszel wrote:
>> I have and idea that boilerplate devlink_ wrappers over devl_ functions
>> could be generated via short script, with the handcrafted .c code as the
>> only input. Take for example the following [one line] added to
>> devlink/resource.c would replace the whole definition and kdoc, which
>> would be placed in the generated file in about the same form as the
>> current code. This will be applied to all suitable functions of course.
>
> How?
there are two options:
1. function is declared in .h but there is no impl in .c; a little magic
2. there is a line requesting to generate implementation, typically put
just below devl_ variant; makes more sense for me
if you rather ask "how applied" instead of "how decided":
a. a helper shell script finds functions to generate (the list could be
saved as an intermediate to speed up (to don't go through the rest)
b. the main script generates gen_devlink_wrappers.c file
(instead of intermediate file in step a., the output from step b. could
be `cmp || mv`, aka "don't touch if the same", to avoid .o invalidation)
>
>> The script will be short, but not so trivial to write it without prior
>> RFC. For those wondering if I don't have better things to do: yes, but
>> I have also some awk-time that will not be otherwise spend on more
>> serious stuff anyway :)
>
> What's the exchange rate from awk-time to other types of time?
I spend there only between a few and several percent of my time, but it
yields returns counted in months of C/++ devel saved :P (not saying
about this thread of course ;))
Powered by blists - more mailing lists