The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=088fdf8fb8abf9eff56a9eacc1c24011d47357c5
commit 088fdf8fb8abf9eff56a9eacc1c24011d47357c5 Author: Kyle Evans <kev...@freebsd.org> AuthorDate: 2025-07-26 14:18:36 +0000 Commit: Kyle Evans <kev...@freebsd.org> CommitDate: 2025-07-26 21:31:42 +0000 kern: add a compressor_format() accessor to the compresssor API Some work in progress on the ucoredump bits (D51377) would pass the compression format out-of-band to the coredump writer's init function, but the compressor is accessible to the init_fn via the coredump_params. Making this accessible in parts of the kernel detached from the bits actually doing compression would be useful to clean up the API so that we can stick to using coredump_params to pass along whatever may be useful. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D51561 --- sys/kern/subr_compressor.c | 6 ++++++ sys/sys/compressor.h | 1 + 2 files changed, 7 insertions(+) diff --git a/sys/kern/subr_compressor.c b/sys/kern/subr_compressor.c index 280264881241..5d59622e0455 100644 --- a/sys/kern/subr_compressor.c +++ b/sys/kern/subr_compressor.c @@ -538,6 +538,12 @@ compressor_init(compressor_cb_t cb, int format, size_t maxiosize, int level, return (s); } +int +compressor_format(const struct compressor *stream) +{ + return (stream->methods->format); +} + void compressor_reset(struct compressor *stream) { diff --git a/sys/sys/compressor.h b/sys/sys/compressor.h index cad9080b46ff..e59eeabec2cd 100644 --- a/sys/sys/compressor.h +++ b/sys/sys/compressor.h @@ -42,6 +42,7 @@ struct compressor; bool compressor_avail(int format); struct compressor *compressor_init(compressor_cb_t cb, int format, size_t maxiosize, int level, void *arg); +int compressor_format(const struct compressor *stream); void compressor_reset(struct compressor *stream); int compressor_write(struct compressor *stream, void *data, size_t len);