aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorTim Shimmin <tes@sgi.com>2001-12-13 09:23:07 +0000
committerTim Shimmin <tes@sgi.com>2001-12-13 09:23:07 +0000
commit3cca2b3ebe790176e70a60d49ce08c3f6d8524df (patch)
tree89201896be29b7bbebabea9bbb55f463d27a6237 /common
parent133a8a27644ec6dee79380f3c8b59a799adbf4e5 (diff)
downloadxfsdump-dev-3cca2b3ebe790176e70a60d49ce08c3f6d8524df.tar.gz
bump version for xfsrestore perf changes
Diffstat (limited to 'common')
-rw-r--r--common/drive.c4
-rw-r--r--common/drive_minrmt.c12
-rw-r--r--common/drive_scsitape.c12
-rw-r--r--common/drive_simple.c12
-rw-r--r--common/main.c1
-rw-r--r--common/mlog.c30
-rw-r--r--common/mlog.h4
-rw-r--r--common/openutil.c49
8 files changed, 77 insertions, 47 deletions
diff --git a/common/drive.c b/common/drive.c
index 44799e65..5ea3515b 100644
--- a/common/drive.c
+++ b/common/drive.c
@@ -264,8 +264,8 @@ drive_init1( int argc, char *argv[ ], bool_t singlethreaded )
drivep->d_strategyp = bestsp;
drivep->d_recmarksep = bestsp->ds_recmarksep;
drivep->d_recmfilesz = bestsp->ds_recmfilesz;
- mlog( MLOG_DEBUG,
- "instantiating %s\n",
+ mlog( MLOG_NORMAL,
+ "using %s strategy\n",
bestsp->ds_description );
ok = ( * bestsp->ds_instantiate )( argc,
argv,
diff --git a/common/drive_minrmt.c b/common/drive_minrmt.c
index a097ef5c..8806a78b 100644
--- a/common/drive_minrmt.c
+++ b/common/drive_minrmt.c
@@ -391,12 +391,12 @@ static int dbgrmtwrite( int, void *, uint);
/* rmt drive strategy. referenced by drive.c
*/
drive_strategy_t drive_strategy_rmt = {
- DRIVE_STRATEGY_RMT, /* ds_id */
- "drive_minrmt", /* ds_description */
- ds_match, /* ds_match */
- ds_instantiate, /* ds_instantiate */
- 0x1000000ll, /* ds_recmarksep 16 MB */
- 0x10000000ll, /* ds_recmfilesz 256 MB */
+ DRIVE_STRATEGY_RMT, /* ds_id */
+ "minimum scsi tape (drive_minrmt)", /* ds_description */
+ ds_match, /* ds_match */
+ ds_instantiate, /* ds_instantiate */
+ 0x1000000ll, /* ds_recmarksep 16 MB */
+ 0x10000000ll, /* ds_recmfilesz 256 MB */
};
diff --git a/common/drive_scsitape.c b/common/drive_scsitape.c
index 103449b0..db1267c1 100644
--- a/common/drive_scsitape.c
+++ b/common/drive_scsitape.c
@@ -438,12 +438,12 @@ static int dbgrmtwrite( int, void *, uint);
/* scsitape drive strategy. referenced by drive.c
*/
drive_strategy_t drive_strategy_scsitape = {
- DRIVE_STRATEGY_SCSITAPE,/* ds_id */
- "drive_scsitape", /* ds_description */
- ds_match, /* ds_match */
- ds_instantiate, /* ds_instantiate */
- 0x1000000ll, /* ds_recmarksep 16 MB */
- 0x10000000ll, /* ds_recmfilesz 256 MB */
+ DRIVE_STRATEGY_SCSITAPE, /* ds_id */
+ "scsi tape (drive_scsitape)", /* ds_description */
+ ds_match, /* ds_match */
+ ds_instantiate, /* ds_instantiate */
+ 0x1000000ll, /* ds_recmarksep 16 MB */
+ 0x10000000ll, /* ds_recmfilesz 256 MB */
};
diff --git a/common/drive_simple.c b/common/drive_simple.c
index 2b0d16c4..3d8e1745 100644
--- a/common/drive_simple.c
+++ b/common/drive_simple.c
@@ -146,12 +146,12 @@ static void do_quit( drive_t * );
/* simple drive strategy for file or stdin. referenced by drive.c
*/
drive_strategy_t drive_strategy_simple = {
- DRIVE_STRATEGY_SIMPLE, /* ds_id */
- "drive_simple", /* ds_description */
- ds_match, /* ds_match */
- ds_instantiate, /* ds_instantiate */
- 0x1000000ll, /* ds_recmarksep */
- OFF64MAX /* ds_recmfilesz */
+ DRIVE_STRATEGY_SIMPLE, /* ds_id */
+ "file dump (drive_simple)", /* ds_description */
+ ds_match, /* ds_match */
+ ds_instantiate, /* ds_instantiate */
+ 0x1000000ll, /* ds_recmarksep */
+ OFF64MAX /* ds_recmfilesz */
};
diff --git a/common/main.c b/common/main.c
index 3aa2b4b2..6264021b 100644
--- a/common/main.c
+++ b/common/main.c
@@ -1050,6 +1050,7 @@ usage( void )
ULO( "<subtree> ...", GETOPT_SUBTREE );
ULO( "(contents only)", GETOPT_TOC );
ULO( "<verbosity {silent, verbose, trace}>", GETOPT_VERBOSITY );
+ ULO( "(use small tree window)", GETOPT_SMALLWINDOW );
#ifdef EXTATTR
ULO( "(don't restore extended file attributes)",GETOPT_NOEXTATTR );
#endif /* EXTATTR */
diff --git a/common/mlog.c b/common/mlog.c
index adfe0935..2f46c17a 100644
--- a/common/mlog.c
+++ b/common/mlog.c
@@ -38,7 +38,6 @@
#include <stdarg.h>
#include <stdlib.h>
#include <unistd.h>
-#include <assert.h>
#include <time.h>
#include <getopt.h>
@@ -336,6 +335,31 @@ mlog_unlock( void )
qlock_unlock( mlog_qlockh );
}
+/*
+ * Override the -v option.
+ * Useful for debugging at particular points
+ * where doing it program-wide would produce
+ * too much output.
+ */
+void
+mlog_override_level( intgen_t levelarg )
+{
+ intgen_t level;
+ ix_t ss; /* SubSystem */
+
+ level = levelarg & MLOG_LEVELMASK;
+ ss = ( ix_t )( ( levelarg & MLOG_SS_MASK ) >> MLOG_SS_SHIFT );
+
+ if (ss == MLOG_SS_GEN) { /* do level for all subsys */
+ for (ss = 0 ; ss < MLOG_SS_CNT ; ss++ ) {
+ mlog_level_ss[ ss ] = level;
+ }
+ }
+ else { /* do a particular subsys */
+ mlog_level_ss[ ss ] = level;
+ }
+}
+
void
mlog( intgen_t levelarg, char *fmt, ... )
{
@@ -660,7 +684,7 @@ mlog_get_hint( void )
ok = stream_get_exit_status(getpid(), states, N(states),
NULL, NULL, NULL, NULL, &hint);
- assert(ok);
+ ASSERT(ok);
return hint;
}
@@ -720,7 +744,7 @@ mlog_exit_flush(void)
&exit_code,
&exit_return,
&exit_hint);
- assert(ok);
+ ASSERT(ok);
/* hint takes priority over return */
rv = (exit_hint != RV_NONE) ? exit_hint : exit_return;
diff --git a/common/mlog.h b/common/mlog.h
index b9bff11b..53324b9b 100644
--- a/common/mlog.h
+++ b/common/mlog.h
@@ -116,6 +116,10 @@ extern bool_t mlog_init2( void );
*/
extern void mlog_tell_streamcnt( size_t streamcnt );
+/* override the -v option
+ */
+void mlog_override_level( intgen_t levelarg );
+
/* vprintf-based message format
*/
extern void mlog( intgen_t level, char *fmt, ... );
diff --git a/common/openutil.c b/common/openutil.c
index 0b740727..7640bf96 100644
--- a/common/openutil.c
+++ b/common/openutil.c
@@ -45,6 +45,7 @@ open_pathalloc( char *dirname, char *basename, pid_t pid )
{
size_t dirlen;
size_t pidlen;
+ size_t namelen;
char *namebuf;
if ( strcmp( dirname, "/" )) {
@@ -54,30 +55,30 @@ open_pathalloc( char *dirname, char *basename, pid_t pid )
dirname = "";
}
- if ( pid ) {
- pidlen = 1 + 6;
- } else {
- pidlen = 0;
- }
- namebuf = ( char * )calloc( 1,
- dirlen
- +
- 1
- +
- strlen( basename )
- +
- pidlen
- +
- 1 );
- ASSERT( namebuf );
-
- if ( pid ) {
- ( void )sprintf( namebuf, "%s/%s.%d", dirname, basename, pid );
- } else {
- ( void )sprintf( namebuf, "%s/%s", dirname, basename );
- }
-
- return namebuf;
+ /*
+ * We could calculate the length of pid string
+ * = trunc(log10(pid))+1,
+ * but we are restricted to 32 bits for pid anyway.
+ * 32 bits => trunc(log10(2^32))+1 = 10
+ * And if it ever became 64 bits,
+ * 64 bits => trunc(log10(2^64))+1 = 20
+ */
+ if ( pid ) {
+ pidlen = 1 + 20;
+ } else {
+ pidlen = 0;
+ }
+ namelen = dirlen + 1 + strlen( basename ) + pidlen + 1;
+ namebuf = ( char * )calloc( 1, namelen );
+ ASSERT( namebuf );
+
+ if ( pid ) {
+ ( void )snprintf( namebuf, namelen, "%s/%s.%d", dirname, basename, pid );
+ } else {
+ ( void )snprintf( namebuf, namelen, "%s/%s", dirname, basename );
+ }
+
+ return namebuf;
}
intgen_t