tarfs: Silence warnings when no supported compression is enabled.

Some of the code in sys/fs/tarfs/tarfs_io.c is not specific to zstd, but is still only used when some form of decompression is enabled.  Put it behind #ifdef TARFS_ZIO to silence warnings.

Sponsored by:	Juniper Networks, Inc.
Sponsored by:	Klara, Inc.
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D38415
This commit is contained in:
Dag-Erling Smørgrav 2023-02-07 18:27:35 +01:00
parent 220d892129
commit 146d9da6c2

View File

@ -40,6 +40,12 @@
#include <sys/uio.h>
#include <sys/vnode.h>
#if defined(ZSTDIO)
#define TARFS_ZIO 1
#else
#undef TARFS_ZIO
#endif
#ifdef ZSTDIO
#define ZSTD_STATIC_LINKING_ONLY
#include <contrib/zstd/lib/zstd.h>
@ -214,6 +220,7 @@ static ZSTD_customMem tarfs_zstd_mem = {
};
#endif
#ifdef TARFS_ZIO
/*
* Updates the decompression frame index, recording the current input and
* output offsets in a new index entry, and growing the index if
@ -240,6 +247,7 @@ tarfs_zio_update_index(struct tarfs_zio *zio, off_t i, off_t o)
MPASS(zio->idx[zio->curidx].i == i);
MPASS(zio->idx[zio->curidx].o == o);
}
#endif
/*
* VOP_ACCESS for zio node.
@ -600,6 +608,7 @@ static struct vop_vector tarfs_znodeops = {
};
VFS_VOP_VECTOR_REGISTER(tarfs_znodeops);
#ifdef TARFS_ZIO
/*
* Initializes the decompression layer.
*/
@ -630,6 +639,7 @@ tarfs_zio_init(struct tarfs_mount *tmp, off_t i, off_t o)
TARFS_DPF(ZIO, "%s: created zio node\n", __func__);
return (zio);
}
#endif
/*
* Initializes the I/O layer, including decompression if the signature of
@ -640,7 +650,7 @@ int
tarfs_io_init(struct tarfs_mount *tmp)
{
uint8_t *block;
#ifdef ZSTDIO
#ifdef TARFS_ZIO
struct tarfs_zio *zio = NULL;
#endif
ssize_t res;
@ -676,6 +686,7 @@ tarfs_io_init(struct tarfs_mount *tmp)
return (error);
}
#ifdef TARFS_ZIO
/*
* Tears down the decompression layer.
*/
@ -712,6 +723,7 @@ tarfs_zio_fini(struct tarfs_mount *tmp)
tmp->zio = NULL;
return (error);
}
#endif
/*
* Tears down the I/O layer, including the decompression layer if
@ -722,8 +734,10 @@ tarfs_io_fini(struct tarfs_mount *tmp)
{
int error = 0;
#ifdef TARFS_ZIO
if (tmp->zio != NULL) {
error = tarfs_zio_fini(tmp);
}
#endif
return (error);
}