summaryrefslogtreecommitdiff
path: root/src/internal/tpax_driver_impl.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/internal/tpax_driver_impl.h')
-rw-r--r--src/internal/tpax_driver_impl.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/internal/tpax_driver_impl.h b/src/internal/tpax_driver_impl.h
index 4003305..47d8fd5 100644
--- a/src/internal/tpax_driver_impl.h
+++ b/src/internal/tpax_driver_impl.h
@@ -8,6 +8,7 @@
#define TPAX_DRIVER_IMPL_H
#include <stdint.h>
+#include <dirent.h>
#include <stdio.h>
#include <sys/stat.h>
#include <sys/types.h>
@@ -18,6 +19,7 @@
#include "argv/argv.h"
#define TPAX_OPTV_ELEMENTS 64
+#define TPAX_DIRENT_BUFLEN 65536
#define TPAX_DRIVER_EXEC_MODE_WRITE_COPY \
(TPAX_DRIVER_EXEC_MODE_WRITE | \
@@ -40,6 +42,22 @@ enum app_tags {
TAG_PURE_PATH,
};
+struct tpax_dirent {
+ int fdat;
+ int depth;
+ size_t nsize;
+ const struct tpax_dirent * parent;
+ struct dirent dirent;
+};
+
+struct tpax_dirent_buffer {
+ struct tpax_dirent_buffer * next;
+ size_t size;
+ size_t nfree;
+ struct tpax_dirent * cdent;
+ struct tpax_dirent dbuf[];
+};
+
struct tpax_driver_ctx_impl {
struct tpax_common_ctx cctx;
struct tpax_driver_ctx ctx;
@@ -50,6 +68,8 @@ struct tpax_driver_ctx_impl {
struct tpax_error_info ** erricap;
struct tpax_error_info * erriptr[64];
struct tpax_error_info erribuf[64];
+ struct tpax_dirent_buffer * dirents;
+ void * dirbuff;
void * bufaddr;
size_t bufsize;
off_t cpos;
@@ -103,6 +123,13 @@ static inline void * tpax_get_driver_anon_map_addr(
return ictx->bufaddr;
}
+static inline void * tpax_get_driver_getdents_buffer(
+ const struct tpax_driver_ctx * dctx)
+{
+ struct tpax_driver_ctx_impl * ictx = tpax_get_driver_ictx(dctx);
+ return ictx->dirbuff;
+}
+
static inline void tpax_driver_set_ectx(
const struct tpax_driver_ctx * dctx,
const struct tpax_unit_ctx * uctx,
@@ -171,6 +198,13 @@ static inline void tpax_set_driver_cpos(const struct tpax_driver_ctx * dctx, off
ictx->cpos = cpos;
}
+static inline struct tpax_dirent_buffer * tpax_get_driver_dirents(const struct tpax_driver_ctx * dctx)
+{
+ struct tpax_driver_ctx_impl * ictx;
+ ictx = tpax_get_driver_ictx(dctx);
+ return ictx->dirents;
+}
+
static inline off_t tpax_get_unit_hpos(const struct tpax_unit_ctx * uctx)
{
struct tpax_unit_ctx_impl * ictx;