summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/driver/tpax_driver_ctx.c6
-rw-r--r--src/internal/tpax_driver_impl.h1
-rw-r--r--src/logic/tpax_archive_write.c49
-rw-r--r--src/skin/tpax_skin_default.c5
4 files changed, 40 insertions, 21 deletions
diff --git a/src/driver/tpax_driver_ctx.c b/src/driver/tpax_driver_ctx.c
index e9425f6..d2fec77 100644
--- a/src/driver/tpax_driver_ctx.c
+++ b/src/driver/tpax_driver_ctx.c
@@ -88,7 +88,7 @@ static int tpax_driver_usage(
"Synopsis:\n"
" %s [-d] [-f archive]\n"
" %s -r [-d] [-f archive]\n"
- " %s -w [−x format] [-b blocksize] [-dt] [-H|-L] [-f archive]\n"
+ " %s -w [−x format] [-b blocksize] [-dtv] [-H|-L] [-f archive]\n"
" %s -r -w [-d]\n\n"
"Options:\n",
program,program,program,program,program);
@@ -457,6 +457,10 @@ int tpax_lib_get_driver_ctx(
cctx.drvflags |= TPAX_DRIVER_VERSION;
break;
+ case TAG_VERBOSE:
+ cctx.drvflags |= TPAX_DRIVER_VERBOSE;
+ break;
+
case TAG_LIST:
cctx.drvflags |= TPAX_DRIVER_EXEC_MODE_LIST;
break;
diff --git a/src/internal/tpax_driver_impl.h b/src/internal/tpax_driver_impl.h
index aa65eed..7054dce 100644
--- a/src/internal/tpax_driver_impl.h
+++ b/src/internal/tpax_driver_impl.h
@@ -36,6 +36,7 @@ extern const struct argv_option tpax_default_options[];
enum app_tags {
TAG_HELP,
TAG_VERSION,
+ TAG_VERBOSE,
TAG_LIST,
TAG_READ,
TAG_WRITE,
diff --git a/src/logic/tpax_archive_write.c b/src/logic/tpax_archive_write.c
index 98d7dfc..7ce6cca 100644
--- a/src/logic/tpax_archive_write.c
+++ b/src/logic/tpax_archive_write.c
@@ -64,9 +64,13 @@ static int tpax_archive_append_pad(
}
static int tpax_archive_write_ret(
- int ret,
- struct tpax_unit_ctx * uctx)
+ int ret,
+ const struct tpax_driver_ctx * dctx,
+ struct tpax_unit_ctx * uctx)
{
+ if (dctx->cctx->drvflags & TPAX_DRIVER_VERBOSE)
+ tpax_dprintf(tpax_driver_fderr(dctx),"\n",0);
+
tpax_lib_free_unit_ctx(uctx);
return ret;
}
@@ -106,9 +110,15 @@ static int tpax_archive_write_impl(
dctx,
TPAX_ERR_FLOW_ERROR);
+ /* verbose mode */
+ if (dctx->cctx->drvflags & TPAX_DRIVER_VERBOSE)
+ tpax_dprintf(tpax_driver_fderr(dctx),"%s",path);
+
/* uctx */
if (tpax_lib_get_unit_ctx(dctx,fdcwd,path,&uctx) < 0)
- return TPAX_NESTED_ERROR(dctx);
+ tpax_archive_write_ret(
+ TPAX_NESTED_ERROR(dctx),
+ dctx,0);
st = uctx->st;
slnk = uctx->link[0];
@@ -126,7 +136,7 @@ static int tpax_archive_write_impl(
TPAX_CUSTOM_ERROR(
dctx,
TPAX_ERR_FLOW_ERROR),
- uctx);
+ dctx,uctx);
strcpy(pathbuf,path);
@@ -138,7 +148,7 @@ static int tpax_archive_write_impl(
TPAX_CUSTOM_ERROR(
dctx,
TPAX_ERR_FLOW_ERROR),
- uctx);
+ dctx,uctx);
if (ch) {
strcpy(ch,mlnk);
@@ -148,7 +158,7 @@ static int tpax_archive_write_impl(
if (fstatat(fdcwd,mlnk,&stbuf,0) < 0)
return tpax_archive_write_ret(
TPAX_SYSTEM_ERROR(dctx),
- uctx);
+ dctx,uctx);
}
/* record errors */
@@ -165,7 +175,7 @@ static int tpax_archive_write_impl(
slnk,&uhdr) < 0)
return tpax_archive_write_ret(
TPAX_NESTED_ERROR(dctx),
- uctx);
+ dctx,uctx);
/* buffer */
membuf = 0;
@@ -187,7 +197,7 @@ static int tpax_archive_write_impl(
st,membuf) < 0)
return tpax_archive_write_ret(
TPAX_NESTED_ERROR(dctx),
- uctx);
+ dctx,uctx);
} else {
if ((fdtmp = tpax_io_create_tmpfs_snapshot(
dctx,fdcwd,
@@ -195,12 +205,12 @@ static int tpax_archive_write_impl(
st)) < 0)
return tpax_archive_write_ret(
TPAX_NESTED_ERROR(dctx),
- uctx);
+ dctx,uctx);
if (lseek(fdtmp,0,SEEK_SET) < 0)
return tpax_archive_write_ret(
TPAX_SYSTEM_ERROR(dctx),
- uctx);
+ dctx,uctx);
}
}
@@ -211,16 +221,15 @@ static int tpax_archive_write_impl(
return tpax_archive_write_ret(
TPAX_SYSTEM_ERROR(dctx),
- uctx);
+ dctx,uctx);
}
tpax_set_driver_cpos(dctx,dpos);
/* all done? */
- if (!(S_ISREG(st->st_mode))) {
- tpax_lib_free_unit_ctx(uctx);
- return 0;
- }
+ if (!(S_ISREG(st->st_mode)))
+ return tpax_archive_write_ret(
+ 0,dctx,uctx);
/* append data from snapshot */
if (fdtmp >= 0) {
@@ -237,13 +246,13 @@ static int tpax_archive_write_impl(
close(fdtmp);
return tpax_archive_write_ret(
TPAX_SYSTEM_ERROR(dctx),
- uctx);
+ dctx,uctx);
} else if (nbytes == 0) {
close(fdtmp);
return tpax_archive_write_ret(
TPAX_CUSTOM_ERROR(dctx,TPAX_ERR_FLOW_ERROR),
- uctx);
+ dctx,uctx);
} else {
nread += nbytes;
@@ -253,7 +262,7 @@ static int tpax_archive_write_impl(
close(fdtmp);
return tpax_archive_write_ret(
TPAX_SYSTEM_ERROR(dctx),
- uctx);
+ dctx,uctx);
}
}
@@ -264,12 +273,12 @@ static int tpax_archive_write_impl(
st->st_size) < 0)
return tpax_archive_write_ret(
TPAX_SYSTEM_ERROR(dctx),
- uctx);
+ dctx,uctx);
}
return tpax_archive_write_ret(
tpax_archive_append_pad(dctx,fdout,st),
- uctx);
+ dctx,uctx);
}
int tpax_archive_write(const struct tpax_driver_ctx * dctx)
diff --git a/src/skin/tpax_skin_default.c b/src/skin/tpax_skin_default.c
index bfb4551..ffbc2d2 100644
--- a/src/skin/tpax_skin_default.c
+++ b/src/skin/tpax_skin_default.c
@@ -40,6 +40,11 @@ const tpax_hidden struct argv_option tpax_default_options[] = {
"pax|cpio|ustar|rustar",0,
"archive format [%s]"},
+ {"Wverbose", 'v',TAG_VERBOSE,ARGV_OPTARG_NONE,
+ ARGV_OPTION_HYBRID_ONLY,0,0,
+ "write pathnames to stderr in read, write, and copy modes; "
+ "produce verbose output in list mode."},
+
{"Wblksize", 'b',TAG_BLKSIZE,ARGV_OPTARG_REQUIRED,
ARGV_OPTION_HYBRID_ONLY|ARGV_OPTION_HYBRID_EQUAL,0,0,
"(non-default) block-size; valid values are "