diff options
Diffstat (limited to 'src/internal/tpax_driver_impl.h')
-rw-r--r-- | src/internal/tpax_driver_impl.h | 73 |
1 files changed, 50 insertions, 23 deletions
diff --git a/src/internal/tpax_driver_impl.h b/src/internal/tpax_driver_impl.h index 5fabb0a..d340748 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,27 +26,42 @@ (TPAX_DRIVER_EXEC_MODE_WRITE | \ TPAX_DRIVER_EXEC_MODE_COPY) +#define TPAX_ITEM_EXPLICIT 0X1 +#define TPAX_ITEM_IMPLICIT 0X2 +#define TPAX_ITEM_SYMLINK 0X4 +#define TPAX_ITEM_NAMEREF 0x8 + extern const struct argv_option tpax_default_options[]; enum app_tags { TAG_HELP, TAG_VERSION, + TAG_VERBOSE, TAG_LIST, TAG_READ, TAG_WRITE, TAG_COPY, + TAG_FILE, TAG_FORMAT, TAG_BLKSIZE, + TAG_OPTIONS, TAG_RECURSE, TAG_NORECURSE, TAG_STRICT_PATH, TAG_PURE_PATH, + TAG_PRESERVE_ATIME, + TAG_PAX_SYMLINK_ARGS, + TAG_PAX_SYMLINK_ITEMS, + TAG_STRICT_DEVICE_ID, }; struct tpax_dirent { int fdat; int depth; + int flags; + dev_t stdev; size_t nsize; + const char * prefix; const struct tpax_dirent * parent; struct dirent dirent; }; @@ -60,19 +75,28 @@ struct tpax_dirent_buffer { }; struct tpax_driver_ctx_impl { + const char * file; struct tpax_common_ctx cctx; struct tpax_driver_ctx ctx; struct tpax_fd_ctx fdctx; const struct tpax_unit_ctx * euctx; const char * eunit; + struct argv_keyval ** keyvalv; struct tpax_error_info ** errinfp; 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 +167,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 +227,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; @@ -231,22 +270,10 @@ static inline void tpax_set_unit_dpos(const struct tpax_unit_ctx * uctx, off_t d ictx->dpos = dpos; } -static inline ssize_t tpax_get_archive_block_size(const struct tpax_driver_ctx * dctx) -{ - if (dctx->cctx->drvflags & TPAX_DRIVER_WRITE_FORMAT_PAX) - return TPAX_PAX_BLOCK_SIZE; - - else if (dctx->cctx->drvflags & TPAX_DRIVER_WRITE_FORMAT_CPIO) - return TPAX_CPIO_BLOCK_SIZE; - - else if (dctx->cctx->drvflags & TPAX_DRIVER_WRITE_FORMAT_USTAR) - return TPAX_USTAR_BLOCK_SIZE; +int tpax_update_queue_vector(const struct tpax_driver_ctx * dctx); - else if (dctx->cctx->drvflags & TPAX_DRIVER_WRITE_FORMAT_RUSTAR) - return TPAX_USTAR_BLOCK_SIZE; - - else - return 0; -} +const char * tpax_queue_item_full_path( + const struct tpax_driver_ctx *, + const struct tpax_dirent *); #endif |