Whamcloud - gitweb
b=20139 prevent parent thread to be killed before its child becoming daemon
[fs/lustre-release.git] / lustre / include / darwin / obd_support.h
index 72f3f71..022289c 100644 (file)
 
 #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 */