summaryrefslogtreecommitdiff
path: root/src/driver
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2024-05-30 02:47:08 +0000
committermidipix <writeonce@midipix.org>2024-05-30 02:47:08 +0000
commit333924297a38d0d8e0b94bd64a6bbcfd845f4ca7 (patch)
tree67782a3f0d930391223da7803d610f6aeb67a4fe /src/driver
parent5cec4427826c31b5f3e8b46acdff54150fbd190e (diff)
downloadtpax-333924297a38d0d8e0b94bd64a6bbcfd845f4ca7.tar.bz2
tpax-333924297a38d0d8e0b94bd64a6bbcfd845f4ca7.tar.xz
driver: set blksize at the time of context creation.
Diffstat (limited to 'src/driver')
-rw-r--r--src/driver/tpax_driver_ctx.c20
1 files changed, 20 insertions, 0 deletions
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;