diff --git a/lustre/include/darwin/obd_cksum.h b/lustre/include/darwin/obd_cksum.h
new file mode 100644
index 0000000000000000000000000000000000000000..205433b365ec0c4b06f68334f32794ba95a88a3d
--- /dev/null
+++ b/lustre/include/darwin/obd_cksum.h
@@ -0,0 +1,36 @@
+/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
+ * vim:expandtab:shiftwidth=8:tabstop=8:
+ *
+ *  Copyright (C) 2008 Sun Microsystems, Inc.
+ *
+ *   This file is part of Lustre, http://www.lustre.org.
+ *
+ *   Lustre is free software; you can redistribute it and/or
+ *   modify it under the terms of version 2 of the GNU General Public
+ *   License as published by the Free Software Foundation.
+ *
+ *   Lustre is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with Lustre; if not, write to the Free Software
+ *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#ifndef __DARWIN_OBD_CKSUM
+#define __DARWIN_OBD_CKSUM
+
+#ifndef __OBD_CKSUM
+#error Do not #include this file directly. #include <obd_chsum.h> instead
+#endif
+
+#include <libcfs/kp30.h>
+
+#if !defined(__KERNEL__) && defined(HAVE_ADLER)
+#  include <zlib.h>
+#endif /* !__KERNEL__ */
+
+#endif
diff --git a/lustre/include/darwin/obd_support.h b/lustre/include/darwin/obd_support.h
index 8ff72009ec03dced014cd52ff5f11f70c6a7f782..7313518c69a4258836fca6d75798d6d25fff80ad 100644
--- a/lustre/include/darwin/obd_support.h
+++ b/lustre/include/darwin/obd_support.h
@@ -29,25 +29,6 @@
 
 #include <darwin/lustre_compat.h>
 
-#define CRCPOLY_LE 0xedb88320
-/**
- * crc32_le() - Calculate bitwise little-endian Ethernet AUTODIN II CRC32
- * @crc - seed value for computation.  ~0 for Ethernet, sometimes 0 for
- *        other uses, or the previous crc32 value if computing incrementally.
- * @p   - pointer to buffer over which CRC is run
- * @len - length of buffer @p
- */
-static inline __u32 crc32_le(__u32 crc, unsigned char const *p, size_t len)
-{
-        int i;
-        while (len--) {
-                crc ^= *p++;
-                for (i = 0; i < 8; i++)
-                crc = (crc >> 1) ^ ((crc & 1) ? CRCPOLY_LE : 0);
-        }
-        return crc;
-}
-
 #define OBD_SLEEP_ON(wq)        sleep_on(wq)
 
 /* for obd_class.h */
diff --git a/lustre/include/liblustre.h b/lustre/include/liblustre.h
index 4a89f5049834d46be184efe400f73e68df88096c..67f0066a63931cbcf4bb8e49fadc6646b8b0daff 100644
--- a/lustre/include/liblustre.h
+++ b/lustre/include/liblustre.h
@@ -47,9 +47,6 @@
 #ifdef HAVE_SYS_IOCTL_H
 # include <sys/ioctl.h>
 #endif
-#ifndef _IOWR
-# include "ioctl.h"
-#endif
 
 #include <stdio.h>
 #include <sys/ioctl.h>
@@ -69,6 +66,10 @@
 #include <libcfs/kp30.h>
 #include <libcfs/user-bitops.h>
 
+#ifndef _IOWR
+# include "ioctl.h"
+#endif
+
 /* definitions for liblustre */
 
 #ifdef __CYGWIN__
diff --git a/lustre/include/linux/obd_cksum.h b/lustre/include/linux/obd_cksum.h
new file mode 100644
index 0000000000000000000000000000000000000000..3beb3df9a042c62c80eeed02fb6cc6398142665f
--- /dev/null
+++ b/lustre/include/linux/obd_cksum.h
@@ -0,0 +1,55 @@
+/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
+ * vim:expandtab:shiftwidth=8:tabstop=8:
+ *
+ *  Copyright (C) 2001, 2002 Cluster File Systems, Inc.
+ *
+ *   This file is part of Lustre, http://www.lustre.org.
+ *
+ *   Lustre is free software; you can redistribute it and/or
+ *   modify it under the terms of version 2 of the GNU General Public
+ *   License as published by the Free Software Foundation.
+ *
+ *   Lustre is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with Lustre; if not, write to the Free Software
+ *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#ifndef __LINUX_OBD_CKSUM
+#define __LINUX_OBD_CKSUM
+
+#ifndef __OBD_CKSUM
+#error Do not #include this file directly. #include <obd_chsum.h> instead
+#endif
+
+#ifdef __KERNEL__
+#include <linux/autoconf.h>
+#endif
+
+#include <libcfs/kp30.h>
+
+/* Prefer the kernel's version, if it exports it, because it might be
+ * optimized for this CPU. */
+#if defined(__KERNEL__) && (defined(CONFIG_CRC32) || defined(CONFIG_CRC32_MODULE))
+# include <linux/crc32.h>
+# define HAVE_ARCH_CRC32
+#endif
+
+#ifdef __KERNEL__
+# include <linux/zutil.h>
+# ifndef HAVE_ADLER
+#  define HAVE_ADLER
+# endif
+# define adler32(a,b,l) zlib_adler32(a,b,l)
+#else /*  __KERNEL__ */
+# ifdef HAVE_ADLER
+#  include <zlib.h>
+# endif
+#endif /*! __KERNEL__ */
+
+#endif
diff --git a/lustre/include/linux/obd_support.h b/lustre/include/linux/obd_support.h
index 362cbcba8b4e370bfee13ebf1ab4686c6ce4aca1..dada50219e8f08ae2bb4894d3903279111d4150a 100644
--- a/lustre/include/linux/obd_support.h
+++ b/lustre/include/linux/obd_support.h
@@ -39,117 +39,6 @@
 #include <linux/lustre_compat25.h>
 #include <lustre/lustre_idl.h>
 
-/* Prefer the kernel's version, if it exports it, because it might be
- * optimized for this CPU. */
-#if defined(__KERNEL__) && (defined(CONFIG_CRC32) || defined(CONFIG_CRC32_MODULE))
-# include <linux/crc32.h>
-#else
-/* crc32_le lifted from the Linux kernel, which had the following to say:
- *
- * This code is in the public domain; copyright abandoned.
- * Liability for non-performance of this code is limited to the amount
- * you paid for it.  Since it is distributed for free, your refund will
- * be very very small.  If it breaks, you get to keep both pieces.
- */
-#define CRCPOLY_LE 0xedb88320
-/**
- * crc32_le() - Calculate bitwise little-endian Ethernet AUTODIN II CRC32
- * @crc - seed value for computation.  ~0 for Ethernet, sometimes 0 for
- *        other uses, or the previous crc32 value if computing incrementally.
- * @p   - pointer to buffer over which CRC is run
- * @len - length of buffer @p
- */
-static inline __u32 crc32_le(__u32 crc, unsigned char const *p, size_t len)
-{
-        int i;
-        while (len--) {
-                crc ^= *p++;
-                for (i = 0; i < 8; i++)
-                        crc = (crc >> 1) ^ ((crc & 1) ? CRCPOLY_LE : 0);
-        }
-        return crc;
-}
-#endif
-
-#ifdef __KERNEL__
-# include <linux/zutil.h>
-# ifndef HAVE_ADLER
-#  define HAVE_ADLER
-# endif
-#else /* ! __KERNEL__ */
-# ifdef HAVE_ADLER
-#  include <zlib.h>
-
-static inline __u32 zlib_adler32(__u32 adler, unsigned char const *p,
-                                 size_t len)
-{
-        return adler32(adler, p, len);
-}
-# endif
-#endif /* __KERNEL__ */
-
-static inline __u32 init_checksum(cksum_type_t cksum_type)
-{
-        switch(cksum_type) {
-        case OBD_CKSUM_CRC32:
-                return ~0U;
-#ifdef HAVE_ADLER
-        case OBD_CKSUM_ADLER:
-                return 1U;
-#endif
-        default:
-                CERROR("Unknown checksum type (%x)!!!\n", cksum_type);
-                LBUG();
-        }
-        return 0;
-}
-
-static inline __u32 compute_checksum(__u32 cksum, unsigned char const *p,
-                                     size_t len, cksum_type_t cksum_type)
-{
-        switch(cksum_type) {
-        case OBD_CKSUM_CRC32:
-                return crc32_le(cksum, p, len);
-#ifdef HAVE_ADLER
-        case OBD_CKSUM_ADLER:
-                return zlib_adler32(cksum, p, len);
-#endif
-        default:
-                CERROR("Unknown checksum type (%x)!!!\n", cksum_type);
-                LBUG();
-        }
-        return 0;
-}
-
-static inline obd_flag cksum_type_pack(cksum_type_t cksum_type)
-{
-        switch(cksum_type) {
-        case OBD_CKSUM_CRC32:
-                return OBD_FL_CKSUM_CRC32;
-#ifdef HAVE_ADLER
-        case OBD_CKSUM_ADLER:
-                return OBD_FL_CKSUM_ADLER;
-#endif
-        default:
-                CWARN("unknown cksum type %x\n", cksum_type);
-        }
-        return OBD_FL_CKSUM_CRC32;
-}
-
-static inline cksum_type_t cksum_type_unpack(obd_flag o_flags)
-{
-        o_flags &= OBD_FL_CKSUM_ALL;
-        if ((o_flags - 1) & o_flags)
-                CWARN("several checksum types are set: %x\n", o_flags);
-        if (o_flags & OBD_FL_CKSUM_ADLER)
-#ifdef HAVE_ADLER
-                return OBD_CKSUM_ADLER;
-#else
-                CWARN("checksum type is set to adler32, but adler32 is not "
-                      "supported (%x)\n", o_flags);
-#endif
-        return OBD_CKSUM_CRC32;
-}
 
 #ifdef __KERNEL__
 # include <linux/types.h>
diff --git a/lustre/include/obd.h b/lustre/include/obd.h
index 15d9377943b23a57224b78c52f3e40b653c0eea3..0f55ecd6ebc2b1d1b2b49b6909376e25770e3912 100644
--- a/lustre/include/obd.h
+++ b/lustre/include/obd.h
@@ -1447,24 +1447,4 @@ static inline struct lustre_capa *oinfo_capa(struct obd_info *oinfo)
         return oinfo->oi_capa;
 }
 
-/*
- * Checksums
- */
-
-#ifdef HAVE_ADLER
-/* Default preferred checksum algorithm to use (if supported by the server) */
-#define OSC_DEFAULT_CKSUM OBD_CKSUM_ADLER
-/* Adler-32 is supported */
-#define CHECKSUM_ADLER OBD_CKSUM_ADLER
-#else
-#define OSC_DEFAULT_CKSUM OBD_CKSUM_CRC32
-#define CHECKSUM_ADLER 0
-#endif
-
-#define OBD_CKSUM_ALL (OBD_CKSUM_CRC32 | CHECKSUM_ADLER)
-
-/* Checksum algorithm names. Must be defined in the same order as the
- * OBD_CKSUM_* flags. */
-#define DECLARE_CKSUM_NAME char *cksum_name[] = {"crc32", "adler"}
-
 #endif /* __OBD_H */
diff --git a/lustre/include/obd_cksum.h b/lustre/include/obd_cksum.h
new file mode 100644
index 0000000000000000000000000000000000000000..9d35014c6182583de58399ddc07e290b1d538df4
--- /dev/null
+++ b/lustre/include/obd_cksum.h
@@ -0,0 +1,150 @@
+/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
+ * vim:expandtab:shiftwidth=8:tabstop=8:
+ *
+ *  Copyright (C) 2001, 2002 Cluster File Systems, Inc.
+ *
+ *   This file is part of Lustre, http://www.lustre.org.
+ *
+ *   Lustre is free software; you can redistribute it and/or
+ *   modify it under the terms of version 2 of the GNU General Public
+ *   License as published by the Free Software Foundation.
+ *
+ *   Lustre is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with Lustre; if not, write to the Free Software
+ *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#ifndef __OBD_CKSUM
+#define __OBD_CKSUM
+
+#if defined(__linux__)
+#include <linux/obd_cksum.h>
+#elif defined(__APPLE__)
+#include <darwin/obd_chksum.h>
+#elif defined(__WINNT__)
+#include <winnt/obd_cksum.h>
+#else
+#error Unsupported operating system.
+#endif
+
+#include <lustre/types.h>
+#include <lustre/lustre_idl.h>
+
+/*
+ * Checksums
+ */
+
+#ifndef HAVE_ARCH_CRC32
+/* crc32_le lifted from the Linux kernel, which had the following to say:
+ *
+ * This code is in the public domain; copyright abandoned.
+ * Liability for non-performance of this code is limited to the amount
+ * you paid for it.  Since it is distributed for free, your refund will
+ * be very very small.  If it breaks, you get to keep both pieces.
+ */
+#define CRCPOLY_LE 0xedb88320
+/**
+ * crc32_le() - Calculate bitwise little-endian Ethernet AUTODIN II CRC32
+ * @crc - seed value for computation.  ~0 for Ethernet, sometimes 0 for
+ *        other uses, or the previous crc32 value if computing incrementally.
+ * @p   - pointer to buffer over which CRC is run
+ * @len - length of buffer @p
+ */
+static inline __u32 crc32_le(__u32 crc, unsigned char const *p, size_t len)
+{
+        int i;
+        while (len--) {
+                crc ^= *p++;
+                for (i = 0; i < 8; i++)
+                        crc = (crc >> 1) ^ ((crc & 1) ? CRCPOLY_LE : 0);
+        }
+        return crc;
+}
+#endif
+
+static inline __u32 init_checksum(cksum_type_t cksum_type)
+{
+        switch(cksum_type) {
+        case OBD_CKSUM_CRC32:
+                return ~0U;
+#ifdef HAVE_ADLER
+        case OBD_CKSUM_ADLER:
+                return 1U;
+#endif
+        default:
+                CERROR("Unknown checksum type (%x)!!!\n", cksum_type);
+                LBUG();
+        }
+        return 0;
+}
+
+static inline __u32 compute_checksum(__u32 cksum, unsigned char const *p,
+                                     size_t len, cksum_type_t cksum_type)
+{
+        switch(cksum_type) {
+        case OBD_CKSUM_CRC32:
+                return crc32_le(cksum, p, len);
+#ifdef HAVE_ADLER
+        case OBD_CKSUM_ADLER:
+                return adler32(cksum, p, len);
+#endif
+        default:
+                CERROR("Unknown checksum type (%x)!!!\n", cksum_type);
+                LBUG();
+        }
+        return 0;
+}
+
+static inline obd_flag cksum_type_pack(cksum_type_t cksum_type)
+{
+        switch(cksum_type) {
+        case OBD_CKSUM_CRC32:
+                return OBD_FL_CKSUM_CRC32;
+#ifdef HAVE_ADLER
+        case OBD_CKSUM_ADLER:
+                return OBD_FL_CKSUM_ADLER;
+#endif
+        default:
+                CWARN("unknown cksum type %x\n", cksum_type);
+        }
+        return OBD_FL_CKSUM_CRC32;
+}
+
+static inline cksum_type_t cksum_type_unpack(obd_flag o_flags)
+{
+        o_flags &= OBD_FL_CKSUM_ALL;
+        if ((o_flags - 1) & o_flags)
+                CWARN("several checksum types are set: %x\n", o_flags);
+        if (o_flags & OBD_FL_CKSUM_ADLER)
+#ifdef HAVE_ADLER
+                return OBD_CKSUM_ADLER;
+#else
+                CWARN("checksum type is set to adler32, but adler32 is not "
+                      "supported (%x)\n", o_flags);
+#endif
+        return OBD_CKSUM_CRC32;
+}
+
+#ifdef HAVE_ADLER
+/* Default preferred checksum algorithm to use (if supported by the server) */
+#define OSC_DEFAULT_CKSUM OBD_CKSUM_ADLER
+/* Adler-32 is supported */
+#define CHECKSUM_ADLER OBD_CKSUM_ADLER
+#else
+#define OSC_DEFAULT_CKSUM OBD_CKSUM_CRC32
+#define CHECKSUM_ADLER 0
+#endif
+
+#define OBD_CKSUM_ALL (OBD_CKSUM_CRC32 | CHECKSUM_ADLER)
+
+/* Checksum algorithm names. Must be defined in the same order as the
+ * OBD_CKSUM_* flags. */
+#define DECLARE_CKSUM_NAME char *cksum_name[] = {"crc32", "adler"}
+
+#endif /* __OBD_H */
diff --git a/lustre/include/obd_class.h b/lustre/include/obd_class.h
index 30a3f7f0184e38f8951102b5c98bcf12eb20579b..edf8899fcac4760d93099cdefd4f7da4d5ee4522 100644
--- a/lustre/include/obd_class.h
+++ b/lustre/include/obd_class.h
@@ -19,7 +19,6 @@
  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
  */
-
 #ifndef __CLASS_OBD_H
 #define __CLASS_OBD_H
 
diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c
index 0fd008c1a29eec0d7cdc7a732741fc941d93e1a2..52e89e97a66e0134f4d429f9eb6fce008767d775 100644
--- a/lustre/llite/llite_lib.c
+++ b/lustre/llite/llite_lib.c
@@ -35,6 +35,7 @@
 #include <lustre_disk.h>
 #include <lustre_param.h>
 #include <lustre_log.h>
+#include <obd_cksum.h>
 #include "llite_internal.h"
 
 cfs_mem_cache_t *ll_file_data_slab;
diff --git a/lustre/llite/rw.c b/lustre/llite/rw.c
index a16aac68f6c8895f2603a9ce30e4a26f0500ad26..3eba56d34760cfa7b1876f22e1b672ae082dbe85 100644
--- a/lustre/llite/rw.c
+++ b/lustre/llite/rw.c
@@ -20,9 +20,7 @@
  *   along with Lustre; if not, write to the Free Software
  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-#ifndef AUTOCONF_INCLUDED
-#include <linux/config.h>
-#endif
+#include <linux/autoconf.h>
 #include <linux/kernel.h>
 #include <linux/mm.h>
 #include <linux/string.h>
@@ -45,6 +43,7 @@
 
 //#include <lustre_mdc.h>
 #include <lustre_lite.h>
+#include <obd_cksum.h>
 #include "llite_internal.h"
 #include <linux/lustre_compat25.h>
 
diff --git a/lustre/obdfilter/filter.c b/lustre/obdfilter/filter.c
index b8b64edf7895b9ab0b1801027e35fe5ecf2bfef4..c9ce969c8345ca149c366689d3a88fd660541c9c 100644
--- a/lustre/obdfilter/filter.c
+++ b/lustre/obdfilter/filter.c
@@ -47,6 +47,7 @@
 #include <linux/mount.h>
 #include <linux/buffer_head.h>
 
+#include <obd_cksum.h>
 #include <obd_class.h>
 #include <obd_lov.h>
 #include <lustre_dlm.h>
diff --git a/lustre/osc/lproc_osc.c b/lustre/osc/lproc_osc.c
index ba665a8262b040fb643515e1cd8c42d13a151eb8..8712ef674df88a52e3f76461017dec4d6ffa441b 100644
--- a/lustre/osc/lproc_osc.c
+++ b/lustre/osc/lproc_osc.c
@@ -26,6 +26,7 @@
 
 #include <linux/version.h>
 #include <asm/statfs.h>
+#include <obd_cksum.h>
 #include <obd_class.h>
 #include <lprocfs_status.h>
 #include <linux/seq_file.h>
diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c
index a5380b4f8e6baa86d17ba4667cbb92a5d889ebd7..4150ef58d90935e0d4348f04c8fa1b396dac3e23 100644
--- a/lustre/osc/osc_request.c
+++ b/lustre/osc/osc_request.c
@@ -44,6 +44,7 @@
 #include <libcfs/kp30.h>
 #include <lustre_net.h>
 #include <lustre/lustre_user.h>
+#include <obd_cksum.h>
 #include <obd_ost.h>
 #include <obd_lov.h>
 
diff --git a/lustre/ost/ost_handler.c b/lustre/ost/ost_handler.c
index 02faf06c8207b9ccf4bb572880bfb67aad5140b1..2a1fa8c5118c6ec426f793731220e62c73e31ee0 100644
--- a/lustre/ost/ost_handler.c
+++ b/lustre/ost/ost_handler.c
@@ -39,6 +39,7 @@
 #define DEBUG_SUBSYSTEM S_OST
 
 #include <linux/module.h>
+#include <obd_cksum.h>
 #include <obd_ost.h>
 #include <lustre_net.h>
 #include <lustre_dlm.h>
diff --git a/lustre/ptlrpc/import.c b/lustre/ptlrpc/import.c
index 17fb8cb6dd9798f67029503247df36fe49c763ba..aba05cfcf2433290a6fb3796496c471c7b59df9b 100644
--- a/lustre/ptlrpc/import.c
+++ b/lustre/ptlrpc/import.c
@@ -34,6 +34,7 @@
 #include <lustre_import.h>
 #include <lustre_export.h>
 #include <obd.h>
+#include <obd_cksum.h>
 #include <obd_class.h>
 
 #include "ptlrpc_internal.h"
diff --git a/lustre/ptlrpc/sec_bulk.c b/lustre/ptlrpc/sec_bulk.c
index e49d19b08266ce0d4e0861b79da1731651970750..22ed4ff085120c6b1ef72361fc51c2265162a64d 100644
--- a/lustre/ptlrpc/sec_bulk.c
+++ b/lustre/ptlrpc/sec_bulk.c
@@ -34,6 +34,7 @@
 #endif
 
 #include <obd.h>
+#include <obd_cksum.h>
 #include <obd_class.h>
 #include <obd_support.h>
 #include <lustre_net.h>