From 551dd3879c288a2b6b6fbaca5c09c04fbe994ff4 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Tue, 13 Dec 2022 09:15:19 +0100 Subject: Split stream compression out of libio Move it to a separate libxfrm library, where it can be independently tested as well. The bulk of the new code is also mainly test cases for the compressors. Signed-off-by: David Oberhollenzer --- include/xfrm/stream.h | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 include/xfrm/stream.h (limited to 'include/xfrm/stream.h') diff --git a/include/xfrm/stream.h b/include/xfrm/stream.h new file mode 100644 index 0000000..01639cd --- /dev/null +++ b/include/xfrm/stream.h @@ -0,0 +1,39 @@ +/* SPDX-License-Identifier: GPL-3.0-or-later */ +/* + * stream.h + * + * Copyright (C) 2021 David Oberhollenzer + */ +#ifndef XFRM_STREAM_H +#define XFRM_STREAM_H + +#include "sqfs/predef.h" + +typedef enum { + XFRM_STREAM_FLUSH_NONE = 0, + XFRM_STREAM_FLUSH_SYNC, + XFRM_STREAM_FLUSH_FULL, + + XFRM_STREAM_FLUSH_COUNT, +} XFRM_STREAM_FLUSH; + +typedef enum { + XFRM_STREAM_ERROR = -1, + XFRM_STREAM_OK = 0, + XFRM_STREAM_END = 1, + XFRM_STREAM_BUFFER_FULL = 2, +} XFRM_STREAM_RESULT; + +typedef struct xfrm_stream_t xfrm_stream_t; + +struct xfrm_stream_t { + sqfs_object_t base; + + int (*process_data)(xfrm_stream_t *stream, + const void *in, sqfs_u32 in_size, + void *out, sqfs_u32 out_size, + sqfs_u32 *in_read, sqfs_u32 *out_written, + int flush_mode); +}; + +#endif /* XFRM_STREAM_H */ -- cgit v1.2.3