diff options
author | midipix <writeonce@midipix.org> | 2024-05-30 03:52:14 +0000 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2024-05-30 03:52:14 +0000 |
commit | 43c39bb6b44cc96ac012c259e30c1466cfb23b48 (patch) | |
tree | 146bb12ad4b1eb8372f7059b510d6fd2799162b5 | |
parent | fa0b0349b3987f37885cccbe8cefb80d404db90a (diff) | |
download | tpax-43c39bb6b44cc96ac012c259e30c1466cfb23b48.tar.bz2 tpax-43c39bb6b44cc96ac012c259e30c1466cfb23b48.tar.xz |
core api: renamed tpax_archive_append() as tpax_archive_enqueue().
-rw-r--r-- | include/tpax/tpax.h | 2 | ||||
-rw-r--r-- | project/common.mk | 2 | ||||
-rw-r--r-- | src/driver/tpax_amain.c | 2 | ||||
-rw-r--r-- | src/logic/tpax_archive_enqueue.c (renamed from src/logic/tpax_archive_append.c) | 48 |
4 files changed, 27 insertions, 27 deletions
diff --git a/include/tpax/tpax.h b/include/tpax/tpax.h index 172c7ae..eb106d6 100644 --- a/include/tpax/tpax.h +++ b/include/tpax/tpax.h @@ -152,7 +152,7 @@ tpax_api int tpax_lib_get_driver_fdctx (const struct tpax_driver_ctx *, str tpax_api int tpax_lib_set_driver_fdctx (struct tpax_driver_ctx *, const struct tpax_fd_ctx *); /* core api */ -tpax_api int tpax_archive_append (const struct tpax_driver_ctx *, const struct tpax_unit_ctx *); +tpax_api int tpax_archive_enqueue (const struct tpax_driver_ctx *, const struct tpax_unit_ctx *); tpax_api int tpax_archive_write (const struct tpax_driver_ctx *); diff --git a/project/common.mk b/project/common.mk index 5ae4ea2..c934519 100644 --- a/project/common.mk +++ b/project/common.mk @@ -4,7 +4,7 @@ API_SRCS = \ src/driver/tpax_unit_ctx.c \ src/io/tpax_create_memory_snapshot.c \ src/io/tpax_create_tmpfs_snapshot.c \ - src/logic/tpax_archive_append.c \ + src/logic/tpax_archive_enqueue.c \ src/logic/tpax_archive_reset.c \ src/logic/tpax_archive_write.c \ src/logic/tpax_queue_vector.c \ diff --git a/src/driver/tpax_amain.c b/src/driver/tpax_amain.c index 61f53d1..429633e 100644 --- a/src/driver/tpax_amain.c +++ b/src/driver/tpax_amain.c @@ -54,7 +54,7 @@ static void tpax_perform_unit_actions( struct tpax_unit_ctx * uctx) { if (dctx->cctx->drvflags & TPAX_DRIVER_EXEC_MODE_WRITE) - tpax_archive_append(dctx,uctx); + tpax_archive_enqueue(dctx,uctx); } static void tpax_archive_write_and_seal( diff --git a/src/logic/tpax_archive_append.c b/src/logic/tpax_archive_enqueue.c index 444ae7f..222b0ad 100644 --- a/src/logic/tpax_archive_append.c +++ b/src/logic/tpax_archive_enqueue.c @@ -22,7 +22,7 @@ #include "tpax_tmpfile_impl.h" #include "tpax_errinfo_impl.h" -static char * tpax_append_prefix_item( +static char * tpax_add_prefix_item( const struct tpax_driver_ctx * dctx, const char * prefix) { @@ -65,7 +65,7 @@ static char * tpax_append_prefix_item( return pitem; } -static char * tpax_append_prefix_item_from_path( +static char * tpax_add_prefix_item_from_path( const struct tpax_driver_ctx * dctx, const char * path, const char * mark) @@ -80,7 +80,7 @@ static char * tpax_append_prefix_item_from_path( pathbuf[nbytes++] = '/'; pathbuf[nbytes] = '\0'; - return tpax_append_prefix_item(dctx,pathbuf); + return tpax_add_prefix_item(dctx,pathbuf); } static struct tpax_dirent_buffer * tpax_dirent_buf_first_alloc( @@ -137,7 +137,7 @@ static struct tpax_dirent_buffer * tpax_dirent_buf_next_alloc( return current->next; } -static int tpax_archive_append_ret( +static int tpax_archive_enqueue_ret( int ret, struct tpax_unit_ctx * unit) { @@ -147,7 +147,7 @@ static int tpax_archive_append_ret( return ret; } -static int tpax_archive_append_queue_item( +static int tpax_archive_add_queue_item( const struct tpax_driver_ctx * dctx, const struct dirent * dirent, const struct tpax_dirent * parent, @@ -166,7 +166,7 @@ static int tpax_archive_append_queue_item( if (!(dentbuf = tpax_get_driver_dirents(dctx))) if (!(dentbuf = tpax_dirent_buf_first_alloc(dctx))) - return tpax_archive_append_ret( + return tpax_archive_enqueue_ret( TPAX_SYSTEM_ERROR(dctx), 0); @@ -181,7 +181,7 @@ static int tpax_archive_append_queue_item( if (dentbuf->nfree < needed) if (!(dentbuf = tpax_dirent_buf_next_alloc(dentbuf))) - return tpax_archive_append_ret( + return tpax_archive_enqueue_ret( TPAX_SYSTEM_ERROR(dctx), 0); @@ -222,7 +222,7 @@ static int tpax_archive_append_queue_item( return 0; } -static int tpax_archive_append_dir_entries( +static int tpax_archive_enqueue_dir_entries( const struct tpax_driver_ctx * dctx, struct tpax_dirent * dent) { @@ -250,7 +250,7 @@ static int tpax_archive_append_dir_entries( /* verify that recursion item is still a directory */ if (!S_ISDIR(uctx->st->st_mode)) - return tpax_archive_append_ret( + return tpax_archive_enqueue_ret( TPAX_CUSTOM_ERROR(dctx,TPAX_ERR_FLOW_ERROR), uctx); @@ -263,7 +263,7 @@ static int tpax_archive_append_dir_entries( /* open directory and obtain first directory entries */ if ((fd = openat(fdat,dent->dirent.d_name,O_RDONLY|O_DIRECTORY|O_CLOEXEC,0)) < 0) - return tpax_archive_append_ret( + return tpax_archive_enqueue_ret( TPAX_SYSTEM_ERROR(dctx), uctx); @@ -273,7 +273,7 @@ static int tpax_archive_append_dir_entries( nbytes = tpax_getdents(fd,dirents,TPAX_DIRENT_BUFLEN); if (nbytes < 0) - return tpax_archive_append_ret( + return tpax_archive_enqueue_ret( TPAX_SYSTEM_ERROR(dctx), uctx); @@ -288,7 +288,7 @@ static int tpax_archive_append_dir_entries( } else { if (dirent->d_type == DT_UNKNOWN) { if (fstatat(fd,dirent->d_name,&st,AT_SYMLINK_NOFOLLOW)) - return tpax_archive_append_ret( + return tpax_archive_enqueue_ret( TPAX_SYSTEM_ERROR(dctx), uctx); @@ -297,12 +297,12 @@ static int tpax_archive_append_dir_entries( } } - if (tpax_archive_append_queue_item( + if (tpax_archive_add_queue_item( dctx,dirent, dent,0,depth, TPAX_ITEM_IMPLICIT, fd,&fkeep) < 0) - return tpax_archive_append_ret( + return tpax_archive_enqueue_ret( TPAX_NESTED_ERROR(dctx), uctx); } @@ -319,7 +319,7 @@ static int tpax_archive_append_dir_entries( nbytes = tpax_getdents(fd,dirents,TPAX_DIRENT_BUFLEN); if (nbytes < 0) - tpax_archive_append_ret( + tpax_archive_enqueue_ret( TPAX_SYSTEM_ERROR(dctx), uctx); @@ -328,7 +328,7 @@ static int tpax_archive_append_dir_entries( } /* all done */ - return tpax_archive_append_ret( + return tpax_archive_enqueue_ret( fkeep ? 0 : close(fd), uctx); } @@ -395,7 +395,7 @@ static int tpax_dirent_init_from_uctx( return 0; } -int tpax_archive_append( +int tpax_archive_enqueue( const struct tpax_driver_ctx * dctx, const struct tpax_unit_ctx * uctx) { @@ -418,9 +418,9 @@ int tpax_archive_append( /* split path to prefix + basename */ if ((mark = tpax_path_prefix_mark(*uctx->path))) - if (!(prefix = tpax_append_prefix_item_from_path( + if (!(prefix = tpax_add_prefix_item_from_path( dctx,*uctx->path,mark))) - return tpax_archive_append_ret( + return tpax_archive_enqueue_ret( TPAX_BUFFER_ERROR(dctx), 0); @@ -428,24 +428,24 @@ int tpax_archive_append( if (prefix) if ((fdat = openat(fdat,prefix,O_RDONLY|O_DIRECTORY|O_CLOEXEC,0)) < 0) - return tpax_archive_append_ret( + return tpax_archive_enqueue_ret( TPAX_SYSTEM_ERROR(dctx), 0); /* explicit item directory entry */ if (tpax_dirent_init_from_uctx(uctx->st,name,dirent) < 0) - return tpax_archive_append_ret( + return tpax_archive_enqueue_ret( TPAX_CUSTOM_ERROR( dctx, TPAX_ERR_FLOW_ERROR), 0); /* add to queue */ - if (tpax_archive_append_queue_item( + if (tpax_archive_add_queue_item( dctx,dirent,0,prefix,0, TPAX_ITEM_EXPLICIT, fdat,&fkeep) < 0) - return tpax_archive_append_ret( + return tpax_archive_enqueue_ret( TPAX_NESTED_ERROR(dctx), 0); @@ -456,7 +456,7 @@ int tpax_archive_append( for (; cdent; ) { if (cdent->dirent.d_type == DT_DIR) if (dctx->cctx->drvflags & TPAX_DRIVER_DIR_MEMBER_RECURSE) - if (tpax_archive_append_dir_entries(dctx,cdent) < 0) + if (tpax_archive_enqueue_dir_entries(dctx,cdent) < 0) return TPAX_NESTED_ERROR(dctx); addr = (uintptr_t)cdent; |