From 333924297a38d0d8e0b94bd64a6bbcfd845f4ca7 Mon Sep 17 00:00:00 2001 From: midipix Date: Thu, 30 May 2024 02:47:08 +0000 Subject: driver: set blksize at the time of context creation. --- src/driver/tpax_driver_ctx.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/driver/tpax_driver_ctx.c') diff --git a/src/driver/tpax_driver_ctx.c b/src/driver/tpax_driver_ctx.c index 37ec718..7722ae4 100644 --- a/src/driver/tpax_driver_ctx.c +++ b/src/driver/tpax_driver_ctx.c @@ -304,6 +304,24 @@ static int tpax_driver_error_not_implemented( return TPAX_FATAL; } +static void tpax_set_archive_block_size(struct tpax_common_ctx * cctx) +{ + if (cctx->blksize) + (void)0; + + else if (cctx->drvflags & TPAX_DRIVER_WRITE_FORMAT_PAX) + cctx->blksize = TPAX_PAX_BLOCK_SIZE; + + else if (cctx->drvflags & TPAX_DRIVER_WRITE_FORMAT_CPIO) + cctx->blksize = TPAX_CPIO_BLOCK_SIZE; + + else if (cctx->drvflags & TPAX_DRIVER_WRITE_FORMAT_USTAR) + cctx->blksize = TPAX_USTAR_BLOCK_SIZE; + + else if (cctx->drvflags & TPAX_DRIVER_WRITE_FORMAT_RUSTAR) + cctx->blksize = TPAX_USTAR_BLOCK_SIZE; +} + static struct tpax_driver_ctx_impl * tpax_driver_ctx_alloc( struct argv_meta * meta, const struct tpax_fd_ctx * fdctx, @@ -368,6 +386,8 @@ static struct tpax_driver_ctx_impl * tpax_driver_ctx_alloc( } } + tpax_set_archive_block_size(&ictx->ctx.cctx); + ictx->ctx.ctx.units = ictx->units; ictx->ctx.ctx.errv = ictx->ctx.errinfp; return &ictx->ctx; -- cgit v1.2.3