linux/fs/xfs/libxfs/xfs_cksum.h

/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _XFS_CKSUM_H
#define _XFS_CKSUM_H

#define XFS_CRC_SEED

/*
 * Calculate the intermediate checksum for a buffer that has the CRC field
 * inside it.  The offset of the 32bit crc fields is passed as the
 * cksum_offset parameter. We do not modify the buffer during verification,
 * hence we have to split the CRC calculation across the cksum_offset.
 */
static inline uint32_t
xfs_start_cksum_safe(char *buffer, size_t length, unsigned long cksum_offset)
{}

/*
 * Fast CRC method where the buffer is modified. Callers must have exclusive
 * access to the buffer while the calculation takes place.
 */
static inline uint32_t
xfs_start_cksum_update(char *buffer, size_t length, unsigned long cksum_offset)
{}

/*
 * Convert the intermediate checksum to the final ondisk format.
 *
 * The CRC32c calculation uses LE format even on BE machines, but returns the
 * result in host endian format. Hence we need to byte swap it back to LE format
 * so that it is consistent on disk.
 */
static inline __le32
xfs_end_cksum(uint32_t crc)
{}

/*
 * Helper to generate the checksum for a buffer.
 *
 * This modifies the buffer temporarily - callers must have exclusive
 * access to the buffer while the calculation takes place.
 */
static inline void
xfs_update_cksum(char *buffer, size_t length, unsigned long cksum_offset)
{}

/*
 * Helper to verify the checksum for a buffer.
 */
static inline int
xfs_verify_cksum(char *buffer, size_t length, unsigned long cksum_offset)
{}

#endif /* _XFS_CKSUM_H */