xref: /freebsd/sys/contrib/openzfs/cmd/zstream/zstream_modules.h (revision 22649d4dba730d46244fd2dff4fd174903c8379f)
1 // SPDX-License-Identifier: CDDL-1.0
2 /*
3  * This file and its contents are supplied under the terms of the
4  * Common Development and Distribution License ("CDDL"), version 1.0.
5  * You may only use this file in accordance with the terms of version
6  * 1.0 of the CDDL.
7  *
8  * A full copy of the text of the CDDL should have accompanied this
9  * source.  A copy of the CDDL is also available via the Internet at
10  * https://opensource.org/license/CDDL-1.0.
11  */
12 
13 /*
14  * Copyright (c) 2026 by Garth Snyder. All rights reserved.
15  */
16 
17 #ifndef _ZSTREAM_MODULES_H
18 #define	_ZSTREAM_MODULES_H
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
24 /*
25  * This file aggregates all zstream_chain utility modules into a single
26  * header and defines macros for standard input and output operations.
27  */
28 
29 #include "zstream_byteswap.h"
30 #include "zstream_chain.h"
31 #include "zstream_dump.h"
32 #include "zstream_fletcher4.h"
33 #include "zstream_io.h"
34 #include "zstream_recompress.h"
35 #include "zstream_util.h"
36 #include "zstream_validate.h"
37 
38 #define	STANDARD_INPUT_STACK_Q(infile, queue_size) 			\
39 	serial_read_stream(infile),					\
40 	parallel_calc_fletcher4(queue_size),				\
41 	serial_validate_fletcher4(),					\
42 	serial_byteswap(BS_INCOMING),					\
43 	serial_validate_records()
44 
45 #define	STANDARD_OUTPUT_STACK_Q(outfile, queue_size) 			\
46 	serial_byteswap(BS_OUTGOING),					\
47 	parallel_calc_fletcher4(queue_size),				\
48 	serial_add_fletcher4(),						\
49 	serial_write_stream(outfile),					\
50 	chain_terminator()
51 
52 #define	STANDARD_INPUT_STACK(infile)	STANDARD_INPUT_STACK_Q(infile, 1024)
53 #define	STANDARD_OUTPUT_STACK(outfile)	STANDARD_OUTPUT_STACK_Q(outfile, 512)
54 
55 #define	NULL_OUTPUT_STACK()						\
56 	serial_null_output(),						\
57 	chain_terminator()
58 
59 #ifdef __cplusplus
60 }
61 #endif
62 
63 #endif  /* _ZSTREAM_MODULES_H */
64