xref: /freebsd/sys/contrib/openzfs/module/zstd/lib/compress/zstd_preSplit.h (revision 8a62a2a5659d1839d8799b4274c04469d7f17c78)
1*8a62a2a5SMartin Matuska // SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only
2*8a62a2a5SMartin Matuska /*
3*8a62a2a5SMartin Matuska  * Copyright (c) Meta Platforms, Inc. and affiliates.
4*8a62a2a5SMartin Matuska  * All rights reserved.
5*8a62a2a5SMartin Matuska  *
6*8a62a2a5SMartin Matuska  * This source code is licensed under both the BSD-style license (found in the
7*8a62a2a5SMartin Matuska  * LICENSE file in the root directory of this source tree) and the GPLv2 (found
8*8a62a2a5SMartin Matuska  * in the COPYING file in the root directory of this source tree).
9*8a62a2a5SMartin Matuska  * You may select, at your option, one of the above-listed licenses.
10*8a62a2a5SMartin Matuska  */
11*8a62a2a5SMartin Matuska 
12*8a62a2a5SMartin Matuska #ifndef ZSTD_PRESPLIT_H
13*8a62a2a5SMartin Matuska #define ZSTD_PRESPLIT_H
14*8a62a2a5SMartin Matuska 
15*8a62a2a5SMartin Matuska #include <stddef.h>  /* size_t */
16*8a62a2a5SMartin Matuska 
17*8a62a2a5SMartin Matuska #define ZSTD_SLIPBLOCK_WORKSPACESIZE 8208
18*8a62a2a5SMartin Matuska 
19*8a62a2a5SMartin Matuska /* ZSTD_splitBlock():
20*8a62a2a5SMartin Matuska  * @level must be a value between 0 and 4.
21*8a62a2a5SMartin Matuska  *        higher levels spend more energy to detect block boundaries.
22*8a62a2a5SMartin Matuska  * @workspace must be aligned for size_t.
23*8a62a2a5SMartin Matuska  * @wkspSize must be at least >= ZSTD_SLIPBLOCK_WORKSPACESIZE
24*8a62a2a5SMartin Matuska  * note:
25*8a62a2a5SMartin Matuska  * For the time being, this function only accepts full 128 KB blocks.
26*8a62a2a5SMartin Matuska  * Therefore, @blockSize must be == 128 KB.
27*8a62a2a5SMartin Matuska  * While this could be extended to smaller sizes in the future,
28*8a62a2a5SMartin Matuska  * it is not yet clear if this would be useful. TBD.
29*8a62a2a5SMartin Matuska  */
30*8a62a2a5SMartin Matuska size_t ZSTD_splitBlock(const void* blockStart, size_t blockSize,
31*8a62a2a5SMartin Matuska                     int level,
32*8a62a2a5SMartin Matuska                     void* workspace, size_t wkspSize);
33*8a62a2a5SMartin Matuska 
34*8a62a2a5SMartin Matuska #endif /* ZSTD_PRESPLIT_H */
35