summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2024-06-06 21:54:54 +0000
committermidipix <writeonce@midipix.org>2024-06-06 23:39:26 +0000
commit8034d053d2a29f7721066ff1190aa6814a300d40 (patch)
tree33251ed8dcc624f247fc34333f27af70f2963695
parent37f51391c8888c7f84e27ec6995fda5dd3af49c3 (diff)
downloadtpax-8034d053d2a29f7721066ff1190aa6814a300d40.tar.bz2
tpax-8034d053d2a29f7721066ff1190aa6814a300d40.tar.xz
tpax_dirent_init_from_uctx(): move up in anticipation of -L support.
-rw-r--r--src/logic/tpax_archive_enqueue.c78
1 files changed, 39 insertions, 39 deletions
diff --git a/src/logic/tpax_archive_enqueue.c b/src/logic/tpax_archive_enqueue.c
index b81661b..ab07ab5 100644
--- a/src/logic/tpax_archive_enqueue.c
+++ b/src/logic/tpax_archive_enqueue.c
@@ -83,6 +83,45 @@ static char * tpax_add_prefix_item_from_path(
return tpax_add_prefix_item(dctx,pathbuf);
}
+static int tpax_dirent_init_from_uctx(
+ const struct stat * st,
+ const char * basename,
+ struct dirent * dirent)
+{
+ /* st_mode to d_type translation */
+ if (S_ISREG(st->st_mode))
+ dirent->d_type = DT_REG;
+ else if (S_ISLNK(st->st_mode))
+ dirent->d_type = DT_LNK;
+ else if (S_ISDIR(st->st_mode))
+ dirent->d_type = DT_DIR;
+ else if (S_ISCHR(st->st_mode))
+ dirent->d_type = DT_CHR;
+ else if (S_ISBLK(st->st_mode))
+ dirent->d_type = DT_CHR;
+ else if (S_ISFIFO(st->st_mode))
+ dirent->d_type = DT_CHR;
+ else
+ return -1;
+
+ /* d_off, d_ino */
+ dirent->d_off = 0;
+ dirent->d_ino = st->st_ino;
+
+ /* d_reclen */
+ dirent->d_reclen = offsetof(struct dirent,d_name);
+ dirent->d_reclen += strlen(basename) + 1;
+
+ dirent->d_reclen += 0x1;
+ dirent->d_reclen |= 0x1;
+ dirent->d_reclen ^= 0x1;
+
+ /* d_name */
+ strcpy(dirent->d_name,basename);
+
+ return 0;
+}
+
static struct tpax_dirent_buffer * tpax_dirent_buf_first_alloc(
const struct tpax_driver_ctx * dctx)
{
@@ -356,45 +395,6 @@ static const char * tpax_path_prefix_mark(const char * path)
return (mark <= pathbuf) ? 0 : &path[--mark-pathbuf];
}
-static int tpax_dirent_init_from_uctx(
- const struct stat * st,
- const char * basename,
- struct dirent * dirent)
-{
- /* st_mode to d_type translation */
- if (S_ISREG(st->st_mode))
- dirent->d_type = DT_REG;
- else if (S_ISLNK(st->st_mode))
- dirent->d_type = DT_LNK;
- else if (S_ISDIR(st->st_mode))
- dirent->d_type = DT_DIR;
- else if (S_ISCHR(st->st_mode))
- dirent->d_type = DT_CHR;
- else if (S_ISBLK(st->st_mode))
- dirent->d_type = DT_CHR;
- else if (S_ISFIFO(st->st_mode))
- dirent->d_type = DT_CHR;
- else
- return -1;
-
- /* d_off, d_ino */
- dirent->d_off = 0;
- dirent->d_ino = st->st_ino;
-
- /* d_reclen */
- dirent->d_reclen = offsetof(struct dirent,d_name);
- dirent->d_reclen += strlen(basename) + 1;
-
- dirent->d_reclen += 0x1;
- dirent->d_reclen |= 0x1;
- dirent->d_reclen ^= 0x1;
-
- /* d_name */
- strcpy(dirent->d_name,basename);
-
- return 0;
-}
-
int tpax_archive_enqueue(
const struct tpax_driver_ctx * dctx,
const struct tpax_unit_ctx * uctx)