Re: RFC: Testing for kernel features in external modules
From: Andreas Dilger
Date: Thu Jun 24 2004 - 15:38:00 EST
On Jun 24, 2004 22:30 +0200, Sam Ravnborg wrote:
> +if [ -f remap4.o ]; then
> + echo "#define REMAP4 1" > $2
> +elif [ -f remap5.o ]; then
> + echo "#define REMAP5 1" > $2
I would prefer that these be called something like HAVE_REMAP5, or
better yet something descriptive like HAVE_REMAP_PAGE_RANGE_VMA.
This obviously needs to be smarter also, to handle adding multiple
#defines to a single .h file.
Ideally, when people make an incompatible kernel API change like this
they would just #define HAVE_REMAP_PAGE_RANGE_VMA in the header that
declares remap_page_range() directly (e.g. KERNEL_AS_O_DIRECT was added
for this reason) instead of external builds having to figure this out
themselves. Adding the check script is no less work than just adding
the #define to the appropriate header directly.
Having something like "features.h" is only useful as far as it checks
for features that applications care about. If it doesn't have checks
for features, then the apps need to implement those checks anyways
and different apps will name the script/#define differently so until
they make it into the stock kernel it isn't terribly useful.
Description: PGP signature