summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2024-05-26 03:14:12 +0000
committermidipix <writeonce@midipix.org>2024-05-26 03:42:11 +0000
commitde63a008bfb04739bd189ed183e1dbd656ec4183 (patch)
tree70f3dea9f6c6a62bb71e7059d85871f2da396b34
parentfb29e19bf5c914aaf4c9445ffc52ac44266eb006 (diff)
downloadtpax-de63a008bfb04739bd189ed183e1dbd656ec4183.tar.bz2
tpax-de63a008bfb04739bd189ed183e1dbd656ec4183.tar.xz
driver: implemented the internal tpax_queue_item_full_path().
-rw-r--r--src/internal/tpax_driver_impl.h4
-rw-r--r--src/logic/tpax_queue_vector.c35
2 files changed, 39 insertions, 0 deletions
diff --git a/src/internal/tpax_driver_impl.h b/src/internal/tpax_driver_impl.h
index 1779043..0474bc4 100644
--- a/src/internal/tpax_driver_impl.h
+++ b/src/internal/tpax_driver_impl.h
@@ -278,4 +278,8 @@ static inline ssize_t tpax_get_archive_block_size(const struct tpax_driver_ctx *
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/logic/tpax_queue_vector.c b/src/logic/tpax_queue_vector.c
index 092f39f..82930b1 100644
--- a/src/logic/tpax_queue_vector.c
+++ b/src/logic/tpax_queue_vector.c
@@ -12,6 +12,41 @@
#include "tpax_errinfo_impl.h"
#include "tpax_visibility_impl.h"
+#define TPAX_MAX_DEPTH 512
+
+tpax_hidden const char * tpax_queue_item_full_path(
+ const struct tpax_driver_ctx * dctx,
+ const struct tpax_dirent * cdent)
+{
+ char * ch;
+ char * pathbuf;
+ const struct tpax_dirent * pparent;
+ const struct tpax_dirent ** pdirent;
+ const struct tpax_dirent * dirstck[TPAX_MAX_DEPTH];
+
+ if (cdent->depth >= TPAX_MAX_DEPTH)
+ return 0;
+
+ ch = pathbuf = (tpax_get_driver_ictx(dctx))->dirbuff;
+
+ for (pparent=cdent,pdirent=dirstck; pparent; pparent=pparent->parent)
+ *pdirent++ = pparent;
+
+ *pdirent-- = 0;
+
+ if (pdirent[0]->prefix)
+ ch += sprintf(ch,"%s",pdirent[0]->prefix);
+
+ for (; pdirent > dirstck; ) {
+ ch += sprintf(ch,"%s/",pdirent[0]->dirent.d_name);
+ pdirent--;
+ }
+
+ sprintf(ch,"%s",pdirent[0]->dirent.d_name);
+
+ return pathbuf;
+}
+
tpax_hidden int tpax_update_queue_vector(const struct tpax_driver_ctx * dctx)
{
uintptr_t addr;