Whamcloud - gitweb
LU-1714 lnet: Properly initialize sg_magic value
[fs/lustre-release.git] / libcfs / include / libcfs / linux / libcfs.h
index ce07e80..f8453ce 100644 (file)
@@ -62,6 +62,7 @@
 #include <linux/types.h>
 #include <asm/timex.h>
 #include <linux/sched.h> /* THREAD_SIZE */
+#include <linux/rbtree.h>
 
 #define CFS_THREAD_SIZE   THREAD_SIZE
 #define LUSTRE_TRACE_SIZE (THREAD_SIZE >> 5)
@@ -80,9 +81,8 @@
 #define __CHECK_STACK(msgdata, mask, cdls)                              \
 do {                                                                    \
         if (unlikely(CDEBUG_STACK() > libcfs_stack)) {                  \
+                LIBCFS_DEBUG_MSG_DATA_INIT(msgdata, D_WARNING, NULL);   \
                 libcfs_stack = CDEBUG_STACK();                          \
-                (msgdata)->msg_mask = D_WARNING;                        \
-                (msgdata)->msg_cdls = NULL;                             \
                 libcfs_debug_msg(msgdata,                               \
                                  "maximum lustre stack %lu\n",          \
                                  CDEBUG_STACK());                       \
@@ -164,4 +164,13 @@ typedef long long_ptr_t;
 
 #endif /* HAVE_STRUCT_CRED */
 
+#ifndef HAVE_SCATTERLIST_INITTABLE
+#define sg_init_table(sg, nents) memset(sg, 0, sizeof(*(sg))*(nents))
+#endif
+
+#ifndef HAVE_SCATTERLIST_SETPAGE
+#define sg_set_page(sg, p, len, off) \
+       sg_set_buf(sg, page_address(p) + ((off) & ~CFS_PAGE_MASK), len)
+#endif
+
 #endif /* _LINUX_LIBCFS_H */