summaryrefslogtreecommitdiffhomepage
path: root/src/internal
diff options
context:
space:
mode:
Diffstat (limited to 'src/internal')
-rw-r--r--src/internal/argv/argv.h16
-rw-r--r--src/internal/tpax_dprintf_impl.c6
-rw-r--r--src/internal/tpax_driver_impl.h47
-rw-r--r--src/internal/tpax_errinfo_impl.c5
-rw-r--r--src/internal/tpax_errinfo_impl.h2
-rw-r--r--src/internal/tpax_getdents_impl.h2
-rw-r--r--src/internal/tpax_readlink_impl.h2
-rw-r--r--src/internal/tpax_tmpfile_impl.c6
-rw-r--r--src/internal/tpax_visibility_impl.h26
9 files changed, 93 insertions, 19 deletions
diff --git a/src/internal/argv/argv.h b/src/internal/argv/argv.h
index d66440c..e6051cf 100644
--- a/src/internal/argv/argv.h
+++ b/src/internal/argv/argv.h
@@ -833,6 +833,7 @@ static void argv_usage_impl(
{
const struct argv_option ** optv;
const struct argv_option * option;
+ int nlong;
bool fshort,flong,fboth;
size_t len,optlen,desclen;
char cache;
@@ -865,7 +866,7 @@ static void argv_usage_impl(
if (header)
argv_dprintf(fd,"%s",header);
- for (optlen=0,optv=options; *optv; optv++) {
+ for (optlen=0,nlong=0,optv=options; *optv; optv++) {
option = *optv;
/* indent + comma */
@@ -884,6 +885,11 @@ static void argv_usage_impl(
/* optlen */
if (len > optlen)
optlen = len;
+
+ /* long (vs. hybrid-only) option? */
+ if (option->long_name)
+ if (!(option->flags & ARGV_OPTION_HYBRID_ONLY))
+ nlong++;
}
if (optlen >= optcap) {
@@ -904,7 +910,7 @@ static void argv_usage_impl(
/* color */
if (fcolor) {
color = (color == ccyan) ? cblue : ccyan;
- argv_dprintf(fd,color);
+ argv_dprintf(fd,color,0);
}
/* description, using either paradigm or argname if applicable */
@@ -916,7 +922,11 @@ static void argv_usage_impl(
/* long/hybrid option prefix (-/--) */
prefix = option->flags & ARGV_OPTION_HYBRID_ONLY
- ? " -" : "--";
+ ? " -" : " --";
+
+ /* avoid extra <stace> when all long opts are hybrid-only */
+ if (nlong == 0)
+ prefix++;
/* option string */
if (fboth && option->short_name && option->long_name)
diff --git a/src/internal/tpax_dprintf_impl.c b/src/internal/tpax_dprintf_impl.c
index b8d2b0b..2bc83a8 100644
--- a/src/internal/tpax_dprintf_impl.c
+++ b/src/internal/tpax_dprintf_impl.c
@@ -1,6 +1,6 @@
/**************************************************************/
/* tpax: a topological pax implementation */
-/* Copyright (C) 2020--2021 SysDeer Technologies, LLC */
+/* Copyright (C) 2020--2024 SysDeer Technologies, LLC */
/* Released under GPLv2 and GPLv3; see COPYING.TPAX. */
/**************************************************************/
@@ -10,7 +10,9 @@
#include <unistd.h>
#include <errno.h>
-int tpax_dprintf(int fd, const char * fmt, ...)
+#include "tpax_visibility_impl.h"
+
+tpax_hidden int tpax_dprintf(int fd, const char * fmt, ...)
{
int ret;
int cnt;
diff --git a/src/internal/tpax_driver_impl.h b/src/internal/tpax_driver_impl.h
index 5fabb0a..cd734b0 100644
--- a/src/internal/tpax_driver_impl.h
+++ b/src/internal/tpax_driver_impl.h
@@ -1,6 +1,6 @@
/**************************************************************/
/* tpax: a topological pax implementation */
-/* Copyright (C) 2020--2021 SysDeer Technologies, LLC */
+/* Copyright (C) 2020--2024 SysDeer Technologies, LLC */
/* Released under GPLv2 and GPLv3; see COPYING.TPAX. */
/**************************************************************/
@@ -26,6 +26,9 @@
(TPAX_DRIVER_EXEC_MODE_WRITE | \
TPAX_DRIVER_EXEC_MODE_COPY)
+#define TPAX_ITEM_EXPLICIT 0X1
+#define TPAX_ITEM_IMPLICIT 0X2
+
extern const struct argv_option tpax_default_options[];
enum app_tags {
@@ -46,7 +49,9 @@ enum app_tags {
struct tpax_dirent {
int fdat;
int depth;
+ int flags;
size_t nsize;
+ const char * prefix;
const struct tpax_dirent * parent;
struct dirent dirent;
};
@@ -69,10 +74,17 @@ struct tpax_driver_ctx_impl {
struct tpax_error_info ** erricap;
struct tpax_error_info * erriptr[64];
struct tpax_error_info erribuf[64];
+ char ** prefixv;
+ char ** prefixp;
+ char ** prefcap;
+ char * prefptr[64];
+ struct tpax_dirent ** direntv;
struct tpax_dirent_buffer * dirents;
+ struct tpax_dirent * dirmark;
void * dirbuff;
void * bufaddr;
size_t bufsize;
+ size_t nqueued;
off_t cpos;
};
@@ -143,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;
}
@@ -203,6 +215,21 @@ static inline struct tpax_dirent_buffer * tpax_get_driver_dirents(const struct t
return ictx->dirents;
}
+static inline struct tpax_dirent * tpax_get_driver_dirmark(const struct tpax_driver_ctx * dctx)
+{
+ struct tpax_driver_ctx_impl * ictx;
+ ictx = tpax_get_driver_ictx(dctx);
+ return ictx->dirmark;
+}
+
+static inline void tpax_set_driver_dirmark(const struct tpax_driver_ctx * dctx, struct tpax_dirent * dirent)
+{
+ struct tpax_driver_ctx_impl * ictx;
+ ictx = tpax_get_driver_ictx(dctx);
+ ictx->dirmark = dirent;
+ ictx->nqueued++;
+}
+
static inline off_t tpax_get_unit_hpos(const struct tpax_unit_ctx * uctx)
{
struct tpax_unit_ctx_impl * ictx;
@@ -249,4 +276,10 @@ static inline ssize_t tpax_get_archive_block_size(const struct tpax_driver_ctx *
return 0;
}
+int tpax_update_queue_vector(const struct tpax_driver_ctx * dctx);
+
+const char * tpax_queue_item_full_path(
+ const struct tpax_driver_ctx *,
+ const struct tpax_dirent *);
+
#endif
diff --git a/src/internal/tpax_errinfo_impl.c b/src/internal/tpax_errinfo_impl.c
index 5fd2247..50a99a5 100644
--- a/src/internal/tpax_errinfo_impl.c
+++ b/src/internal/tpax_errinfo_impl.c
@@ -1,14 +1,15 @@
/**************************************************************/
/* tpax: a topological pax implementation */
-/* Copyright (C) 2020--2021 SysDeer Technologies, LLC */
+/* Copyright (C) 2020--2024 SysDeer Technologies, LLC */
/* Released under GPLv2 and GPLv3; see COPYING.TPAX. */
/**************************************************************/
#include <tpax/tpax.h>
#include "tpax_driver_impl.h"
#include "tpax_errinfo_impl.h"
+#include "tpax_visibility_impl.h"
-int tpax_record_error(
+tpax_hidden int tpax_record_error(
const struct tpax_driver_ctx * dctx,
int esyscode,
int elibcode,
diff --git a/src/internal/tpax_errinfo_impl.h b/src/internal/tpax_errinfo_impl.h
index 99b416b..e8151c5 100644
--- a/src/internal/tpax_errinfo_impl.h
+++ b/src/internal/tpax_errinfo_impl.h
@@ -1,6 +1,6 @@
/**************************************************************/
/* tpax: a topological pax implementation */
-/* Copyright (C) 2020--2021 SysDeer Technologies, LLC */
+/* Copyright (C) 2020--2024 SysDeer Technologies, LLC */
/* Released under GPLv2 and GPLv3; see COPYING.TPAX. */
/**************************************************************/
diff --git a/src/internal/tpax_getdents_impl.h b/src/internal/tpax_getdents_impl.h
index 42b9da0..2f46d63 100644
--- a/src/internal/tpax_getdents_impl.h
+++ b/src/internal/tpax_getdents_impl.h
@@ -1,6 +1,6 @@
/**************************************************************/
/* tpax: a topological pax implementation */
-/* Copyright (C) 2020--2021 SysDeer Technologies, LLC */
+/* Copyright (C) 2020--2024 SysDeer Technologies, LLC */
/* Released under GPLv2 and GPLv3; see COPYING.TPAX. */
/**************************************************************/
diff --git a/src/internal/tpax_readlink_impl.h b/src/internal/tpax_readlink_impl.h
index d6c5580..e2febe1 100644
--- a/src/internal/tpax_readlink_impl.h
+++ b/src/internal/tpax_readlink_impl.h
@@ -1,6 +1,6 @@
/**************************************************************/
/* tpax: a topological pax implementation */
-/* Copyright (C) 2020--2021 SysDeer Technologies, LLC */
+/* Copyright (C) 2020--2024 SysDeer Technologies, LLC */
/* Released under GPLv2 and GPLv3; see COPYING.TPAX. */
/**************************************************************/
diff --git a/src/internal/tpax_tmpfile_impl.c b/src/internal/tpax_tmpfile_impl.c
index 9dd9d40..aa78e40 100644
--- a/src/internal/tpax_tmpfile_impl.c
+++ b/src/internal/tpax_tmpfile_impl.c
@@ -1,6 +1,6 @@
/**************************************************************/
/* tpax: a topological pax implementation */
-/* Copyright (C) 2020--2021 SysDeer Technologies, LLC */
+/* Copyright (C) 2020--2024 SysDeer Technologies, LLC */
/* Released under GPLv2 and GPLv3; see COPYING.TPAX. */
/**************************************************************/
@@ -14,6 +14,8 @@
#include <stdio.h>
#include <inttypes.h>
+#include "tpax_visibility_impl.h"
+
#define PPRIX64 "%"PRIx64
/* mkostemp might be guarded by non-standard macros */
@@ -55,7 +57,7 @@ static int tpax_mkostemp(char * tmplate)
return fd;
}
-int tpax_tmpfile(void)
+tpax_hidden int tpax_tmpfile(void)
{
int fd;
void * addr;
diff --git a/src/internal/tpax_visibility_impl.h b/src/internal/tpax_visibility_impl.h
new file mode 100644
index 0000000..6812494
--- /dev/null
+++ b/src/internal/tpax_visibility_impl.h
@@ -0,0 +1,26 @@
+#ifndef TPAX_VISIBILITY_IMPL_H
+#define TPAX_VISIBILITY_IMPL_H
+
+/**********************************************************************/
+/* PE targets: __dllexport suffices for the purpose of exporting only */
+/* the desired subset of global symbols; this makes the visibility */
+/* attribute not only redundant, but also tricky if not properly */
+/* supported by the toolchain. */
+/* */
+/* When targeting Midipix, __PE__, __dllexport and __dllimport are */
+/* always defined by the toolchain. Otherwise, the absnece of these */
+/* macros has been detected by sofort's ccenv.sh during ./configure, */
+/* and they have accordingly been added to CFLAGS_OS. */
+/**********************************************************************/
+
+#ifdef __PE__
+#define tpax_hidden
+#else
+#ifdef _ATTR_VISIBILITY_HIDDEN
+#define tpax_hidden _ATTR_VISIBILITY_HIDDEN
+#else
+#define tpax_hidden
+#endif
+#endif
+
+#endif