}
}
-#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 7, 50, 0)
+#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 7, 53, 0)
/*
* In 1.6 and 1.8 the checksum was computed only on struct ptlrpc_body as
* it was in 1.6 (88 bytes, smaller than the full size in 1.8). It makes
__u32 lustre_msg_calc_cksum(struct lustre_msg *msg, int compat18)
#else
-# warning "remove checksum compatibility support for b1_8"
__u32 lustre_msg_calc_cksum(struct lustre_msg *msg)
#endif
{
switch (msg->lm_magic) {
case LUSTRE_MSG_MAGIC_V2: {
struct ptlrpc_body *pb = lustre_msg_ptlrpc_body(msg);
-#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 7, 50, 0)
- __u32 crc;
- unsigned int hsize = 4;
+#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 7, 53, 0)
__u32 len = compat18 ? ptlrpc_body_cksum_size_compat18 :
lustre_msg_buflen(msg, MSG_PTLRPC_BODY_OFF);
- LASSERTF(pb, "invalid msg %p: no ptlrpc body!\n", msg);
- cfs_crypto_hash_digest(CFS_HASH_ALG_CRC32, (unsigned char *)pb,
- len, NULL, 0, (unsigned char *)&crc,
- &hsize);
- return crc;
#else
-# warning "remove checksum compatibility support for b1_8"
- __u32 crc;
+ __u32 len = lustre_msg_buflen(msg, MSG_PTLRPC_BODY_OFF);
+#endif
unsigned int hsize = 4;
+ __u32 crc;
+
+ LASSERTF(pb != NULL, "invalid msg %p: no ptlrpc body!\n", msg);
cfs_crypto_hash_digest(CFS_HASH_ALG_CRC32, (unsigned char *)pb,
- lustre_msg_buflen(msg, MSG_PTLRPC_BODY_OFF),
- NULL, 0, (unsigned char *)&crc, &hsize);
+ len, NULL, 0, (unsigned char *)&crc,
+ &hsize);
return crc;
-#endif
}
default:
CERROR("incorrect message magic: %08x\n", msg->lm_magic);