2022-06-03 19:15:11 +00:00
|
|
|
/* SPDX-License-Identifier: BSD-3-Clause
|
2022-11-01 20:26:26 +00:00
|
|
|
* Copyright (C) 2017 Intel Corporation.
|
2016-08-02 16:34:45 +00:00
|
|
|
* All rights reserved.
|
|
|
|
*/
|
|
|
|
|
2017-07-21 21:44:43 +00:00
|
|
|
/**
|
|
|
|
* \file
|
|
|
|
* CRC-32 utility functions
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef SPDK_CRC32_H
|
|
|
|
#define SPDK_CRC32_H
|
2016-08-02 16:34:45 +00:00
|
|
|
|
2017-05-02 18:18:25 +00:00
|
|
|
#include "spdk/stdinc.h"
|
2019-01-21 09:05:59 +00:00
|
|
|
#include "spdk/config.h"
|
2016-08-02 16:34:45 +00:00
|
|
|
|
2017-12-07 20:25:19 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2017-07-21 21:44:43 +00:00
|
|
|
/**
|
|
|
|
* Calculate a partial CRC-32 IEEE checksum.
|
|
|
|
*
|
|
|
|
* \param buf Data buffer to checksum.
|
|
|
|
* \param len Length of buf in bytes.
|
|
|
|
* \param crc Previous CRC-32 value.
|
|
|
|
* \return Updated CRC-32 value.
|
|
|
|
*/
|
|
|
|
uint32_t spdk_crc32_ieee_update(const void *buf, size_t len, uint32_t crc);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Calculate a partial CRC-32C checksum.
|
|
|
|
*
|
|
|
|
* \param buf Data buffer to checksum.
|
|
|
|
* \param len Length of buf in bytes.
|
|
|
|
* \param crc Previous CRC-32C value.
|
|
|
|
* \return Updated CRC-32C value.
|
|
|
|
*/
|
|
|
|
uint32_t spdk_crc32c_update(const void *buf, size_t len, uint32_t crc);
|
2016-08-02 16:34:45 +00:00
|
|
|
|
2021-05-28 11:25:59 +00:00
|
|
|
/**
|
|
|
|
* Calculate a partial CRC-32C checksum.
|
|
|
|
*
|
|
|
|
* \param iov Data buffer vectors to checksum.
|
|
|
|
* \param iovcnt size of iov parameter.
|
|
|
|
* \param crc32c Previous CRC-32C value.
|
|
|
|
* \return Updated CRC-32C value.
|
|
|
|
*/
|
|
|
|
uint32_t spdk_crc32c_iov_update(struct iovec *iov, int iovcnt, uint32_t crc32c);
|
|
|
|
|
2017-12-07 20:25:19 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2017-07-21 21:44:43 +00:00
|
|
|
#endif /* SPDK_CRC32_H */
|