compress: change compression providers API to use ABDs

This commit changes the provider compress and decompress API to take ABD
pointers instead of buffer pointers for both data source and
destination. It then updates all providers to match.

This doesn't actually change the providers to do chunked compression,
just changes the API to allow such an update in the future. Helper
macros are added to easily adapt the ABD functions to their buffer-based
implementations.

Sponsored-by: Klara, Inc.
Sponsored-by: Wasabi Technology, Inc.
Signed-off-by: Rob Norris <rob.norris@klarasystems.com>
This commit is contained in:
Rob Norris
2024-06-30 12:10:00 +10:00
committed by Tony Hutter
parent 522816498c
commit d3c12383c9
11 changed files with 120 additions and 54 deletions
+4 -2
View File
@@ -288,10 +288,12 @@ zstream_do_decompress(int argc, char *argv[])
char *lzbuf = safe_calloc(payload_size);
(void) sfread(lzbuf, payload_size, stdin);
abd_t sabd;
abd_t sabd, dabd;
abd_get_from_buf_struct(&sabd, lzbuf, payload_size);
int err = zio_decompress_data(c, &sabd, buf,
abd_get_from_buf_struct(&dabd, buf, payload_size);
int err = zio_decompress_data(c, &sabd, &dabd,
payload_size, payload_size, NULL);
abd_free(&dabd);
abd_free(&sabd);
if (err != 0) {