Remove pre-Linux 2.6 support
[openafs.git] / src / afs / LINUX / osi_sleep.c
index 3a9cda9..dd45ee3 100644 (file)
 #include <afsconfig.h>
 #include "afs/param.h"
 
-RCSID
-    ("$Header$");
 
 #include "afs/sysincludes.h"   /* Standard vendor system headers */
 #include "afsincludes.h"       /* Afs-based standard headers */
 #include "afs/afs_stats.h"     /* afs statistics */
 
+#if defined(FREEZER_H_EXISTS)
+#include <linux/freezer.h>
+#endif
+
 static int osi_TimedSleep(char *event, afs_int32 ams, int aintok);
 
 static char waitV, dummyV;
@@ -80,11 +82,7 @@ typedef struct afs_event {
     int seq;                   /* Sequence number: this is incremented
                                 * by wakeup calls; wait will not return until
                                 * it changes */
-#if defined(AFS_LINUX24_ENV)
     wait_queue_head_t cond;
-#else
-    struct wait_queue *cond;
-#endif
 } afs_event_t;
 
 #define HASHSIZE 128
@@ -144,11 +142,7 @@ afs_addevent(char *event)
     afs_evhashcnt++;
     newp->next = afs_evhasht[hashcode];
     afs_evhasht[hashcode] = newp;
-#if defined(AFS_LINUX24_ENV)
     init_waitqueue_head(&newp->cond);
-#else
-    init_waitqueue(&newp->cond);
-#endif
     newp->seq = 0;
     newp->event = &dummyV;     /* Dummy address for new events */
     newp->refcount = 0;
@@ -192,13 +186,20 @@ afs_osi_SleepSig(void *event)
        AFS_ASSERT_GLOCK();
        AFS_GUNLOCK();
        schedule();
-#ifdef AFS_LINUX26_ENV
 #ifdef CONFIG_PM
        if (
 #ifdef PF_FREEZE
            current->flags & PF_FREEZE
 #else
+#if defined(STRUCT_TASK_STRUCT_HAS_TODO)
            !current->todo
+#else
+#if defined(STRUCT_TASK_STRUCT_HAS_THREAD_INFO)
+            test_ti_thread_flag(current->thread_info, TIF_FREEZE)
+#else
+            test_ti_thread_flag(task_thread_info(current), TIF_FREEZE)
+#endif
+#endif
 #endif
            )
 #ifdef LINUX_REFRIGERATOR_TAKES_PF_FREEZE
@@ -207,7 +208,6 @@ afs_osi_SleepSig(void *event)
            refrigerator();
 #endif
 #endif
-#endif
        AFS_GLOCK();
        if (signal_pending(current)) {
            retval = EINTR;
@@ -286,13 +286,20 @@ osi_TimedSleep(char *event, afs_int32 ams, int aintok)
            code = EINTR;
     } else
        schedule_timeout(ticks);
-#ifdef AFS_LINUX26_ENV
 #ifdef CONFIG_PM
     if (
 #ifdef PF_FREEZE
            current->flags & PF_FREEZE
 #else
+#if defined(STRUCT_TASK_STRUCT_HAS_TODO)
            !current->todo
+#else
+#if defined(STRUCT_TASK_STRUCT_HAS_THREAD_INFO)
+            test_ti_thread_flag(current->thread_info, TIF_FREEZE)
+#else
+            test_ti_thread_flag(task_thread_info(current), TIF_FREEZE)
+#endif
+#endif
 #endif
            )
 #ifdef LINUX_REFRIGERATOR_TAKES_PF_FREEZE
@@ -301,7 +308,6 @@ osi_TimedSleep(char *event, afs_int32 ams, int aintok)
        refrigerator();
 #endif
 #endif
-#endif
 
     AFS_GLOCK();
     remove_wait_queue(&evp->cond, &wait);