/* Update the header checksums for a dirty inode based on its contents. Caller is expected to hold the buffer head underlying oi and mark it dirty.  */
static void omfs_update_checksums(struct omfs_inode *oi)
/* Update the header checksums for a dirty inode based on its contents. Caller is expected to hold the buffer head underlying oi and mark it dirty.  */
static void omfs_update_checksums(struct omfs_inode *oi)
{
	int xor, i, ofs = 0, count;
	u16 crc = 0;
	unsigned char *ptr = (unsigned char *) oi;
	count = be32_to_cpu(oi->i_head.h_body_size);
	ofs = sizeof(struct omfs_header);
	crc = crc_itu_t(crc, ptr + ofs, count);
	oi->i_head.h_crc = cpu_to_be16(crc);
	xor = ptr[0];
	for (i = 1; i < OMFS_XOR_COUNT; i++)
		xor ^= ptr[i];
	oi->i_head.h_check_xor = xor;
}