summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2024-07-18 03:30:36 +0000
committermidipix <writeonce@midipix.org>2024-07-18 05:08:24 +0000
commitdf2d16faa681af8770e63c5e3f9307ba12bd9685 (patch)
tree198382f12408d687af21dd1e6b3e394b33d3686a
parent2569fba5f0afcdb5c459e76e1d11a15191af0a37 (diff)
downloadtpax-df2d16faa681af8770e63c5e3f9307ba12bd9685.tar.bz2
tpax-df2d16faa681af8770e63c5e3f9307ba12bd9685.tar.xz
library api's: defined source data flags.
-rw-r--r--include/tpax/tpax.h12
-rw-r--r--src/driver/tpax_driver_ctx.c10
2 files changed, 22 insertions, 0 deletions
diff --git a/include/tpax/tpax.h b/include/tpax/tpax.h
index 1ea9887..bb6aae7 100644
--- a/include/tpax/tpax.h
+++ b/include/tpax/tpax.h
@@ -63,6 +63,17 @@ extern "C" {
#define TPAX_DRIVER_STRICT_DEVICE_ID 0X10000000
+/* source data flags */
+#define TPAX_SOURCE_DATA_NONE 0x0000
+#define TPAX_SOURCE_DATA_PENDING 0x0001
+#define TPAX_SOURCE_DATA_OPENED 0x0002
+#define TPAX_SOURCE_DATA_CLOSED 0x0004
+
+#define TPAX_SOURCE_DATA_FILEIO 0X0010
+#define TPAX_SOURCE_DATA_MAPPED 0x0020
+#define TPAX_SOURCE_DATA_CACHED 0x0040
+#define TPAX_SOURCE_DATA_ERROR 0x0080
+
/* error flags */
#define TPAX_ERROR_TOP_LEVEL 0x0001
#define TPAX_ERROR_NESTED 0x0002
@@ -119,6 +130,7 @@ struct tpax_common_ctx {
uint64_t drvflags;
uint64_t actflags;
uint64_t fmtflags;
+ uint64_t srcflags;
uint32_t blksize;
};
diff --git a/src/driver/tpax_driver_ctx.c b/src/driver/tpax_driver_ctx.c
index 6a5f882..4ad7fe6 100644
--- a/src/driver/tpax_driver_ctx.c
+++ b/src/driver/tpax_driver_ctx.c
@@ -818,6 +818,8 @@ int tpax_lib_get_driver_ctx(
} else if (archive) {
memcpy(&lfdctx,fdctx,sizeof(*fdctx));
+ cctx.srcflags = TPAX_SOURCE_DATA_PENDING;
+
lfdctx.fdin = openat(
fdctx->fdcwd,
archive->arg,
@@ -829,7 +831,15 @@ int tpax_lib_get_driver_ctx(
program,archive->arg,
meta,false);
+ cctx.srcflags = TPAX_SOURCE_DATA_OPENED;
+
fdctx = &lfdctx;
+
+ } else if (cctx.drvflags & TPAX_DRIVER_EXEC_MODE_WRITE) {
+ cctx.srcflags = TPAX_SOURCE_DATA_NONE;
+
+ } else {
+ cctx.srcflags = TPAX_SOURCE_DATA_PENDING;
}
/* not implemented mode(s) */