---
I think we should drop the pretense that we support pre-2.4 kernels.
This is a sampling of the kind of cleanups that could be made; there are
some more in the Makefiles and in configure, related to pre-kbuild
kernels, and maybe more elsewhere.

I have two things that I want to look into that will be simpler without
this pretense.  First, this is related to the defer-format changes,
because one of the simplifications is the assumption that we can depend
on the the kernel for vsnsprintf.  Second, I'm tempted to look into
C++ for hal components again, and having only one build system (well,
plus sim, but C++ isn't a problem there) cuts that problem in half too.

Kernel 2.4 was released in 2001, and was the standard kernel in
Debian 3.0 "Woody" in 2002, and RedHat 7.1 "Seawolf" in 2001.  In the
history of emc-related distros, BDI-live from 2004ish was the first with
kernel 2.4.  That makes it between 5 and 8 years since 2.2 kernels were
"current".  Compare this to the 2006 release of emc 2.0.0, or the likely
2010 release of emc 2.4 and this seems a bit silly.

Personally, I very much doubt we've run on kernel 2.2 for a very long
time, just because it's unlikey that no change has accidentally broken
platforms that no developers use.

Hostmot2 uses pci-related functions that I'm almost certain don't exist
in kernel 2.2, and we've heard no reports related to this.

(Recently some changes related to a LINUX_KERNEL_2_2 define were removed
by micges, and further in the past other instances were removed by me.
Investigating the history of emc2 using 'gitk -SLINUX_KERNEL', it is
possible to see that there was never code to enable this define.  Since
we used to build on bdi2 in the 2.0.x days I assume these defines were
simply not necessary)

 src/rtapi/rtai_rtapi.c |   24 ++----------------------
 src/rtapi/rtapi.h      |   24 ------------------------
 2 files changed, 2 insertions(+), 46 deletions(-)

diff --git a/src/rtapi/rtai_rtapi.c b/src/rtapi/rtai_rtapi.c
index d1f7ef7..6d03dc2 100644
--- a/src/rtapi/rtai_rtapi.c
+++ b/src/rtapi/rtai_rtapi.c
@@ -69,33 +69,15 @@
 #include <asm/msr.h>           /* rdtscll() */
 #include <linux/time.h>                /* timeval & do_gettimeofday() */
 
-#ifndef LINUX_VERSION_CODE
 #include <linux/version.h>
-#endif
-#ifndef KERNEL_VERSION
-#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
-#endif
 
 /* get inb(), outb(), ioperm() */
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,17)
 #include <asm/io.h>
-#else
-#include <sys/io.h>
-#endif
 
 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)
 #include <linux/cpumask.h>     /* NR_CPUS, cpu_online() */
 #endif
 
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,0)
-/* Kernel is 2.4 or higher, use it's vsnprintf() implementation */
-#define vsn_printf vsnprintf
-#else
-/* 2.2 and older kernels don't have vsnprintf() so we bring in
-   our own implementation (vsn_printf) of it here.*/
-#include "vsnprintf.h"
-#endif
-
 #include <rtai.h>
 #include <rtai_sched.h>
 #if RTAI > 2
@@ -440,7 +422,7 @@ static int module_delete(int module_id)
 }
 
 int rtapi_vsnprintf(char *buf, unsigned long int size, const char *fmt, 
va_list ap) {
-    return vsn_printf(buf, size, fmt, ap);
+    return vsnprintf(buf, size, fmt, ap);
 }
 
 int rtapi_snprintf(char *buf, unsigned long int size, const char *fmt, ...)
@@ -449,9 +431,7 @@ int rtapi_snprintf(char *buf, unsigned long int size, const 
char *fmt, ...)
     int i;
 
     va_start(args, fmt);
-    /* call our own vsn_printf(), which is #defined to vsnprintf() if the
-       kernel supplies one. */
-    i = vsn_printf(buf, size, fmt, args);
+    i = vsnprintf(buf, size, fmt, args);
     va_end(args);
     return i;
 }
diff --git a/src/rtapi/rtapi.h b/src/rtapi/rtapi.h
index 3d33e9d..7caef5a 100644
--- a/src/rtapi/rtapi.h
+++ b/src/rtapi/rtapi.h
@@ -739,11 +739,7 @@ RTAPI_BEGIN_DECLS
 
     static __inline__ void *rtapi_request_region(unsigned long size,
             unsigned long n, const char *name) {
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
         return (void*)request_region(size, n, name);
-#else
-        return (void*)-1;
-#endif
     }
 
 /** 'rtapi_release_region() releases I/O memory reserved by 
@@ -753,9 +749,7 @@ RTAPI_BEGIN_DECLS
 */
     static __inline__ void rtapi_release_region(unsigned long size,
             unsigned long int n) {
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
         release_region(size, n);
-#endif
     }
 #endif
 
@@ -798,17 +792,7 @@ RTAPI_BEGIN_DECLS
 #endif
 
 #if !defined(RTAPI_SIM)
-#ifndef LINUX_VERSION_CODE
 #include <linux/version.h>
-#endif
-#endif
-#ifndef KERNEL_VERSION
-#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
-#endif
-
-#ifndef LINUX_VERSION_CODE
-#define LINUX_VERSION_CODE 0
-#endif
 
 #if defined(SIM) || (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0))
 #define RTAPI_STRINGIFY(x)    #x
@@ -871,14 +855,6 @@ RTAPI_BEGIN_DECLS
 
 #endif /* version < 2.6 */
 
-#if !defined(SIM)
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)
-#define MODULE_LICENSE(license)         \
-static const char __module_license[] __attribute__((section(".modinfo"))) =   \
-"license=" license
-#endif
-#endif
-
 #endif /* RTAPI */
 
 #if defined(SIM)
-- 
1.6.2.1.469.gdffc

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Emc-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-developers

Reply via email to