On Sep 04, 2007, at 02:16, Christoph Bartelmus wrote:
> Matthias Schwarzott "zzam@..." wrote:
>> About the compat stuff: I also follow dvb development so I think
>> approach is sane and easy maintainable.
>> My impression is:
>> A script strips:
>> * All inclusions of compat.h.
>> * All #if 0 ... #endif sequences
>> * All #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) ...
>> #else ... #endif
> Yes, I think this should be the way to go. With this approach there is
> only one source that has to be maintained. The in-kernel version
> be automatically generated from that.
Just started poking at unifdef... Its definitely a piece of cake to
script up stripping out the compat bits with unifdef. I'm not seeing
a direct way to immediately strip things, but if everything follows
the same format '#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6,
something less than latest)', then a quick sed to strip the '<
KERNEL_VERSION()' portion and 'unifdef -DLINUX_VERSION_CODE=0' does
the trick. For example:
$ cat lirc_atiusb.c | sed -e 's/< KERNEL_VERSION.*//g' | unifdef -
Diffing the original file with the output from that string looks sane