summaryrefslogtreecommitdiffhomepage
path: root/src/logic
diff options
context:
space:
mode:
Diffstat (limited to 'src/logic')
-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)