Linux: Don't waste autoconf checks on cpp defines
authorSimon Wilkinson <sxw@inf.ed.ac.uk>
Tue, 27 Apr 2010 16:49:19 +0000 (17:49 +0100)
committerDerrick Brashear <shadow@dementia.org>
Tue, 27 Apr 2010 19:27:12 +0000 (12:27 -0700)
If something is a #define, then there's no point in doing a test
compile to check for its presence. Instead, just do #if defined(X)

Remove the tests for for_each_process and prev_task.

Change-Id: Id8a9fddf2571cccd5d61982d4662bce2009c8f43
Reviewed-on: http://gerrit.openafs.org/1855
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

acinclude.m4
src/afs/LINUX/osi_gcpags.c
src/afs/LINUX24/osi_gcpags.c
src/afs/LINUX24/osi_module.c
src/cf/linux-test4.m4

index ded13ed..54f4e9f 100644 (file)
@@ -845,8 +845,6 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
                 AC_CHECK_LINUX_HEADER([completion.h])
                 AC_CHECK_LINUX_HEADER([semaphore.h])
                 AC_CHECK_LINUX_HEADER([exportfs.h])
-                LINUX_DEFINES_FOR_EACH_PROCESS
-                LINUX_DEFINES_PREV_TASK
                 AC_CHECK_LINUX_STRUCT([super_operations], [alloc_inode],
                                       [fs.h])
                 AC_CHECK_LINUX_STRUCT([super_block], [s_bdi], [fs.h])
@@ -977,12 +975,6 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
                 if test -f "$LINUX_KERNEL_PATH/include/linux/mm_inline.h"; then
                  AC_DEFINE(HAVE_MM_INLINE_H, 1, [define if you have mm_inline.h header file])
                 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
-                if test "x$ac_cv_linux_defines_prev_task" = "xyes" ; then
-                 AC_DEFINE(DEFINED_PREV_TASK, 1, [define if prev_task defined])
-                fi
                 if test "x$ac_cv_linux_kernel_page_follow_link" = "xyes" -o "x$ac_cv_linux_func_i_put_link_takes_cookie" = "xyes"; then
                  AC_DEFINE(USABLE_KERNEL_PAGE_SYMLINK_CACHE, 1, [define if your kernel has a usable symlink cache API])
                 else
index 34e1a23..ec32c6c 100644 (file)
@@ -42,7 +42,7 @@ afs_osi_TraverseProcTable(void)
        rcu_read_lock();
 #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) */
 
-#ifdef DEFINED_FOR_EACH_PROCESS
+#if defined(for_each_process)
     for_each_process(p) if (p->pid) {
 #ifdef STRUCT_TASK_STRUCT_HAS_EXIT_STATE
        if (p->exit_state)
index f73e1d0..aa6759b 100644 (file)
@@ -34,7 +34,7 @@ afs_osi_TraverseProcTable(void)
        read_lock(&tasklist_lock);
 #endif /* EXPORTED_TASKLIST_LOCK */
 
-#ifdef DEFINED_FOR_EACH_PROCESS
+#if defined(for_each_process)
     for_each_process(p) if (p->pid) {
 #ifdef STRUCT_TASK_STRUCT_HAS_EXIT_STATE
        if (p->exit_state)
index 5727800..1f4cc38 100644 (file)
@@ -175,7 +175,7 @@ get_page_offset(void)
     read_lock(&tasklist_lock);
 #endif
     /* search backward thru the circular list */
-#ifdef DEFINED_PREV_TASK
+#if defined(prev_task)
     for (q = current; p = q; q = prev_task(p)) {
 #else
     for (p = current; p; p = p->prev_task) {
index 4389fd0..fb66836 100644 (file)
@@ -23,31 +23,6 @@ lose
                       [Define if your kernel has a usable linux/completion.h])
 ])
 
-AC_DEFUN([LINUX_DEFINES_FOR_EACH_PROCESS], [
-  AC_MSG_CHECKING([for defined for_each_process])
-  AC_CACHE_VAL([ac_cv_linux_defines_for_each_process], [
-    AC_TRY_KBUILD(
-[#include <linux/sched.h>],
-[#ifndef for_each_process
-#error for_each_process not defined
-#endif],
-      ac_cv_linux_defines_for_each_process=yes,
-      ac_cv_linux_defines_for_each_process=no)])
-  AC_MSG_RESULT($ac_cv_linux_defines_for_each_process)])
-
-
-AC_DEFUN([LINUX_DEFINES_PREV_TASK], [
-  AC_MSG_CHECKING([for defined prev_task])
-  AC_CACHE_VAL([ac_cv_linux_defines_prev_task], [
-    AC_TRY_KBUILD(
-[#include <linux/sched.h>],
-[#ifndef prev_task
-#error prev_task not defined
-#endif],
-      ac_cv_linux_defines_prev_task=yes,
-      ac_cv_linux_defines_prev_task=no)])
-  AC_MSG_RESULT($ac_cv_linux_defines_prev_task)])
-
 
 AC_DEFUN([LINUX_EXPORTS_INIT_MM], [
   AC_CHECK_LINUX_BUILD([for exported init_mm],