Whamcloud - gitweb
use LASSERT_SPIN_LOCKED() in LASSERT(spin_is_locked()) stead as the latter does not...
[fs/lustre-release.git] / libcfs / include / libcfs / linux / linux-prim.h
index 20f3674..1f3cbee 100644 (file)
@@ -53,6 +53,7 @@
 #include <linux/config.h>
 #endif
 #include <linux/module.h>
+#include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/version.h>
 #include <linux/proc_fs.h>
@@ -87,6 +88,17 @@ typedef struct ctl_table_header              cfs_sysctl_table_header_t;
 #endif
 #define cfs_unregister_sysctl_table(t) unregister_sysctl_table(t)
 
+#define DECLARE_PROC_HANDLER(name)                      \
+static int                                              \
+LL_PROC_PROTO(name)                                     \
+{                                                       \
+        DECLARE_LL_PROC_PPOS_DECL;                      \
+                                                        \
+        return proc_call_handler(table->data, write,    \
+                                 ppos, buffer, lenp,    \
+                                 __##name);             \
+}
+
 /*
  * Symbol register
  */
@@ -204,15 +216,15 @@ do {                                                             \
    retval == 0; condition met; we're good.
    retval > 0; timed out.
 */
-#define cfs_waitq_wait_event_timeout(wq, condition, timeout)         \
-({                                                                   \
-       int __ret = 0;                                               \
+#define cfs_waitq_wait_event_timeout(wq, condition, timeout, ret)    \
+do {                                                                 \
+       ret = 0;                                                     \
        if (!(condition))                                            \
-               __wait_event_timeout(wq, condition, timeout, __ret); \
-       __ret;                                                       \
-})
+               __wait_event_timeout(wq, condition, timeout, ret);   \
+} while (0)
 #else
-#define cfs_waitq_wait_event_timeout  wait_event_timeout
+#define cfs_waitq_wait_event_timeout(wq, condition, timeout, ret)    \
+        ret = wait_event_timeout(wq, condition, timeout)
 #endif
 
 #ifndef wait_event_interruptible_timeout /* Only for RHEL3 2.4.21 kernel */
@@ -251,16 +263,16 @@ do {                                                           \
    retval < 0; interrupted by signal.
    retval > 0; timed out.
 */
-#define cfs_waitq_wait_event_interruptible_timeout(wq, condition, timeout\
-({                                                                \
-       int __ret = 0;                                            \
+#define cfs_waitq_wait_event_interruptible_timeout(wq, condition, timeout, ret)\
+do {                                                              \
+       ret = 0;                                                  \
        if (!(condition))                                         \
                __wait_event_interruptible_timeout(wq, condition, \
-                                               timeout, __ret);  \
-       __ret;                                                    \
-})
+                                               timeout, ret);     \
+} while (0)
 #else
-#define cfs_waitq_wait_event_interruptible_timeout wait_event_interruptible_timeout
+#define cfs_waitq_wait_event_interruptible_timeout(wq, c, timeout, ret) \
+        ret = wait_event_interruptible_timeout(wq, c, timeout)
 #endif
 
 #endif