diff options
Diffstat (limited to 'subversion/svnfsfs')
-rw-r--r-- | subversion/svnfsfs/load-index-cmd.c | 2 | ||||
-rw-r--r-- | subversion/svnfsfs/stats-cmd.c | 13 | ||||
-rw-r--r-- | subversion/svnfsfs/svnfsfs.c | 77 | ||||
-rw-r--r-- | subversion/svnfsfs/svnfsfs.h | 3 |
4 files changed, 27 insertions, 68 deletions
diff --git a/subversion/svnfsfs/load-index-cmd.c b/subversion/svnfsfs/load-index-cmd.c index 4df86bd0946b1..e3b5c0d718bfc 100644 --- a/subversion/svnfsfs/load-index-cmd.c +++ b/subversion/svnfsfs/load-index-cmd.c @@ -186,7 +186,7 @@ subcommand__load_index(apr_getopt_t *os, void *baton, apr_pool_t *pool) svnfsfs__opt_state *opt_state = baton; svn_stream_t *input; - SVN_ERR(svn_stream_for_stdin(&input, pool)); + SVN_ERR(svn_stream_for_stdin2(&input, TRUE, pool)); SVN_ERR(load_index(opt_state->repository_path, input, pool)); return SVN_NO_ERROR; diff --git a/subversion/svnfsfs/stats-cmd.c b/subversion/svnfsfs/stats-cmd.c index 6e820cb61d4b7..2cd294a52147f 100644 --- a/subversion/svnfsfs/stats-cmd.c +++ b/subversion/svnfsfs/stats-cmd.c @@ -74,7 +74,8 @@ print_rep_stats(svn_fs_fs__representation_stats_t *stats, "%20s bytes expanded size\n" "%20s bytes expanded shared size\n" "%20s bytes with rep-sharing off\n" - "%20s shared references\n"), + "%20s shared references\n" + "%20.3f average delta chain length\n"), svn__ui64toa_sep(stats->total.packed_size, ',', pool), svn__ui64toa_sep(stats->total.count, ',', pool), svn__ui64toa_sep(stats->shared.packed_size, ',', pool), @@ -82,7 +83,8 @@ print_rep_stats(svn_fs_fs__representation_stats_t *stats, svn__ui64toa_sep(stats->total.expanded_size, ',', pool), svn__ui64toa_sep(stats->shared.expanded_size, ',', pool), svn__ui64toa_sep(stats->expanded_size, ',', pool), - svn__ui64toa_sep(stats->references - stats->total.count, ',', pool)); + svn__ui64toa_sep(stats->references - stats->total.count, ',', pool), + stats->chain_len / MAX(1.0, (double)stats->total.count)); } /* Print the (used) contents of CHANGES. Use POOL for allocations. @@ -375,7 +377,7 @@ print_stats(svn_fs_fs__stats_t *stats, apr_pool_t *pool) { /* print results */ - printf("\nGlobal statistics:\n"); + printf("\n\nGlobal statistics:\n"); printf(_("%20s bytes in %12s revisions\n" "%20s bytes in %12s changes\n" "%20s bytes in %12s node revision records\n" @@ -413,6 +415,7 @@ print_stats(svn_fs_fs__stats_t *stats, "%20s bytes in %12s representations of added file nodes\n" "%20s bytes in %12s directory property representations\n" "%20s bytes in %12s file property representations\n" + " with %12.3f average delta chain length\n" "%20s bytes in header & footer overhead\n"), svn__ui64toa_sep(stats->total_rep_stats.total.packed_size, ',', pool), @@ -433,8 +436,10 @@ print_stats(svn_fs_fs__stats_t *stats, svn__ui64toa_sep(stats->file_prop_rep_stats.total.packed_size, ',', pool), svn__ui64toa_sep(stats->file_prop_rep_stats.total.count, ',', pool), + stats->total_rep_stats.chain_len + / (double)stats->total_rep_stats.total.count, svn__ui64toa_sep(stats->total_rep_stats.total.overhead_size, ',', - pool)); + pool)); printf("\nDirectory representation statistics:\n"); print_rep_stats(&stats->dir_rep_stats, pool); diff --git a/subversion/svnfsfs/svnfsfs.c b/subversion/svnfsfs/svnfsfs.c index f8b1e4b19992c..ed3e66470d920 100644 --- a/subversion/svnfsfs/svnfsfs.c +++ b/subversion/svnfsfs/svnfsfs.c @@ -21,8 +21,6 @@ * ==================================================================== */ -#include <apr_signal.h> - #include "svn_pools.h" #include "svn_cmdline.h" #include "svn_opt.h" @@ -42,45 +40,7 @@ /*** Code. ***/ -/* A flag to see if we've been cancelled by the client or not. */ -static volatile sig_atomic_t cancelled = FALSE; - -/* A signal handler to support cancellation. */ -static void -signal_handler(int signum) -{ - apr_signal(signum, SIG_IGN); - cancelled = TRUE; -} - - -/* A helper to set up the cancellation signal handlers. */ -static void -setup_cancellation_signals(void (*handler)(int signum)) -{ - apr_signal(SIGINT, handler); -#ifdef SIGBREAK - /* SIGBREAK is a Win32 specific signal generated by ctrl-break. */ - apr_signal(SIGBREAK, handler); -#endif -#ifdef SIGHUP - apr_signal(SIGHUP, handler); -#endif -#ifdef SIGTERM - apr_signal(SIGTERM, handler); -#endif -} - - -svn_error_t * -check_cancel(void *baton) -{ - if (cancelled) - return svn_error_create(SVN_ERR_CANCELLED, NULL, _("Caught signal")); - else - return SVN_NO_ERROR; -} - +svn_cancel_func_t check_cancel = NULL; /* Custom filesystem warning function. */ static void @@ -341,8 +301,12 @@ sub_main(int *exit_code, int argc, const char *argv[], apr_pool_t *pool) opt_state.help = TRUE; break; case 'M': - opt_state.memory_cache_size - = 0x100000 * apr_strtoi64(opt_arg, NULL, 0); + { + apr_uint64_t sz_val; + SVN_ERR(svn_cstring_atoui64(&sz_val, opt_arg)); + + opt_state.memory_cache_size = 0x100000 * sz_val; + } break; case svnfsfs__version: opt_state.version = TRUE; @@ -391,17 +355,17 @@ sub_main(int *exit_code, int argc, const char *argv[], apr_pool_t *pool) } else { - const char *first_arg = os->argv[os->ind++]; + const char *first_arg; + + SVN_ERR(svn_utf_cstring_to_utf8(&first_arg, os->argv[os->ind++], + pool)); subcommand = svn_opt_get_canonical_subcommand2(cmd_table, first_arg); if (subcommand == NULL) { - const char *first_arg_utf8; - SVN_ERR(svn_utf_cstring_to_utf8(&first_arg_utf8, - first_arg, pool)); svn_error_clear( svn_cmdline_fprintf(stderr, pool, _("Unknown subcommand: '%s'\n"), - first_arg_utf8)); + first_arg)); SVN_ERR(subcommand__help(NULL, NULL, pool)); *exit_code = EXIT_FAILURE; return SVN_NO_ERROR; @@ -465,19 +429,7 @@ sub_main(int *exit_code, int argc, const char *argv[], apr_pool_t *pool) } /* Set up our cancellation support. */ - setup_cancellation_signals(signal_handler); - -#ifdef SIGPIPE - /* Disable SIGPIPE generation for the platforms that have it. */ - apr_signal(SIGPIPE, SIG_IGN); -#endif - -#ifdef SIGXFSZ - /* Disable SIGXFSZ generation for the platforms that have it, otherwise - * working with large files when compiled against an APR that doesn't have - * large file support will crash the program, which is uncool. */ - apr_signal(SIGXFSZ, SIG_IGN); -#endif + check_cancel = svn_cmdline__setup_cancellation_handler(); /* Configure FSFS caches for maximum efficiency with svnfsfs. * Also, apply the respective command line parameters, if given. */ @@ -537,5 +489,8 @@ main(int argc, const char *argv[]) } svn_pool_destroy(pool); + + svn_cmdline__cancellation_exit(); + return exit_code; } diff --git a/subversion/svnfsfs/svnfsfs.h b/subversion/svnfsfs/svnfsfs.h index 132b2bc038b7f..80c53234904da 100644 --- a/subversion/svnfsfs/svnfsfs.h +++ b/subversion/svnfsfs/svnfsfs.h @@ -63,8 +63,7 @@ open_fs(svn_fs_t **fs, apr_pool_t *pool); /* Our cancellation callback. */ -svn_error_t * -check_cancel(void *baton); +extern svn_cancel_func_t check_cancel; #ifdef __cplusplus } |