[Ocfs2-commits] zab commits r1971 - in trunk: . kapi-compat/include

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Fri Mar 11 16:44:38 CST 2005


Author: zab
Signed-off-by: manish
Date: 2005-03-11 16:44:37 -0600 (Fri, 11 Mar 2005)
New Revision: 1971

Added:
   trunk/kapi-compat/include/wait_event_timeout.h
Modified:
   trunk/configure.in
Log:
- add compat for wait_event_timeout

Signed-off-by: manish


Modified: trunk/configure.in
===================================================================
--- trunk/configure.in	2005-03-11 01:12:47 UTC (rev 1970)
+++ trunk/configure.in	2005-03-11 22:44:37 UTC (rev 1971)
@@ -307,6 +307,14 @@
   AC_MSG_RESULT(no)
 fi
 
+AC_MSG_CHECKING([for wait_event_timeout])
+if grep "\<wait_event_timeout(" "$KERNELINC/linux/wait.h" >/dev/null 2>&1 ; then
+  AC_MSG_RESULT(yes)
+else
+  KAPI_COMPAT_HEADERS="$KAPI_COMPAT_HEADERS wait_event_timeout.h"
+  AC_MSG_RESULT(no)
+fi
+
 AC_MSG_CHECKING([for wait_event_interruptible_timeout])
 if grep "\<wait_event_interruptible_timeout(" "$KERNELINC/linux/wait.h" >/dev/null 2>&1 ; then
   AC_MSG_RESULT(yes)

Added: trunk/kapi-compat/include/wait_event_timeout.h
===================================================================
--- trunk/kapi-compat/include/wait_event_timeout.h	2005-03-11 01:12:47 UTC (rev 1970)
+++ trunk/kapi-compat/include/wait_event_timeout.h	2005-03-11 22:44:37 UTC (rev 1971)
@@ -0,0 +1,30 @@
+#ifndef KAPI_WAIT_EVENT_TIMEOUT_H
+#define KAPI_WAIT_EVENT_TIMEOUT_H
+
+#include <linux/wait.h>
+
+#define __wait_event_timeout(wq, condition, ret)                        \
+do {                                                                    \
+       	DEFINE_WAIT(__wait);                                            \
+									\
+       	for (;;) {                                                      \
+		prepare_to_wait(&wq, &__wait, TASK_UNINTERRUPTIBLE);    \
+		if (condition)                                          \
+			break;                                          \
+		ret = schedule_timeout(ret);                            \
+		if (!ret)                                               \
+			break;                                          \
+       	}                                                               \
+	finish_wait(&wq, &__wait);                                      \
+} while (0)
+                                                                                
+#define wait_event_timeout(wq, condition, timeout)                      \
+({                                                                      \
+       	long __ret = timeout;                                           \
+       	if (!(condition))                                               \
+		__wait_event_timeout(wq, condition, __ret);             \
+	__ret;                                                          \
+})
+
+
+#endif



More information about the Ocfs2-commits mailing list