summaryrefslogtreecommitdiff
path: root/fs/erofs/compress.h
diff options
context:
space:
mode:
authorGao Xiang <hsiangkao@linux.alibaba.com>2024-07-09 12:41:06 +0300
committerGao Xiang <hsiangkao@linux.alibaba.com>2024-07-09 14:04:41 +0300
commit84a2ceefff99633d8f88c7c1f9bbd2c139b8f805 (patch)
treef43cfeb49fb33f3f0722739a1d401824e40e2815 /fs/erofs/compress.h
parent5a7cce827ee9e2c56fcecf5cda0ad39d9568283d (diff)
downloadlinux-84a2ceefff99633d8f88c7c1f9bbd2c139b8f805.tar.xz
erofs: tidy up stream decompressors
Just use a generic helper to prepare buffers for all supported stream decompressors, eliminating similar logic. Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com> Link: https://lore.kernel.org/r/20240709094106.3018109-3-hsiangkao@linux.alibaba.com
Diffstat (limited to 'fs/erofs/compress.h')
-rw-r--r--fs/erofs/compress.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/fs/erofs/compress.h b/fs/erofs/compress.h
index 601f533c9649..526edc0a7d2d 100644
--- a/fs/erofs/compress.h
+++ b/fs/erofs/compress.h
@@ -88,6 +88,21 @@ extern const struct z_erofs_decompressor z_erofs_deflate_decomp;
extern const struct z_erofs_decompressor z_erofs_zstd_decomp;
extern const struct z_erofs_decompressor *z_erofs_decomp[];
+struct z_erofs_stream_dctx {
+ struct z_erofs_decompress_req *rq;
+ unsigned int inpages, outpages; /* # of {en,de}coded pages */
+ int no, ni; /* the current {en,de}coded page # */
+
+ unsigned int avail_out; /* remaining bytes in the decoded buffer */
+ unsigned int inbuf_pos, inbuf_sz;
+ /* current status of the encoded buffer */
+ u8 *kin, *kout; /* buffer mapped pointers */
+ void *bounce; /* bounce buffer for inplace I/Os */
+ bool bounced; /* is the bounce buffer used now? */
+};
+
+int z_erofs_stream_switch_bufs(struct z_erofs_stream_dctx *dctx, void **dst,
+ void **src, struct page **pgpl);
int z_erofs_fixup_insize(struct z_erofs_decompress_req *rq, const char *padbuf,
unsigned int padbufsize);
int __init z_erofs_init_decompressor(void);