[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f802d21a-e6cb-f947-2e52-8553f5e255d5@web.de>
Date: Fri, 20 Dec 2019 19:00:09 +0100
From: Markus Elfring <Markus.Elfring@....de>
To: "Theodore Y. Ts'o" <tytso@....edu>, linux-doc@...r.kernel.org,
kernel-janitors@...r.kernel.org
Cc: LKML <linux-kernel@...r.kernel.org>
Subject: Re: Improving documentation for programming interfaces
>> Further examples:
>> * kmalloc ⇒ kfree
>> * kobject_create ⇒ kobject_put
>> * device_register ⇒ put_device
>>
>> Can preprocessor macros help to express any more relationships for similar function pairs?
>
> Sorry, this is still not making sense.
I suggest to reconsider such a view.
> … You said "a pointer would
> contain also the background information by which the resource should
> usually be released". Huh? There's no room for a pointer to also
> store context of whether it was allocated using kmalloc, or malloc, etc.
There are metadata (software documentation) to consider in the source code.
You get usually informed by comments for some allocation functions
which is the corresponding resource release function.
Such comments can vary. Thus I would appreciate to work with these data
in a more structured format.
> Did you have some concrete idea of how a preprocessor macros could be
> used to perform what appears to be completely impractical?
A macro can be chosen to which function names can be passed.
Example:
TRIGGER_RELEASE_AFTER(kfree, kmalloc, kcalloc, kzalloc, kmemdup)
Appropriate data type definitions could eventually be generated
by related macros.
> And how would that information be used by the kernel?
Documentation purposes.
> And for what benefit?
Consistent representation of relationships in a structured way.
> And can you show that the benefits will be worth the costs?
I propose to improve possibilities also for the support of better
source code analysis.
Regards,
Markus
Powered by blists - more mailing lists