summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2024-05-26 14:18:17 +0000
committermidipix <writeonce@midipix.org>2024-05-26 14:18:17 +0000
commitc9eeca63ccc3960c0253368147e95fdd61b04fcd (patch)
tree566072febd91a8eed889e6da1314866c372e46d4
parent99ab678ae0659e60290154dabe987e6fb0029d3e (diff)
downloadtpax-c9eeca63ccc3960c0253368147e95fdd61b04fcd.tar.bz2
tpax-c9eeca63ccc3960c0253368147e95fdd61b04fcd.tar.xz
library api's: _lib_ (program driver) namespace overhaul.
-rw-r--r--include/tpax/tpax.h19
-rw-r--r--src/driver/tpax_amain.c8
-rw-r--r--src/driver/tpax_driver_ctx.c8
-rw-r--r--src/driver/tpax_unit_ctx.c4
-rw-r--r--src/internal/tpax_driver_impl.h12
-rw-r--r--src/logic/tpax_archive_append.c4
-rw-r--r--src/logic/tpax_archive_write.c6
7 files changed, 31 insertions, 30 deletions
diff --git a/include/tpax/tpax.h b/include/tpax/tpax.h
index 9ea2a94..ef78199 100644
--- a/include/tpax/tpax.h
+++ b/include/tpax/tpax.h
@@ -135,19 +135,20 @@ struct tpax_unit_ctx {
};
/* driver api */
-tpax_api int tpax_get_driver_ctx (char ** argv, char ** envp, uint32_t flags,
- const struct tpax_fd_ctx *,
- struct tpax_driver_ctx **);
+tpax_api int tpax_lib_get_driver_ctx (char ** argv, char ** envp, uint32_t flags,
+ const struct tpax_fd_ctx *,
+ struct tpax_driver_ctx **);
-tpax_api void tpax_free_driver_ctx (struct tpax_driver_ctx *);
+tpax_api void tpax_lib_free_driver_ctx (struct tpax_driver_ctx *);
-tpax_api int tpax_get_unit_ctx (const struct tpax_driver_ctx *, int, const char * path,
- struct tpax_unit_ctx **);
+tpax_api int tpax_lib_get_unit_ctx (const struct tpax_driver_ctx *, int, const char * path,
+ struct tpax_unit_ctx **);
-tpax_api void tpax_free_unit_ctx (struct tpax_unit_ctx *);
+tpax_api void tpax_lib_free_unit_ctx (struct tpax_unit_ctx *);
-tpax_api int tpax_get_driver_fdctx (const struct tpax_driver_ctx *, struct tpax_fd_ctx *);
-tpax_api int tpax_set_driver_fdctx (struct tpax_driver_ctx *, const struct tpax_fd_ctx *);
+tpax_api int tpax_lib_get_driver_fdctx (const struct tpax_driver_ctx *, struct tpax_fd_ctx *);
+
+tpax_api int tpax_lib_set_driver_fdctx (struct tpax_driver_ctx *, const struct tpax_fd_ctx *);
/* core api */
tpax_api int tpax_archive_append (const struct tpax_driver_ctx *, const struct tpax_unit_ctx *);
diff --git a/src/driver/tpax_amain.c b/src/driver/tpax_amain.c
index e9aa726..0ec20f4 100644
--- a/src/driver/tpax_amain.c
+++ b/src/driver/tpax_amain.c
@@ -74,7 +74,7 @@ static void tpax_perform_archive_actions(
static int tpax_exit(struct tpax_driver_ctx * dctx, int ret)
{
tpax_output_error_vector(dctx);
- tpax_free_driver_ctx(dctx);
+ tpax_lib_free_driver_ctx(dctx);
return ret;
}
@@ -92,7 +92,7 @@ int tpax_main(char ** argv, char ** envp, const struct tpax_fd_ctx * fdctx)
fdout = fdctx ? fdctx->fdout : STDOUT_FILENO;
fdcwd = fdctx ? fdctx->fdcwd : AT_FDCWD;
- if ((ret = tpax_get_driver_ctx(argv,envp,flags,fdctx,&dctx)))
+ if ((ret = tpax_lib_get_driver_ctx(argv,envp,flags,fdctx,&dctx)))
return (ret == TPAX_USAGE)
? !argv || !argv[0] || !argv[1]
: TPAX_ERROR;
@@ -102,9 +102,9 @@ int tpax_main(char ** argv, char ** envp, const struct tpax_fd_ctx * fdctx)
return tpax_exit(dctx,TPAX_ERROR);
for (unit=dctx->units; *unit; unit++) {
- if (!(tpax_get_unit_ctx(dctx,fdcwd,*unit,&uctx))) {
+ if (!(tpax_lib_get_unit_ctx(dctx,fdcwd,*unit,&uctx))) {
tpax_perform_unit_actions(dctx,uctx);
- tpax_free_unit_ctx(uctx);
+ tpax_lib_free_unit_ctx(uctx);
}
}
diff --git a/src/driver/tpax_driver_ctx.c b/src/driver/tpax_driver_ctx.c
index 77eedd1..f573523 100644
--- a/src/driver/tpax_driver_ctx.c
+++ b/src/driver/tpax_driver_ctx.c
@@ -326,7 +326,7 @@ static int tpax_get_driver_ctx_fail(struct argv_meta * meta)
return -1;
}
-int tpax_get_driver_ctx(
+int tpax_lib_get_driver_ctx(
char ** argv,
char ** envp,
uint32_t flags,
@@ -596,7 +596,7 @@ static void tpax_free_driver_ctx_impl(struct tpax_driver_ctx_alloc * ictx)
free(ictx);
}
-void tpax_free_driver_ctx(struct tpax_driver_ctx * ctx)
+void tpax_lib_free_driver_ctx(struct tpax_driver_ctx * ctx)
{
struct tpax_driver_ctx_alloc * ictx;
uintptr_t addr;
@@ -614,7 +614,7 @@ const struct tpax_source_version * tpax_source_version(void)
return &tpax_src_version;
}
-int tpax_get_driver_fdctx(
+int tpax_lib_get_driver_fdctx(
const struct tpax_driver_ctx * dctx,
struct tpax_fd_ctx * fdctx)
{
@@ -632,7 +632,7 @@ int tpax_get_driver_fdctx(
return 0;
}
-int tpax_set_driver_fdctx(
+int tpax_lib_set_driver_fdctx(
struct tpax_driver_ctx * dctx,
const struct tpax_fd_ctx * fdctx)
{
diff --git a/src/driver/tpax_unit_ctx.c b/src/driver/tpax_unit_ctx.c
index 95da1d1..1fbc510 100644
--- a/src/driver/tpax_unit_ctx.c
+++ b/src/driver/tpax_unit_ctx.c
@@ -25,7 +25,7 @@ static int tpax_free_unit_ctx_impl(struct tpax_unit_ctx_impl * ctx, int ret)
return ret;
}
-int tpax_get_unit_ctx(
+int tpax_lib_get_unit_ctx(
const struct tpax_driver_ctx * dctx,
int fdat,
const char * path,
@@ -76,7 +76,7 @@ int tpax_get_unit_ctx(
return 0;
}
-void tpax_free_unit_ctx(struct tpax_unit_ctx * ctx)
+void tpax_lib_free_unit_ctx(struct tpax_unit_ctx * ctx)
{
struct tpax_unit_ctx_impl * ictx;
uintptr_t addr;
diff --git a/src/internal/tpax_driver_impl.h b/src/internal/tpax_driver_impl.h
index 0474bc4..cd734b0 100644
--- a/src/internal/tpax_driver_impl.h
+++ b/src/internal/tpax_driver_impl.h
@@ -155,42 +155,42 @@ static inline void tpax_driver_set_ectx(
static inline int tpax_driver_fdin(const struct tpax_driver_ctx * dctx)
{
struct tpax_fd_ctx fdctx;
- tpax_get_driver_fdctx(dctx,&fdctx);
+ tpax_lib_get_driver_fdctx(dctx,&fdctx);
return fdctx.fdin;
}
static inline int tpax_driver_fdout(const struct tpax_driver_ctx * dctx)
{
struct tpax_fd_ctx fdctx;
- tpax_get_driver_fdctx(dctx,&fdctx);
+ tpax_lib_get_driver_fdctx(dctx,&fdctx);
return fdctx.fdout;
}
static inline int tpax_driver_fderr(const struct tpax_driver_ctx * dctx)
{
struct tpax_fd_ctx fdctx;
- tpax_get_driver_fdctx(dctx,&fdctx);
+ tpax_lib_get_driver_fdctx(dctx,&fdctx);
return fdctx.fderr;
}
static inline int tpax_driver_fdlog(const struct tpax_driver_ctx * dctx)
{
struct tpax_fd_ctx fdctx;
- tpax_get_driver_fdctx(dctx,&fdctx);
+ tpax_lib_get_driver_fdctx(dctx,&fdctx);
return fdctx.fdlog;
}
static inline int tpax_driver_fdcwd(const struct tpax_driver_ctx * dctx)
{
struct tpax_fd_ctx fdctx;
- tpax_get_driver_fdctx(dctx,&fdctx);
+ tpax_lib_get_driver_fdctx(dctx,&fdctx);
return fdctx.fdcwd;
}
static inline int tpax_driver_fddst(const struct tpax_driver_ctx * dctx)
{
struct tpax_fd_ctx fdctx;
- tpax_get_driver_fdctx(dctx,&fdctx);
+ tpax_lib_get_driver_fdctx(dctx,&fdctx);
return fdctx.fddst;
}
diff --git a/src/logic/tpax_archive_append.c b/src/logic/tpax_archive_append.c
index cfdcb74..d0f5cb4 100644
--- a/src/logic/tpax_archive_append.c
+++ b/src/logic/tpax_archive_append.c
@@ -142,7 +142,7 @@ static int tpax_archive_append_ret(
struct tpax_unit_ctx * unit)
{
if (unit)
- tpax_free_unit_ctx(unit);
+ tpax_lib_free_unit_ctx(unit);
return ret;
}
@@ -242,7 +242,7 @@ static int tpax_archive_append_dir_entries(
depth = dent->depth;
/* uctx on the fly */
- if (tpax_get_unit_ctx(
+ if (tpax_lib_get_unit_ctx(
dctx,fdat,
dent->dirent.d_name,
&uctx) < 0)
diff --git a/src/logic/tpax_archive_write.c b/src/logic/tpax_archive_write.c
index 272f9b9..707b288 100644
--- a/src/logic/tpax_archive_write.c
+++ b/src/logic/tpax_archive_write.c
@@ -67,7 +67,7 @@ static int tpax_archive_write_ret(
int ret,
struct tpax_unit_ctx * uctx)
{
- tpax_free_unit_ctx(uctx);
+ tpax_lib_free_unit_ctx(uctx);
return ret;
}
@@ -97,7 +97,7 @@ static int tpax_archive_write_impl(
TPAX_ERR_FLOW_ERROR);
/* uctx */
- if (tpax_get_unit_ctx(dctx,fdcwd,path,&uctx) < 0)
+ if (tpax_lib_get_unit_ctx(dctx,fdcwd,path,&uctx) < 0)
return TPAX_NESTED_ERROR(dctx);
/* record errors */
@@ -165,7 +165,7 @@ static int tpax_archive_write_impl(
/* all done? */
if (!(S_ISREG(uctx->st->st_mode))) {
- tpax_free_unit_ctx(uctx);
+ tpax_lib_free_unit_ctx(uctx);
return 0;
}