[PATCH] standardize on KERNEL_VERSION(a,b,c) test

Bernhard Fischer rep.nop at aon.at
Thu Mar 30 13:24:03 UTC 2006


On Thu, Mar 30, 2006 at 07:51:04AM -0500, Robert P. J. Day wrote:
>
>  NOTE:  i'm a bit iffy on some of the tests shown below.  for
>instance, the test in mke2fs.c seems reasonable:
>
>if (linux_version_code && linux_version_code < KERNEL_VERSION(2,2,0))
>
>but the one in rmmod.c is a little curious:
>
>if (get_kernel_revision() <= KERNEL_VERSION(2,6,0))
>                          ^^
>
>"<="??  that is, 2.6.0 and below should be treated differently from
>2.6.1 and above?

Very possible.

>                  could that be a typo that should read just "<"?
>perhaps all of the tests should be double-checked, just to play it
>safe.
>
>  also, interface.c contains the following test:
>
>if (get_kernel_revision() < KERNEL_VERSION(2, 1, 0))
>
>i've mentioned this before -- should busybox be testing for versions
>that correspond to experimental kernel releases?  why is this testing

Why should we not test against experimental kernel releases resp.
versions with odd minor numbers?

>against kernel 2.1.0?  just curious.
>
>
>diff -pru busybox.orig/e2fsprogs/mke2fs.c busybox/e2fsprogs/mke2fs.c
>--- busybox.orig/e2fsprogs/mke2fs.c	2006-03-29 07:43:43.000000000 -0500
>+++ busybox/e2fsprogs/mke2fs.c	2006-03-30 07:30:30.000000000 -0500
>@@ -33,6 +33,7 @@
> #include "e2p/e2p.h"
> #include "ext2fs/ext2fs.h"
> #include "util.h"
>+#include "platform.h"

That include sounds wrong.
e2fsbb.h includes libbb.h which includes platform.h

>
> #define STRIDE_LENGTH 8
>
>@@ -834,7 +835,7 @@ static int PRS(int argc, char *argv[])
>
> #ifdef __linux__
> 	linux_version_code = get_kernel_revision();
>-	if (linux_version_code && linux_version_code < (2*65536 + 2*256)) {
>+	if (linux_version_code && linux_version_code < KERNEL_VERSION(2,2,0)) {
> 		param.s_rev_level = 0;
> 		param.s_feature_incompat = 0;
> 		param.s_feature_compat = 0;
>diff -pru busybox.orig/include/platform.h busybox/include/platform.h
>--- busybox.orig/include/platform.h	2006-03-30 07:02:06.000000000 -0500
>+++ busybox/include/platform.h	2006-03-30 07:17:18.000000000 -0500
>@@ -108,4 +108,6 @@
> #define _(Text) Text
> #define N_(Text) (Text)
>
>+#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
>+

Maybe this should be ifdef __linux__ or something like that?

> #endif	/* platform.h	*/
>diff -pru busybox.orig/modutils/rmmod.c busybox/modutils/rmmod.c
>--- busybox.orig/modutils/rmmod.c	2006-03-29 07:43:27.000000000 -0500
>+++ busybox/modutils/rmmod.c	2006-03-30 07:31:08.000000000 -0500
>@@ -30,6 +30,7 @@
> #include <sys/utsname.h>
> #include <sys/syscall.h>
> #include "busybox.h"
>+#include "platform.h"

That include sounds wrong.
busybox.h includes libbb.h which includes platform.h

ditto in all other files.
[snip]



More information about the busybox mailing list