diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2020-05-31 20:58:28 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2020-05-31 20:58:28 +0000 |
commit | bbee6e0814d5875b85b81f26fd4ca7a28b6f9570 (patch) | |
tree | 726fcf32b39ca8976d7aa51b67c7236509f1bde4 /subversion/svnfsfs | |
parent | 38cef28c88864beaadac7a7cffdec6da952c3eb2 (diff) |
Notes
Diffstat (limited to 'subversion/svnfsfs')
-rw-r--r-- | subversion/svnfsfs/dump-index-cmd.c | 7 | ||||
-rw-r--r-- | subversion/svnfsfs/load-index-cmd.c | 8 | ||||
-rw-r--r-- | subversion/svnfsfs/stats-cmd.c | 10 | ||||
-rw-r--r-- | subversion/svnfsfs/svnfsfs.c | 64 |
4 files changed, 55 insertions, 34 deletions
diff --git a/subversion/svnfsfs/dump-index-cmd.c b/subversion/svnfsfs/dump-index-cmd.c index 5598c985cdee..79724807da47 100644 --- a/subversion/svnfsfs/dump-index-cmd.c +++ b/subversion/svnfsfs/dump-index-cmd.c @@ -79,6 +79,7 @@ dump_index(const char *path, apr_pool_t *pool) { svn_fs_t *fs; + svn_fs_fs__ioctl_dump_index_input_t input = {0}; /* Check repository type and open it. */ SVN_ERR(open_fs(&fs, path, pool)); @@ -87,8 +88,10 @@ dump_index(const char *path, printf(" Start Length Type Revision Item Checksum\n"); /* Dump the whole index contents */ - SVN_ERR(svn_fs_fs__dump_index(fs, revision, dump_index_entry, NULL, - check_cancel, NULL, pool)); + input.revision = revision; + input.callback_func = dump_index_entry; + SVN_ERR(svn_fs_ioctl(fs, SVN_FS_FS__IOCTL_DUMP_INDEX, &input, NULL, + check_cancel, NULL, pool, pool)); return SVN_NO_ERROR; } diff --git a/subversion/svnfsfs/load-index-cmd.c b/subversion/svnfsfs/load-index-cmd.c index e3b5c0d718bf..88e2613924c4 100644 --- a/subversion/svnfsfs/load-index-cmd.c +++ b/subversion/svnfsfs/load-index-cmd.c @@ -135,6 +135,7 @@ load_index(const char *path, svn_revnum_t revision = SVN_INVALID_REVNUM; apr_array_header_t *entries = apr_array_make(pool, 16, sizeof(void*)); apr_pool_t *iterpool = svn_pool_create(pool); + svn_fs_fs__ioctl_load_index_input_t ioctl_input = {0}; /* Check repository type and open it. */ SVN_ERR(open_fs(&fs, path, pool)); @@ -147,7 +148,7 @@ load_index(const char *path, /* Get the next line from the input and stop if there is none. */ svn_pool_clear(iterpool); - svn_stream_readline(input, &line, "\n", &eol, iterpool); + SVN_ERR(svn_stream_readline(input, &line, "\n", &eol, iterpool)); if (eol) break; @@ -173,7 +174,10 @@ load_index(const char *path, } /* Rewrite the indexes. */ - SVN_ERR(svn_fs_fs__load_index(fs, revision, entries, iterpool)); + ioctl_input.revision = revision; + ioctl_input.entries = entries; + SVN_ERR(svn_fs_ioctl(fs, SVN_FS_FS__IOCTL_LOAD_INDEX, &ioctl_input, NULL, + NULL, NULL, pool, pool)); svn_pool_destroy(iterpool); return SVN_NO_ERROR; diff --git a/subversion/svnfsfs/stats-cmd.c b/subversion/svnfsfs/stats-cmd.c index 2cd294a52147..1a2f3d499aa2 100644 --- a/subversion/svnfsfs/stats-cmd.c +++ b/subversion/svnfsfs/stats-cmd.c @@ -500,15 +500,17 @@ svn_error_t * subcommand__stats(apr_getopt_t *os, void *baton, apr_pool_t *pool) { svnfsfs__opt_state *opt_state = baton; - svn_fs_fs__stats_t *stats; svn_fs_t *fs; + svn_fs_fs__ioctl_get_stats_input_t input = {0}; + svn_fs_fs__ioctl_get_stats_output_t *output; printf("Reading revisions\n"); SVN_ERR(open_fs(&fs, opt_state->repository_path, pool)); - SVN_ERR(svn_fs_fs__get_stats(&stats, fs, print_progress, NULL, - check_cancel, NULL, pool, pool)); - print_stats(stats, pool); + input.progress_func = print_progress; + SVN_ERR(svn_fs_ioctl(fs, SVN_FS_FS__IOCTL_GET_STATS, &input, (void **)&output, + check_cancel, NULL, pool, pool)); + print_stats(output->stats, pool); return SVN_NO_ERROR; } diff --git a/subversion/svnfsfs/svnfsfs.c b/subversion/svnfsfs/svnfsfs.c index ed3e66470d92..6fcb792cc586 100644 --- a/subversion/svnfsfs/svnfsfs.c +++ b/subversion/svnfsfs/svnfsfs.c @@ -111,22 +111,27 @@ static const apr_getopt_option_t options_table[] = /* Array of available subcommands. * The entire list must be terminated with an entry of nulls. */ -static const svn_opt_subcommand_desc2_t cmd_table[] = +static const svn_opt_subcommand_desc3_t cmd_table[] = { - {"help", subcommand__help, {"?", "h"}, N_ - ("usage: svnfsfs help [SUBCOMMAND...]\n\n" - "Describe the usage of this program or its subcommands.\n"), + {"help", subcommand__help, {"?", "h"}, {N_( + "usage: svnfsfs help [SUBCOMMAND...]\n" + "\n"), N_( + "Describe the usage of this program or its subcommands.\n" + )}, {0} }, - {"dump-index", subcommand__dump_index, {0}, N_ - ("usage: svnfsfs dump-index REPOS_PATH -r REV\n\n" + {"dump-index", subcommand__dump_index, {0}, {N_( + "usage: svnfsfs dump-index REPOS_PATH -r REV\n" + "\n"), N_( "Dump the index contents for the revision / pack file containing revision REV\n" "to console. This is only available for FSFS format 7 (SVN 1.9+) repositories.\n" "The table produced contains a header in the first line followed by one line\n" - "per index entry, ordered by location in the revision / pack file. Columns:\n\n" + "per index entry, ordered by location in the revision / pack file. Columns:\n" + "\n"), N_( " * Byte offset (hex) at which the item starts\n" " * Length (hex) of the item in bytes\n" - " * Item type (string) is one of the following:\n\n" + " * Item type (string) is one of the following:\n" + "\n"), N_( " none ... Unused section. File contents shall be NULs.\n" " frep ... File representation.\n" " drep ... Directory representation.\n" @@ -135,29 +140,36 @@ static const svn_opt_subcommand_desc2_t cmd_table[] = " node ... Node revision.\n" " chgs ... Changed paths list.\n" " rep .... Representation of unknown type. Should not be used.\n" - " ??? .... Invalid. Index data is corrupt.\n\n" + " ??? .... Invalid. Index data is corrupt.\n" + "\n"), N_( " The distinction between frep, drep, fprop and dprop is a mere internal\n" " classification used for various optimizations and does not affect the\n" - " operational correctness.\n\n" + " operational correctness.\n" + "\n"), N_( " * Revision that the item belongs to (decimal)\n" " * Item number (decimal) within that revision\n" - " * Modified FNV1a checksum (8 hex digits)\n"), + " * Modified FNV1a checksum (8 hex digits)\n" + )}, {'r', 'M'} }, - {"load-index", subcommand__load_index, {0}, N_ - ("usage: svnfsfs load-index REPOS_PATH\n\n" + {"load-index", subcommand__load_index, {0}, {N_( + "usage: svnfsfs load-index REPOS_PATH\n" + "\n"), N_( "Read index contents from console. The format is the same as produced by the\n" "dump-index command, except that checksum as well as header are optional and will\n" "be ignored. The data must cover the full revision / pack file; the revision\n" - "number is automatically extracted from input stream. No ordering is required.\n"), + "number is automatically extracted from input stream. No ordering is required.\n" + )}, {'M'} }, - {"stats", subcommand__stats, {0}, N_ - ("usage: svnfsfs stats REPOS_PATH\n\n" - "Write object size statistics to console.\n"), + {"stats", subcommand__stats, {0}, {N_( + "usage: svnfsfs stats REPOS_PATH\n" + "\n"), N_( + "Write object size statistics to console.\n" + )}, {'M'} }, - { NULL, NULL, {0}, NULL, {0} } + { NULL, NULL, {0}, {NULL}, {0} } }; @@ -196,7 +208,7 @@ subcommand__help(apr_getopt_t *os, void *baton, apr_pool_t *pool) "\n" "Available subcommands:\n"); - SVN_ERR(svn_opt_print_help4(os, "svnfsfs", + SVN_ERR(svn_opt_print_help5(os, "svnfsfs", opt_state ? opt_state->version : FALSE, opt_state ? opt_state->quiet : FALSE, /*###opt_state ? opt_state->verbose :*/ FALSE, @@ -221,7 +233,7 @@ sub_main(int *exit_code, int argc, const char *argv[], apr_pool_t *pool) svn_error_t *err; apr_status_t apr_err; - const svn_opt_subcommand_desc2_t *subcommand = NULL; + const svn_opt_subcommand_desc3_t *subcommand = NULL; svnfsfs__opt_state opt_state = { 0 }; apr_getopt_t *os; int opt_id; @@ -325,7 +337,7 @@ sub_main(int *exit_code, int argc, const char *argv[], apr_pool_t *pool) just typos/mistakes. Whatever the case, the subcommand to actually run is subcommand_help(). */ if (opt_state.help) - subcommand = svn_opt_get_canonical_subcommand2(cmd_table, "help"); + subcommand = svn_opt_get_canonical_subcommand3(cmd_table, "help"); /* If we're not running the `help' subcommand, then look for a subcommand in the first argument. */ @@ -336,8 +348,8 @@ sub_main(int *exit_code, int argc, const char *argv[], apr_pool_t *pool) if (opt_state.version) { /* Use the "help" subcommand to handle the "--version" option. */ - static const svn_opt_subcommand_desc2_t pseudo_cmd = - { "--version", subcommand__help, {0}, "", + static const svn_opt_subcommand_desc3_t pseudo_cmd = + { "--version", subcommand__help, {0}, {""}, {svnfsfs__version, /* must accept its own option */ 'q', /* --quiet */ } }; @@ -359,7 +371,7 @@ sub_main(int *exit_code, int argc, const char *argv[], apr_pool_t *pool) SVN_ERR(svn_utf_cstring_to_utf8(&first_arg, os->argv[os->ind++], pool)); - subcommand = svn_opt_get_canonical_subcommand2(cmd_table, first_arg); + subcommand = svn_opt_get_canonical_subcommand3(cmd_table, first_arg); if (subcommand == NULL) { svn_error_clear( @@ -409,11 +421,11 @@ sub_main(int *exit_code, int argc, const char *argv[], apr_pool_t *pool) if (opt_id == 'h' || opt_id == '?') continue; - if (! svn_opt_subcommand_takes_option3(subcommand, opt_id, NULL)) + if (! svn_opt_subcommand_takes_option4(subcommand, opt_id, NULL)) { const char *optstr; const apr_getopt_option_t *badopt = - svn_opt_get_option_from_code2(opt_id, options_table, subcommand, + svn_opt_get_option_from_code3(opt_id, options_table, subcommand, pool); svn_opt_format_option(&optstr, badopt, FALSE, pool); if (subcommand->name[0] == '-') |