diff options
Diffstat (limited to 'src/logic')
-rw-r--r-- | src/logic/tpax_archive_enqueue.c (renamed from src/logic/tpax_archive_append.c) | 48 |
1 files changed, 24 insertions, 24 deletions
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; |