xref: /spdk/include/spdk/xor.h (revision a6dbe3721eb3b5990707fc3e378c95e505dd8ab5)
1 /*   SPDX-License-Identifier: BSD-3-Clause
2  *   Copyright (C) 2022 Intel Corporation.
3  *   All rights reserved.
4  */
5 
6 /**
7  * \file
8  * XOR utility functions
9  */
10 
11 #ifndef SPDK_XOR_H
12 #define SPDK_XOR_H
13 
14 #include "spdk/stdinc.h"
15 
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
19 
20 /**
21  * Generate XOR from multiple source buffers.
22  *
23  * \param dest Destination buffer.
24  * \param sources Array of source buffers.
25  * \param n Number of source buffers in the array.
26  * \param len Length of each buffer in bytes.
27  * \return 0 on success, negative error code otherwise.
28  */
29 int spdk_xor_gen(void *dest, void **sources, uint32_t n, uint32_t len);
30 
31 /**
32  * Get the optimal buffer alignment for XOR functions.
33  *
34  * \return The alignment in bytes.
35  */
36 size_t spdk_xor_get_optimal_alignment(void);
37 
38 #ifdef __cplusplus
39 }
40 #endif
41 
42 #endif /* SPDK_XOR_H */
43