DEVEL15-linux-2624-20071123
authorMarc Dionne <marc.dionne@technoconseil.com>
Fri, 23 Nov 2007 13:40:36 +0000 (13:40 +0000)
committerDerrick Brashear <shadow@dementia.org>
Fri, 23 Nov 2007 13:40:36 +0000 (13:40 +0000)
FIXES 77370

support linux 2.6.24

(cherry picked from commit af7cf697ef8c0a416251d3fbfd516738e14c290b)

acinclude.m4
src/afs/LINUX/osi_machdep.h
src/afs/LINUX/osi_sysctl.c
src/afs/LINUX/osi_vfsops.c
src/afs/sysincludes.h
src/cf/linux-test1.m4
src/cf/linux-test4.m4

index 3346fdd..ad925e3 100644 (file)
@@ -600,6 +600,9 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
                 )
 
                 LINUX_KERNEL_COMPILE_WORKS
+                 LINUX_KBUILD_USES_EXTRA_CFLAGS
+                 LINUX_HAVE_CURRENT_KERNEL_TIME
+                 LINUX_KMEM_CACHE_INIT
                 LINUX_HAVE_KMEM_CACHE_T
                 LINUX_KMEM_CACHE_CREATE_TAKES_DTOR
                 LINUX_CONFIG_H_EXISTS
@@ -640,6 +643,7 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
                 LINUX_KERNEL_SELINUX
                 LINUX_KERNEL_SOCK_CREATE
                 LINUX_KERNEL_PAGE_FOLLOW_LINK
+                 LINUX_KEY_TYPE_H_EXISTS
                 LINUX_NEED_RHCONFIG
                 LINUX_RECALC_SIGPENDING_ARG_TYPE
                 LINUX_SCHED_STRUCT_TASK_STRUCT_HAS_PARENT
@@ -668,6 +672,7 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
                 LINUX_GENERIC_FILE_AIO_READ
                 LINUX_INIT_WORK_HAS_DATA
                 LINUX_REGISTER_SYSCTL_TABLE_NOFLAG
+                LINUX_SYSCTL_TABLE_CHECKING
                  LINUX_EXPORTS_SYS_CHDIR
                  LINUX_EXPORTS_SYS_CLOSE
                  LINUX_EXPORTS_SYS_OPEN
@@ -744,6 +749,9 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
                 if test "x$ac_cv_linux_exportfs_h_exists" = "xyes"; then
                  AC_DEFINE(EXPORTFS_H_EXISTS, 1, [define if linux/exportfs.h exists])
                 fi
+                if test "x$ac_cv_linux_key_type_h_exists" = "xyes" ; then
+                 AC_DEFINE(KEY_TYPE_H_EXISTS, 1, [define if key-type.h exists])
+                fi
                 if test "x$ac_cv_linux_defines_for_each_process" = "xyes" ; then
                  AC_DEFINE(DEFINED_FOR_EACH_PROCESS, 1, [define if for_each_process defined])
                 fi
@@ -891,12 +899,21 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
                 if test "x$ac_cv_linux_register_sysctl_table_noflag" = "xyes" ; then
                  AC_DEFINE(REGISTER_SYSCTL_TABLE_NOFLAG, 1, [define if register_sysctl_table has no insert_at head flag])
                 fi
+                if test "x$ac_cv_linux_sysctl_table_checking" = "xyes" ; then
+                 AC_DEFINE(SYSCTL_TABLE_CHECKING, 1, [define if your kernel has sysctl table checking])
+                fi
                 if test "x$ac_cv_linux_exports_tasklist_lock" = "xyes" ; then
                  AC_DEFINE(EXPORTED_TASKLIST_LOCK, 1, [define if tasklist_lock exported])
                 fi
                 if test "x$ac_cv_linux_have_kmem_cache_t" = "xyes" ; then
                  AC_DEFINE(HAVE_KMEM_CACHE_T, 1, [define if kmem_cache_t exists])
                 fi
+                if test "x$ac_cv_linux_kmem_cache_init" = "xyes" ; then
+                 AC_DEFINE(KMEM_CACHE_INIT, 1, [define for new kmem_cache init function parameters])
+                fi
+                if test "x$ac_cv_linux_have_current_kernel_time" = "xyes" ; then
+                 AC_DEFINE(HAVE_CURRENT_KERNEL_TIME, 1, [define if current_kernel_time() exists])
+                fi
                 if test "x$ac_cv_linux_have_kmem_cache_t" = "xyes" ; then
                  AC_DEFINE(KMEM_CACHE_TAKES_DTOR, 1, [define if kmem_cache_create takes a destructor argument])
                 fi
index 836a98d..d398c7e 100644 (file)
 
 #define afs_hz HZ
 #include "h/sched.h"
+#if defined(HAVE_CURRENT_KERNEL_TIME)
+static inline time_t osi_Time(void) { 
+    struct timespec xtime;
+    xtime = current_kernel_time();
+    return xtime.tv_sec;
+}
+#else
 #define osi_Time() (xtime.tv_sec)
+#endif
+
+
+
 #ifdef AFS_LINUX_64BIT_KERNEL
 #define osi_GetTime(V)                                 \
     do {                                               \
index d6c2d2f..e0b3f5e 100644 (file)
@@ -36,7 +36,11 @@ static struct ctl_table_header *afs_sysctl = NULL;
 
 static ctl_table afs_sysctl_table[] = {
     {
+#if defined(SYSCTL_TABLE_CHECKING)
+       .ctl_name       = CTL_UNNUMBERED, 
+#else
        .ctl_name       = 1, 
+#endif
        .procname       = "hm_retry_RO",
        .data           = &hm_retry_RO, 
        .maxlen         = sizeof(afs_int32), 
@@ -44,7 +48,11 @@ static ctl_table afs_sysctl_table[] = {
        .proc_handler   = &proc_dointvec
     },
     {
+#if defined(SYSCTL_TABLE_CHECKING)
+       .ctl_name       = CTL_UNNUMBERED, 
+#else
         .ctl_name      = 2, 
+#endif
         .procname      = "hm_retry_RW",
         .data          = &hm_retry_RW,
        .maxlen         = sizeof(afs_int32), 
@@ -52,7 +60,11 @@ static ctl_table afs_sysctl_table[] = {
        .proc_handler   = &proc_dointvec
     },
     {
+#if defined(SYSCTL_TABLE_CHECKING)
+       .ctl_name       = CTL_UNNUMBERED, 
+#else
        .ctl_name       = 3, 
+#endif
        .procname       = "hm_retry_int",
        .data           = &hm_retry_int, 
        .maxlen         = sizeof(afs_int32), 
@@ -60,7 +72,11 @@ static ctl_table afs_sysctl_table[] = {
        .proc_handler   = &proc_dointvec
     },
     {
+#if defined(SYSCTL_TABLE_CHECKING)
+       .ctl_name       = CTL_UNNUMBERED, 
+#else
        .ctl_name       = 4, 
+#endif
        .procname       = "GCPAGs",
        .data           = &afs_gcpags, 
        .maxlen         = sizeof(afs_int32), 
@@ -68,7 +84,11 @@ static ctl_table afs_sysctl_table[] = {
        .proc_handler   = &proc_dointvec
     },
     {
+#if defined(SYSCTL_TABLE_CHECKING)
+       .ctl_name       = CTL_UNNUMBERED, 
+#else
        .ctl_name       = 5, 
+#endif
        .procname       = "rx_deadtime",
        .data           = &afs_rx_deadtime, 
        .maxlen         = sizeof(afs_int32), 
@@ -76,7 +96,11 @@ static ctl_table afs_sysctl_table[] = {
        .proc_handler   = &proc_dointvec
     },
     {
+#if defined(SYSCTL_TABLE_CHECKING)
+       .ctl_name       = CTL_UNNUMBERED, 
+#else
        .ctl_name       = 6, 
+#endif
        .procname       = "bkVolPref",
        .data           = &afs_bkvolpref, 
        .maxlen         = sizeof(afs_int32), 
@@ -152,7 +176,11 @@ static ctl_table afs_sysctl_table[] = {
 
 static ctl_table fs_sysctl_table[] = {
     {
+#if defined(SYSCTL_TABLE_CHECKING)
+       .ctl_name       = CTL_UNNUMBERED, 
+#else
        .ctl_name       = 1, 
+#endif
        .procname       = "afs", 
        .mode           = 0555, 
        .child          = afs_sysctl_table
index 7a9f761..773f06b 100644 (file)
@@ -301,8 +301,12 @@ static void
 #if defined(HAVE_KMEM_CACHE_T)
 init_once(void * foo, kmem_cache_t * cachep, unsigned long flags)
 #else
+#if defined(KMEM_CACHE_INIT)
+init_once(struct kmem_cache * cachep, void * foo)
+#else
 init_once(void * foo, struct kmem_cache * cachep, unsigned long flags)
 #endif
+#endif
 {
     struct vcache *vcp = (struct vcache *) foo;
 
index 55ca2bb..09a87e0 100644 (file)
@@ -75,6 +75,9 @@
 #if defined(LINUX_KEYRING_SUPPORT)
 #include <linux/rwsem.h>
 #include <linux/key.h>
+#if defined(KEY_TYPE_H_EXISTS)
+#include <linux/key-type.h>
+#endif
 #ifndef KEY_ALLOC_IN_QUOTA
 #define KEY_ALLOC_IN_QUOTA 1
 #endif
index 758e002..0dd08e8 100644 (file)
@@ -2,9 +2,12 @@
 #                 [ACTION-IF-SUCCESS], [ACTION-IF-FAILURE])
 #
 AC_DEFUN([AC_TRY_KBUILD26],[  rm -fr conftest.dir
+  if test "x$ac_linux_kbuild_requires_extra_cflags" = "xyes" ; then
+    CFLAGS_PREFIX='EXTRA_'
+  fi
   if mkdir conftest.dir &&
     cat >conftest.dir/Makefile <<_ACEOF &&
-CFLAGS += $CPPFLAGS
+${CFLAGS_PREFIX}CFLAGS += $CPPFLAGS
 
 obj-m += conftest.o
 _ACEOF
@@ -65,3 +68,16 @@ AC_DEFUN([LINUX_KERNEL_COMPILE_WORKS], [
     [],:,AC_MSG_RESULT(no)
     AC_MSG_FAILURE([Fix problem or use --disable-kernel-module...]))
   AC_MSG_RESULT(yes)])
+
+AC_DEFUN([LINUX_KBUILD_USES_EXTRA_CFLAGS], [
+  AC_MSG_CHECKING([if linux kbuild requires EXTRA_CFLAGS])
+  save_CPPFLAGS="$CPPFLAGS"
+  CPPFLAGS=-Wall
+  AC_TRY_KBUILD(
+[#include <linux/sched.h>
+#include <linux/fs.h>],
+    [],
+    ac_linux_kbuild_requires_extra_cflags=no,
+    ac_linux_kbuild_requires_extra_cflags=yes)
+    CPPFLAGS="$save_CPPFLAGS"
+    AC_MSG_RESULT($ac_linux_kbuild_requires_extra_cflags)])
index afddc82..85e612f 100644 (file)
@@ -933,3 +933,47 @@ _fop.splice_read(NULL, NULL, NULL, 0, 0);],
       ac_cv_linux_fs_struct_fop_has_splice=no)])
   AC_MSG_RESULT($ac_cv_linux_fs_struct_fop_has_splice)])
 
+AC_DEFUN([LINUX_KEY_TYPE_H_EXISTS], [
+  AC_MSG_CHECKING([whether linux/key-type.h exists])
+  AC_CACHE_VAL([ac_cv_linux_key_type_h_exists], [
+    AC_TRY_KBUILD(
+[#include <linux/key-type.h>],
+[return;],
+      ac_cv_linux_key_type_h_exists=yes,
+      ac_cv_linux_key_type_h_exists=no)])
+  AC_MSG_RESULT($ac_cv_linux_key_type_h_exists)])
+
+AC_DEFUN([LINUX_HAVE_CURRENT_KERNEL_TIME], [
+  AC_MSG_CHECKING([for current_kernel_time()])
+  AC_CACHE_VAL([ac_cv_linux_have_current_kernel_time], [
+    AC_TRY_KBUILD(
+[#include <linux/time.h>],
+[struct timespec s = current_kernel_time();],
+      ac_cv_linux_have_current_kernel_time=yes,
+      ac_cv_linux_have_current_kernel_time=no)])
+  AC_MSG_RESULT($ac_cv_linux_have_current_kernel_time)])
+
+AC_DEFUN([LINUX_KMEM_CACHE_INIT], [
+  AC_MSG_CHECKING([for new kmem_cache init function parameters])
+  AC_CACHE_VAL([ac_cv_linux_kmem_cache_init], [
+    AC_TRY_KBUILD(
+[#include <linux/slab.h>],
+[extern struct kmem_cache *kmem_cache_create(const char *, size_t, size_t,
+                        unsigned long,
+                        void (*)(struct kmem_cache *, void *));
+return;],
+      ac_cv_linux_kmem_cache_init=yes,
+      ac_cv_linux_kmem_cache_init=no)])
+  AC_MSG_RESULT($ac_cv_linux_kmem_cache_init)])
+
+AC_DEFUN([LINUX_SYSCTL_TABLE_CHECKING], [
+  AC_MSG_CHECKING([for sysctl table checking])
+  AC_CACHE_VAL([ac_cv_linux_sysctl_table_checking], [
+    AC_TRY_KBUILD(
+[#include <linux/sysctl.h>],
+[extern int sysctl_check_table(struct ctl_table *t);
+sysctl_check_table(NULL);],
+      ac_cv_linux_sysctl_table_checking=yes,
+      ac_cv_linux_sysctl_table_checking=no)])
+  AC_MSG_RESULT($ac_cv_linux_sysctl_table_checking)])
+