1 // SPDX-License-Identifier: CDDL-1.0 2 /* 3 * CDDL HEADER START 4 * 5 * This file and its contents are supplied under the terms of the Common 6 * Development and Distribution License ("CDDL"), version 1.0. You may only use 7 * this file in accordance with the terms of version 1.0 of the CDDL. 8 * 9 * A full copy of the text of the CDDL should have accompanied this source. A 10 * copy of the CDDL is also available via the Internet at 11 * http://www.illumos.org/license/CDDL. 12 * 13 * CDDL HEADER END 14 */ 15 16 /* 17 * Copyright (c) 2026 by Garth Snyder. All rights reserved. 18 */ 19 20 #ifndef _ZSTREAM_IO_H 21 #define _ZSTREAM_IO_H 22 23 #ifdef __cplusplus 24 extern "C" { 25 #endif 26 27 #include <sys/types.h> 28 #include <sys/zfs_ioctl.h> 29 30 #include "zstream_chain.h" 31 32 #define MAX_IO_STREAMS 4 33 34 /* 35 * The stream offset is the offset within the original source stream. 36 * Changes to the stream (e.g., recompression) will necessarily change 37 * offsets within the final stream. The original stream offset is raw data; 38 * it should never be updated. 39 */ 40 typedef struct { 41 dmu_replay_record_t dp_drr; 42 uint8_t *dp_payload; 43 uint32_t dp_payload_size; 44 off_t dp_stream_offset; 45 } drr_packet_t; 46 47 /* 48 * In the following, the filename or checkpoint names must remain valid 49 * as long as the chain is executing. 50 */ 51 52 chain_step_t 53 serial_read_stream(const char *filename); 54 55 chain_step_t 56 serial_write_stream(const char *filename); 57 58 /* Report throughput periodically */ 59 chain_step_t 60 serial_checkpoint(const char *name); 61 62 /* 63 * Usually the output step is responsible for freeing payloads. Subcommands 64 * that don't have stream outputs still need to free this memory. A 65 * serial_null_output step does this and nothing more. 66 */ 67 chain_step_t 68 serial_null_output(void); 69 70 #ifdef __cplusplus 71 } 72 #endif 73 74 #endif /* _ZSTREAM_IO_H */ 75