Modified: subversion/branches/pin-externals/subversion/libsvn_fs_x/lock.h URL: http://svn.apache.org/viewvc/subversion/branches/pin-externals/subversion/libsvn_fs_x/lock.h?rev=1653578&r1=1653577&r2=1653578&view=diff ============================================================================== --- subversion/branches/pin-externals/subversion/libsvn_fs_x/lock.h (original) +++ subversion/branches/pin-externals/subversion/libsvn_fs_x/lock.h Wed Jan 21 16:22:19 2015 @@ -33,48 +33,53 @@ extern "C" { library's fs vtables. */ /* See svn_fs_lock(), svn_fs_lock_many(). */ -svn_error_t *svn_fs_x__lock(svn_fs_t *fs, - apr_hash_t *targets, - const char *comment, - svn_boolean_t is_dav_comment, - apr_time_t expiration_date, - svn_boolean_t steal_lock, - svn_fs_lock_callback_t lock_callback, - void *lock_baton, - apr_pool_t *result_pool, - apr_pool_t *scratch_pool); +svn_error_t * +svn_fs_x__lock(svn_fs_t *fs, + apr_hash_t *targets, + const char *comment, + svn_boolean_t is_dav_comment, + apr_time_t expiration_date, + svn_boolean_t steal_lock, + svn_fs_lock_callback_t lock_callback, + void *lock_baton, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool); /* See svn_fs_generate_lock_token(). */ -svn_error_t *svn_fs_x__generate_lock_token(const char **token, - svn_fs_t *fs, - apr_pool_t *pool); +svn_error_t * +svn_fs_x__generate_lock_token(const char **token, + svn_fs_t *fs, + apr_pool_t *pool); /* See svn_fs_unlock(), svn_fs_unlock_many(). */ -svn_error_t *svn_fs_x__unlock(svn_fs_t *fs, - apr_hash_t *targets, - svn_boolean_t break_lock, - svn_fs_lock_callback_t lock_callback, - void *lock_baton, - apr_pool_t *result_pool, - apr_pool_t *scratch_pool); +svn_error_t * +svn_fs_x__unlock(svn_fs_t *fs, + apr_hash_t *targets, + svn_boolean_t break_lock, + svn_fs_lock_callback_t lock_callback, + void *lock_baton, + apr_pool_t *result_pool, + apr_pool_t *scratch_pool); /* See svn_fs_get_lock(). */ -svn_error_t *svn_fs_x__get_lock(svn_lock_t **lock, - svn_fs_t *fs, - const char *path, - apr_pool_t *pool); +svn_error_t * +svn_fs_x__get_lock(svn_lock_t **lock, + svn_fs_t *fs, + const char *path, + apr_pool_t *pool); /* See svn_fs_get_locks2(). */ -svn_error_t *svn_fs_x__get_locks(svn_fs_t *fs, - const char *path, - svn_depth_t depth, - svn_fs_get_locks_callback_t get_locks_func, - void *get_locks_baton, - apr_pool_t *pool); +svn_error_t * +svn_fs_x__get_locks(svn_fs_t *fs, + const char *path, + svn_depth_t depth, + svn_fs_get_locks_callback_t get_locks_func, + void *get_locks_baton, + apr_pool_t *scratch_pool); /* Examine PATH for existing locks, and check whether they can be - used. Use POOL for temporary allocations. + used. Use SCRATCH_POOL for temporary allocations. If no locks are present, return SVN_NO_ERROR. @@ -97,11 +102,12 @@ svn_error_t *svn_fs_x__get_locks(svn_fs_ If the caller (directly or indirectly) has the FS write lock, HAVE_WRITE_LOCK should be true. */ -svn_error_t *svn_fs_x__allow_locked_operation(const char *path, - svn_fs_t *fs, - svn_boolean_t recurse, - svn_boolean_t have_write_lock, - apr_pool_t *pool); +svn_error_t * +svn_fs_x__allow_locked_operation(const char *path, + svn_fs_t *fs, + svn_boolean_t recurse, + svn_boolean_t have_write_lock, + apr_pool_t *scratch_pool); #ifdef __cplusplus }
Modified: subversion/branches/pin-externals/subversion/libsvn_fs_x/low_level.c URL: http://svn.apache.org/viewvc/subversion/branches/pin-externals/subversion/libsvn_fs_x/low_level.c?rev=1653578&r1=1653577&r2=1653578&view=diff ============================================================================== --- subversion/branches/pin-externals/subversion/libsvn_fs_x/low_level.c (original) +++ subversion/branches/pin-externals/subversion/libsvn_fs_x/low_level.c Wed Jan 21 16:22:19 2015 @@ -38,6 +38,8 @@ /* Headers used to describe node-revision in the revision file. */ #define HEADER_ID "id" +#define HEADER_NODE "node" +#define HEADER_COPY "copy" #define HEADER_TYPE "type" #define HEADER_COUNT "count" #define HEADER_PROPS "props" @@ -236,12 +238,12 @@ read_header_block(apr_hash_t **headers, } svn_error_t * -svn_fs_x__parse_representation(representation_t **rep_p, +svn_fs_x__parse_representation(svn_fs_x__representation_t **rep_p, svn_stringbuf_t *text, apr_pool_t *result_pool, apr_pool_t *scratch_pool) { - representation_t *rep; + svn_fs_x__representation_t *rep; char *str; apr_int64_t val; char *string = text->data; @@ -323,9 +325,9 @@ svn_fs_x__parse_representation(represent /* Wrap read_rep_offsets_body(), extracting its TXN_ID from our NODEREV_ID, and adding an error message. */ static svn_error_t * -read_rep_offsets(representation_t **rep_p, +read_rep_offsets(svn_fs_x__representation_t **rep_p, char *string, - const svn_fs_id_t *noderev_id, + const svn_fs_x__id_t *noderev_id, apr_pool_t *result_pool, apr_pool_t *scratch_pool) { @@ -344,7 +346,7 @@ read_rep_offsets(representation_t **rep_ where = apr_psprintf(scratch_pool, _("While reading representation offsets " "for node-revision '%s':"), - noderev_id ? id_unparsed->data : "(null)"); + id_unparsed->data); return svn_error_quick_wrap(err, where); } @@ -352,9 +354,11 @@ read_rep_offsets(representation_t **rep_ return SVN_NO_ERROR; } +/* If PATH needs to be escaped, return an escaped version of it, allocated + * from RESULT_POOL. Otherwise, return PATH directly. */ static const char * auto_escape_path(const char *path, - apr_pool_t *pool) + apr_pool_t *result_pool) { apr_size_t len = strlen(path); apr_size_t i; @@ -363,7 +367,8 @@ auto_escape_path(const char *path, for (i = 0; i < len; ++i) if (path[i] < ' ') { - svn_stringbuf_t *escaped = svn_stringbuf_create_ensure(2 * len, pool); + svn_stringbuf_t *escaped = svn_stringbuf_create_ensure(2 * len, + result_pool); for (i = 0; i < len; ++i) if (path[i] < ' ') { @@ -377,13 +382,15 @@ auto_escape_path(const char *path, return escaped->data; } - + return path; } +/* If PATH has been escaped, return the un-escaped version of it, allocated + * from RESULT_POOL. Otherwise, return PATH directly. */ static const char * auto_unescape_path(const char *path, - apr_pool_t *pool) + apr_pool_t *result_pool) { const char esc = '\x1b'; if (strchr(path, esc)) @@ -391,7 +398,8 @@ auto_unescape_path(const char *path, apr_size_t len = strlen(path); apr_size_t i; - svn_stringbuf_t *unescaped = svn_stringbuf_create_ensure(len, pool); + svn_stringbuf_t *unescaped = svn_stringbuf_create_ensure(len, + result_pool); for (i = 0; i < len; ++i) if (path[i] == esc) svn_stringbuf_appendbyte(unescaped, path[++i] + 1 - 'A'); @@ -404,32 +412,45 @@ auto_unescape_path(const char *path, return path; } +/* Find entry HEADER_NAME in HEADERS and parse its value into *ID. */ +static svn_error_t * +read_id_part(svn_fs_x__id_t *id, + apr_hash_t *headers, + const char *header_name) +{ + const char *value = svn_hash_gets(headers, header_name); + if (value == NULL) + return svn_error_createf(SVN_ERR_FS_CORRUPT, NULL, + _("Missing %s field in node-rev"), + header_name); + + SVN_ERR(svn_fs_x__id_parse(id, value)); + return SVN_NO_ERROR; +} + svn_error_t * -svn_fs_x__read_noderev(node_revision_t **noderev_p, +svn_fs_x__read_noderev(svn_fs_x__noderev_t **noderev_p, svn_stream_t *stream, apr_pool_t *result_pool, apr_pool_t *scratch_pool) { apr_hash_t *headers; - node_revision_t *noderev; + svn_fs_x__noderev_t *noderev; char *value; const char *noderev_id; SVN_ERR(read_header_block(&headers, stream, scratch_pool)); + SVN_ERR(svn_stream_close(stream)); noderev = apr_pcalloc(result_pool, sizeof(*noderev)); - /* Read the node-rev id. */ - value = svn_hash_gets(headers, HEADER_ID); - if (value == NULL) - /* ### More information: filename/offset coordinates */ - return svn_error_create(SVN_ERR_FS_CORRUPT, NULL, - _("Missing id field in node-rev")); - - SVN_ERR(svn_stream_close(stream)); + /* for error messages later */ + noderev_id = svn_hash_gets(headers, HEADER_ID); - SVN_ERR(svn_fs_x__id_parse(&noderev->id, value, result_pool)); - noderev_id = value; /* for error messages later */ + /* Read the node-rev id. */ + SVN_ERR(read_id_part(&noderev->noderev_id, headers, HEADER_ID)); + SVN_ERR(read_id_part(&noderev->node_id, headers, HEADER_NODE)); + SVN_ERR(read_id_part(&noderev->copy_id, headers, HEADER_COPY)); /* Read the type. */ value = svn_hash_gets(headers, HEADER_TYPE); @@ -458,7 +479,8 @@ svn_fs_x__read_noderev(node_revision_t * if (value) { SVN_ERR(read_rep_offsets(&noderev->prop_rep, value, - noderev->id, result_pool, scratch_pool)); + &noderev->noderev_id, result_pool, + scratch_pool)); } /* Get the data location. */ @@ -466,7 +488,8 @@ svn_fs_x__read_noderev(node_revision_t * if (value) { SVN_ERR(read_rep_offsets(&noderev->data_rep, value, - noderev->id, result_pool, scratch_pool)); + &noderev->noderev_id, result_pool, + scratch_pool)); } /* Get the created path. */ @@ -492,15 +515,17 @@ svn_fs_x__read_noderev(node_revision_t * /* Get the predecessor ID. */ value = svn_hash_gets(headers, HEADER_PRED); if (value) - SVN_ERR(svn_fs_x__id_parse(&noderev->predecessor_id, value, - result_pool)); + SVN_ERR(svn_fs_x__id_parse(&noderev->predecessor_id, value)); + else + svn_fs_x__id_reset(&noderev->predecessor_id); /* Get the copyroot. */ value = svn_hash_gets(headers, HEADER_COPYROOT); if (value == NULL) { noderev->copyroot_path = noderev->created_path; - noderev->copyroot_rev = svn_fs_x__id_rev(noderev->id); + noderev->copyroot_rev + = svn_fs_x__get_revnum(noderev->noderev_id.change_set); } else { @@ -576,7 +601,7 @@ format_digest(const unsigned char *diges } svn_stringbuf_t * -svn_fs_x__unparse_representation(representation_t *rep, +svn_fs_x__unparse_representation(svn_fs_x__representation_t *rep, svn_boolean_t mutable_rep_truncated, apr_pool_t *result_pool, apr_pool_t *scratch_pool) @@ -606,20 +631,28 @@ svn_fs_x__unparse_representation(represe svn_error_t * svn_fs_x__write_noderev(svn_stream_t *outfile, - node_revision_t *noderev, + svn_fs_x__noderev_t *noderev, apr_pool_t *scratch_pool) { + svn_string_t *str_id; + + str_id = svn_fs_x__id_unparse(&noderev->noderev_id, scratch_pool); SVN_ERR(svn_stream_printf(outfile, scratch_pool, HEADER_ID ": %s\n", - svn_fs_x__id_unparse(noderev->id, - scratch_pool)->data)); + str_id->data)); + str_id = svn_fs_x__id_unparse(&noderev->node_id, scratch_pool); + SVN_ERR(svn_stream_printf(outfile, scratch_pool, HEADER_NODE ": %s\n", + str_id->data)); + str_id = svn_fs_x__id_unparse(&noderev->copy_id, scratch_pool); + SVN_ERR(svn_stream_printf(outfile, scratch_pool, HEADER_COPY ": %s\n", + str_id->data)); SVN_ERR(svn_stream_printf(outfile, scratch_pool, HEADER_TYPE ": %s\n", (noderev->kind == svn_node_file) ? SVN_FS_X__KIND_FILE : SVN_FS_X__KIND_DIR)); - if (noderev->predecessor_id) + if (svn_fs_x__id_used(&noderev->predecessor_id)) SVN_ERR(svn_stream_printf(outfile, scratch_pool, HEADER_PRED ": %s\n", - svn_fs_x__id_unparse(noderev->predecessor_id, + svn_fs_x__id_unparse(&noderev->predecessor_id, scratch_pool)->data)); SVN_ERR(svn_stream_printf(outfile, scratch_pool, HEADER_COUNT ": %d\n", @@ -649,8 +682,9 @@ svn_fs_x__write_noderev(svn_stream_t *ou auto_escape_path(noderev->copyfrom_path, scratch_pool))); - if ((noderev->copyroot_rev != svn_fs_x__id_rev(noderev->id)) || - (strcmp(noderev->copyroot_path, noderev->created_path) != 0)) + if ( ( noderev->copyroot_rev + != svn_fs_x__get_revnum(noderev->noderev_id.change_set)) + || (strcmp(noderev->copyroot_path, noderev->created_path) != 0)) SVN_ERR(svn_stream_printf(outfile, scratch_pool, HEADER_COPYROOT ": %ld" " %s\n", noderev->copyroot_rev, @@ -749,16 +783,15 @@ svn_fs_x__write_rep_header(svn_fs_x__rep the resulting change in *CHANGE_P. If there is no next record, store NULL there. Perform all allocations from POOL. */ static svn_error_t * -read_change(change_t **change_p, +read_change(svn_fs_x__change_t **change_p, svn_stream_t *stream, apr_pool_t *result_pool, apr_pool_t *scratch_pool) { svn_stringbuf_t *line; svn_boolean_t eof = TRUE; - change_t *change; + svn_fs_x__change_t *change; char *str, *last_str, *kind_str; - svn_fs_path_change2_t *info; /* Default return value. */ *change_p = NULL; @@ -770,7 +803,6 @@ read_change(change_t **change_p, return SVN_NO_ERROR; change = apr_pcalloc(result_pool, sizeof(*change)); - info = &change->info; last_str = line->data; /* Get the node-id of the change. */ @@ -779,10 +811,7 @@ read_change(change_t **change_p, return svn_error_create(SVN_ERR_FS_CORRUPT, NULL, _("Invalid changes line in rev-file")); - SVN_ERR(svn_fs_x__id_parse(&info->node_rev_id, str, result_pool)); - if (info->node_rev_id == NULL) - return svn_error_create(SVN_ERR_FS_CORRUPT, NULL, - _("Invalid changes line in rev-file")); + SVN_ERR(svn_fs_x__id_parse(&change->noderev_id, str)); /* Get the change type. */ str = svn_cstring_tokenize(" ", &last_str); @@ -792,7 +821,7 @@ read_change(change_t **change_p, /* Don't bother to check the format number before looking for * node-kinds: just read them if you find them. */ - info->node_kind = svn_node_unknown; + change->node_kind = svn_node_unknown; kind_str = strchr(str, '-'); if (kind_str) { @@ -800,9 +829,9 @@ read_change(change_t **change_p, *kind_str = '\0'; kind_str++; if (strcmp(kind_str, SVN_FS_X__KIND_FILE) == 0) - info->node_kind = svn_node_file; + change->node_kind = svn_node_file; else if (strcmp(kind_str, SVN_FS_X__KIND_DIR) == 0) - info->node_kind = svn_node_dir; + change->node_kind = svn_node_dir; else return svn_error_create(SVN_ERR_FS_CORRUPT, NULL, _("Invalid changes line in rev-file")); @@ -810,23 +839,23 @@ read_change(change_t **change_p, if (strcmp(str, ACTION_MODIFY) == 0) { - info->change_kind = svn_fs_path_change_modify; + change->change_kind = svn_fs_path_change_modify; } else if (strcmp(str, ACTION_ADD) == 0) { - info->change_kind = svn_fs_path_change_add; + change->change_kind = svn_fs_path_change_add; } else if (strcmp(str, ACTION_DELETE) == 0) { - info->change_kind = svn_fs_path_change_delete; + change->change_kind = svn_fs_path_change_delete; } else if (strcmp(str, ACTION_REPLACE) == 0) { - info->change_kind = svn_fs_path_change_replace; + change->change_kind = svn_fs_path_change_replace; } else if (strcmp(str, ACTION_RESET) == 0) { - info->change_kind = svn_fs_path_change_reset; + change->change_kind = svn_fs_path_change_reset; } else { @@ -842,11 +871,11 @@ read_change(change_t **change_p, if (strcmp(str, FLAG_TRUE) == 0) { - info->text_mod = TRUE; + change->text_mod = TRUE; } else if (strcmp(str, FLAG_FALSE) == 0) { - info->text_mod = FALSE; + change->text_mod = FALSE; } else { @@ -862,11 +891,11 @@ read_change(change_t **change_p, if (strcmp(str, FLAG_TRUE) == 0) { - info->prop_mod = TRUE; + change->prop_mod = TRUE; } else if (strcmp(str, FLAG_FALSE) == 0) { - info->prop_mod = FALSE; + change->prop_mod = FALSE; } else { @@ -882,11 +911,11 @@ read_change(change_t **change_p, if (strcmp(str, FLAG_TRUE) == 0) { - info->mergeinfo_mod = svn_tristate_true; + change->mergeinfo_mod = svn_tristate_true; } else if (strcmp(str, FLAG_FALSE) == 0) { - info->mergeinfo_mod = svn_tristate_false; + change->mergeinfo_mod = svn_tristate_false; } else { @@ -907,22 +936,22 @@ read_change(change_t **change_p, /* Read the next line, the copyfrom line. */ SVN_ERR(svn_stream_readline(stream, &line, "\n", &eof, result_pool)); - info->copyfrom_known = TRUE; + change->copyfrom_known = TRUE; if (eof || line->len == 0) { - info->copyfrom_rev = SVN_INVALID_REVNUM; - info->copyfrom_path = NULL; + change->copyfrom_rev = SVN_INVALID_REVNUM; + change->copyfrom_path = NULL; } else { last_str = line->data; - SVN_ERR(parse_revnum(&info->copyfrom_rev, (const char **)&last_str)); + SVN_ERR(parse_revnum(&change->copyfrom_rev, (const char **)&last_str)); if (!svn_fspath__is_canonical(last_str)) return svn_error_create(SVN_ERR_FS_CORRUPT, NULL, _("Invalid copy-from path in changes line")); - info->copyfrom_path = auto_unescape_path(last_str, result_pool); + change->copyfrom_path = auto_unescape_path(last_str, result_pool); } *change_p = change; @@ -936,7 +965,7 @@ svn_fs_x__read_changes(apr_array_header_ apr_pool_t *result_pool, apr_pool_t *scratch_pool) { - change_t *change; + svn_fs_x__change_t *change; apr_pool_t *iterpool; /* Pre-allocate enough room for most change lists. @@ -947,13 +976,13 @@ svn_fs_x__read_changes(apr_array_header_ respective two-power by just a few bytes (leaves room array and APR node overhead for large enough M). */ - *changes = apr_array_make(result_pool, 63, sizeof(change_t *)); + *changes = apr_array_make(result_pool, 63, sizeof(svn_fs_x__change_t *)); SVN_ERR(read_change(&change, stream, result_pool, scratch_pool)); iterpool = svn_pool_create(scratch_pool); while (change) { - APR_ARRAY_PUSH(*changes, change_t*) = change; + APR_ARRAY_PUSH(*changes, svn_fs_x__change_t*) = change; SVN_ERR(read_change(&change, stream, result_pool, iterpool)); svn_pool_clear(iterpool); } @@ -969,7 +998,7 @@ svn_fs_x__read_changes_incrementally(svn void *change_receiver_baton, apr_pool_t *scratch_pool) { - change_t *change; + svn_fs_x__change_t *change; apr_pool_t *iterpool; iterpool = svn_pool_create(scratch_pool); @@ -992,8 +1021,7 @@ svn_fs_x__read_changes_incrementally(svn All temporary allocations are in SCRATCH_POOL. */ static svn_error_t * write_change_entry(svn_stream_t *stream, - const char *path, - svn_fs_path_change2_t *change, + svn_fs_x__change_t *change, apr_pool_t *scratch_pool) { const char *idstr; @@ -1025,10 +1053,7 @@ write_change_entry(svn_stream_t *stream, change->change_kind); } - if (change->node_rev_id) - idstr = svn_fs_x__id_unparse(change->node_rev_id, scratch_pool)->data; - else - idstr = ACTION_RESET; + idstr = svn_fs_x__id_unparse(&change->noderev_id, scratch_pool)->data; SVN_ERR_ASSERT(change->node_kind == svn_node_dir || change->node_kind == svn_node_file); @@ -1043,7 +1068,7 @@ write_change_entry(svn_stream_t *stream, change->prop_mod ? FLAG_TRUE : FLAG_FALSE, change->mergeinfo_mod == svn_tristate_true ? FLAG_TRUE : FLAG_FALSE, - auto_escape_path(path, scratch_pool)); + auto_escape_path(change->path.data, scratch_pool)); if (SVN_IS_VALID_REVNUM(change->copyfrom_rev)) { @@ -1087,16 +1112,13 @@ svn_fs_x__write_changes(svn_stream_t *st /* Write all items to disk in the new order. */ for (i = 0; i < sorted_changed_paths->nelts; ++i) { - svn_fs_path_change2_t *change; - const char *path; + svn_fs_x__change_t *change; svn_pool_clear(iterpool); - change = APR_ARRAY_IDX(sorted_changed_paths, i, svn_sort__item_t).value; - path = APR_ARRAY_IDX(sorted_changed_paths, i, svn_sort__item_t).key; /* Write out the new entry into the final rev-file. */ - SVN_ERR(write_change_entry(stream, path, change, iterpool)); + SVN_ERR(write_change_entry(stream, change, iterpool)); } if (terminate_list) Modified: subversion/branches/pin-externals/subversion/libsvn_fs_x/low_level.h URL: http://svn.apache.org/viewvc/subversion/branches/pin-externals/subversion/libsvn_fs_x/low_level.h?rev=1653578&r1=1653577&r2=1653578&view=diff ============================================================================== --- subversion/branches/pin-externals/subversion/libsvn_fs_x/low_level.h (original) +++ subversion/branches/pin-externals/subversion/libsvn_fs_x/low_level.h Wed Jan 21 16:22:19 2015 @@ -81,7 +81,7 @@ svn_fs_x__unparse_footer(apr_off_t l2p_o into *REP_P. TEXT will be invalidated by this call. Allocate *REP_P in RESULT_POOL and use SCRATCH_POOL for temporaries. */ svn_error_t * -svn_fs_x__parse_representation(representation_t **rep_p, +svn_fs_x__parse_representation(svn_fs_x__representation_t **rep_p, svn_stringbuf_t *text, apr_pool_t *result_pool, apr_pool_t *scratch_pool); @@ -92,7 +92,7 @@ svn_fs_x__parse_representation(represent * If MAY_BE_CORRUPT is true, guard for NULL when constructing the string. * Allocate the result in RESULT_POOL and temporaries in SCRATCH_POOL. */ svn_stringbuf_t * -svn_fs_x__unparse_representation(representation_t *rep, +svn_fs_x__unparse_representation(svn_fs_x__representation_t *rep, svn_boolean_t mutable_rep_truncated, apr_pool_t *result_pool, apr_pool_t *scratch_pool); @@ -100,7 +100,7 @@ svn_fs_x__unparse_representation(represe /* Read a node-revision from STREAM. Set *NODEREV to the new structure, allocated in RESULT_POOL. */ svn_error_t * -svn_fs_x__read_noderev(node_revision_t **noderev, +svn_fs_x__read_noderev(svn_fs_x__noderev_t **noderev, svn_stream_t *stream, apr_pool_t *result_pool, apr_pool_t *scratch_pool); @@ -109,7 +109,7 @@ svn_fs_x__read_noderev(node_revision_t * Temporary allocations are from SCRATCH_POOL. */ svn_error_t * svn_fs_x__write_noderev(svn_stream_t *outfile, - node_revision_t *noderev, + svn_fs_x__noderev_t *noderev, apr_pool_t *scratch_pool); /* This type enumerates all forms of representations that we support. */ @@ -181,7 +181,7 @@ svn_fs_x__read_changes(apr_array_header_ */ typedef svn_error_t *(*svn_fs_x__change_receiver_t)( void *baton, - change_t *change, + svn_fs_x__change_t *change, apr_pool_t *scratch_pool); /* Read all the changes from STREAM and invoke CHANGE_RECEIVER on each change. Modified: subversion/branches/pin-externals/subversion/libsvn_fs_x/noderevs.c URL: http://svn.apache.org/viewvc/subversion/branches/pin-externals/subversion/libsvn_fs_x/noderevs.c?rev=1653578&r1=1653577&r2=1653578&view=diff ============================================================================== --- subversion/branches/pin-externals/subversion/libsvn_fs_x/noderevs.c (original) +++ subversion/branches/pin-externals/subversion/libsvn_fs_x/noderevs.c Wed Jan 21 16:22:19 2015 @@ -49,16 +49,6 @@ /* the noderev has copy-root path and revision */ #define NODEREV_HAS_CPATH 0x00040 -/* Our internal representation of an id - * (basically, strip off the txn_id and the fs-agnostic header) - */ -typedef struct binary_id_t -{ - svn_fs_x__id_part_t node_id; - svn_fs_x__id_part_t copy_id; - svn_fs_x__id_part_t noderev_id; -} binary_id_t; - /* Our internal representation of an representation. */ typedef struct binary_representation_t @@ -70,7 +60,7 @@ typedef struct binary_representation_t unsigned char md5_digest[APR_MD5_DIGESTSIZE]; /* Location of this representation. */ - svn_fs_x__id_part_t id; + svn_fs_x__id_t id; /* The size of the representation in bytes as seen in the revision file. */ @@ -81,7 +71,7 @@ typedef struct binary_representation_t svn_filesize_t expanded_size; } binary_representation_t; -/* Our internal representation of a node_revision_t. +/* Our internal representation of a svn_fs_x__noderev_t. * * We will store path strings in a string container and reference them * from here. Similarly, IDs and representations are being stored in @@ -93,9 +83,15 @@ typedef struct binary_noderev_t /* node type and presence indicators */ apr_uint32_t flags; - /* Index+1 of the node-id for this node-rev. */ + /* Index+1 of the noderev-id for this node-rev. */ int id; + /* Index+1 of the node-id for this node-rev. */ + int node_id; + + /* Index+1 of the copy-id for this node-rev. */ + int copy_id; + /* Index+1 of the predecessor node revision id, or 0 if there is no predecessor for this node revision */ int predecessor_id; @@ -156,19 +152,14 @@ struct svn_fs_x__noderevs_t apr_hash_t *ids_dict; /* During construction, maps a full binary_representation_t to an index - * into DATA_REPS. */ - apr_hash_t *data_reps_dict; - - /* During construction, maps a full binary_representation_t to an index - * into PROP_REPS. */ - apr_hash_t *prop_reps_dict; + * into REPS. */ + apr_hash_t *reps_dict; /* array of binary_id_t */ apr_array_header_t *ids; - /* arrays of binary_representation_t */ - apr_array_header_t *data_reps; - apr_array_header_t *prop_reps; + /* array of binary_representation_t */ + apr_array_header_t *reps; /* array of binary_noderev_t. */ apr_array_header_t *noderevs; @@ -176,24 +167,23 @@ struct svn_fs_x__noderevs_t svn_fs_x__noderevs_t * svn_fs_x__noderevs_create(int initial_count, - apr_pool_t* pool) + apr_pool_t* result_pool) { - svn_fs_x__noderevs_t *noderevs = apr_palloc(pool, sizeof(*noderevs)); + svn_fs_x__noderevs_t *noderevs + = apr_palloc(result_pool, sizeof(*noderevs)); - noderevs->builder = svn_fs_x__string_table_builder_create(pool); - noderevs->ids_dict = svn_hash__make(pool); - noderevs->data_reps_dict = svn_hash__make(pool); - noderevs->prop_reps_dict = svn_hash__make(pool); + noderevs->builder = svn_fs_x__string_table_builder_create(result_pool); + noderevs->ids_dict = svn_hash__make(result_pool); + noderevs->reps_dict = svn_hash__make(result_pool); noderevs->paths = NULL; noderevs->ids - = apr_array_make(pool, initial_count, sizeof(binary_id_t)); - noderevs->data_reps - = apr_array_make(pool, initial_count, sizeof(binary_representation_t)); - noderevs->prop_reps - = apr_array_make(pool, initial_count, sizeof(binary_representation_t)); + = apr_array_make(result_pool, 2 * initial_count, sizeof(svn_fs_x__id_t)); + noderevs->reps + = apr_array_make(result_pool, 2 * initial_count, + sizeof(binary_representation_t)); noderevs->noderevs - = apr_array_make(pool, initial_count, sizeof(binary_noderev_t)); + = apr_array_make(result_pool, initial_count, sizeof(binary_noderev_t)); return noderevs; } @@ -204,24 +194,19 @@ svn_fs_x__noderevs_create(int initial_co static int store_id(apr_array_header_t *ids, apr_hash_t *dict, - const svn_fs_id_t *id) + const svn_fs_x__id_t *id) { - binary_id_t bin_id = { { 0 } }; int idx; void *idx_void; - if (id == NULL) + if (!svn_fs_x__id_used(id)) return 0; - - bin_id.node_id = *svn_fs_x__id_node_id(id); - bin_id.copy_id = *svn_fs_x__id_copy_id(id); - bin_id.noderev_id = *svn_fs_x__id_noderev_id(id); - idx_void = apr_hash_get(dict, &bin_id, sizeof(bin_id)); + idx_void = apr_hash_get(dict, &id, sizeof(id)); idx = (int)(apr_uintptr_t)idx_void; if (idx == 0) { - APR_ARRAY_PUSH(ids, binary_id_t) = bin_id; + APR_ARRAY_PUSH(ids, svn_fs_x__id_t) = *id; idx = ids->nelts; apr_hash_set(dict, ids->elts + (idx-1) * ids->elt_size, ids->elt_size, (void*)(apr_uintptr_t)idx); @@ -236,7 +221,7 @@ store_id(apr_array_header_t *ids, static int store_representation(apr_array_header_t *reps, apr_hash_t *dict, - const representation_t *rep) + const svn_fs_x__representation_t *rep) { binary_representation_t binary_rep = { 0 }; int idx; @@ -267,7 +252,7 @@ store_representation(apr_array_header_t apr_size_t svn_fs_x__noderevs_add(svn_fs_x__noderevs_t *container, - node_revision_t *noderev) + svn_fs_x__noderev_t *noderev) { binary_noderev_t binary_noderev = { 0 }; @@ -278,9 +263,13 @@ svn_fs_x__noderevs_add(svn_fs_x__noderev | (int)noderev->kind; binary_noderev.id - = store_id(container->ids, container->ids_dict, noderev->id); + = store_id(container->ids, container->ids_dict, &noderev->noderev_id); + binary_noderev.node_id + = store_id(container->ids, container->ids_dict, &noderev->node_id); + binary_noderev.copy_id + = store_id(container->ids, container->ids_dict, &noderev->copy_id); binary_noderev.predecessor_id - = store_id(container->ids, container->ids_dict, noderev->predecessor_id); + = store_id(container->ids, container->ids_dict, &noderev->predecessor_id); if (noderev->copyfrom_path) { @@ -301,19 +290,18 @@ svn_fs_x__noderevs_add(svn_fs_x__noderev } binary_noderev.predecessor_count = noderev->predecessor_count; - binary_noderev.prop_rep = store_representation(container->prop_reps, - container->prop_reps_dict, + binary_noderev.prop_rep = store_representation(container->reps, + container->reps_dict, noderev->prop_rep); - if (noderev->data_rep) - binary_noderev.data_rep = store_representation(container->data_reps, - container->data_reps_dict, - noderev->data_rep); + binary_noderev.data_rep = store_representation(container->reps, + container->reps_dict, + noderev->data_rep); if (noderev->created_path) binary_noderev.created_path = svn_fs_x__string_table_builder_add(container->builder, - noderev->created_path, - 0); + noderev->created_path, + 0); binary_noderev.mergeinfo_count = noderev->mergeinfo_count; @@ -331,58 +319,48 @@ svn_fs_x__noderevs_estimate_size(const s /* string table code makes its own prediction, * noderevs should be < 16 bytes each, - * ids < 10 bytes each, + * id parts < 4 bytes each, * data representations < 40 bytes each, * property representations < 30 bytes each, * some static overhead should be assumed */ return svn_fs_x__string_table_builder_estimate_size(container->builder) + container->noderevs->nelts * 16 - + container->ids->nelts * 10 - + container->data_reps->nelts * 40 - + container->prop_reps->nelts * 30 + + container->ids->nelts * 4 + + container->reps->nelts * 40 + 100; } -/* Create an svn_fs_id_t in *ID, allocated in POOL based on the id stored - * at index IDX in IDS. +/* Set *ID to the ID part stored at index IDX in IDS. */ static svn_error_t * -get_id(const svn_fs_id_t **id, +get_id(svn_fs_x__id_t *id, const apr_array_header_t *ids, - int idx, - apr_pool_t *pool) + int idx) { - binary_id_t *binary_id; - /* handle NULL IDs */ if (idx == 0) { - *id = NULL; + svn_fs_x__id_reset(id); return SVN_NO_ERROR; } /* check for corrupted data */ if (idx < 0 || idx > ids->nelts) return svn_error_createf(SVN_ERR_FS_CONTAINER_INDEX, NULL, - _("Node revision ID index %d" - " exceeds container size %d"), + _("ID part index %d exceeds container size %d"), idx, ids->nelts); - /* create a svn_fs_id_t from stored info */ - binary_id = &APR_ARRAY_IDX(ids, idx - 1, binary_id_t); - *id = svn_fs_x__id_create(&binary_id->node_id, - &binary_id->copy_id, - &binary_id->noderev_id, - pool); + /* Return the requested ID. */ + *id = APR_ARRAY_IDX(ids, idx - 1, svn_fs_x__id_t); return SVN_NO_ERROR; } -/* Create a representation_t in *REP, allocated in POOL based on the +/* Create a svn_fs_x__representation_t in *REP, allocated in POOL based on the * representation stored at index IDX in REPS. */ static svn_error_t * -get_representation(representation_t **rep, +get_representation(svn_fs_x__representation_t **rep, const apr_array_header_t *reps, int idx, apr_pool_t *pool) @@ -420,14 +398,14 @@ get_representation(representation_t **re } svn_error_t * -svn_fs_x__noderevs_get(node_revision_t **noderev_p, +svn_fs_x__noderevs_get(svn_fs_x__noderev_t **noderev_p, const svn_fs_x__noderevs_t *container, apr_size_t idx, apr_pool_t *pool) { - node_revision_t *noderev; + svn_fs_x__noderev_t *noderev; binary_noderev_t *binary_noderev; - + /* CONTAINER must be in 'finalized' mode */ SVN_ERR_ASSERT(container->builder == NULL); SVN_ERR_ASSERT(container->paths); @@ -444,11 +422,15 @@ svn_fs_x__noderevs_get(node_revision_t * /* allocate result struct and fill it field by field */ noderev = apr_pcalloc(pool, sizeof(*noderev)); binary_noderev = &APR_ARRAY_IDX(container->noderevs, idx, binary_noderev_t); - + noderev->kind = (svn_node_kind_t)(binary_noderev->flags & NODEREV_KIND_MASK); - SVN_ERR(get_id(&noderev->id, container->ids, binary_noderev->id, pool)); + SVN_ERR(get_id(&noderev->noderev_id, container->ids, binary_noderev->id)); + SVN_ERR(get_id(&noderev->node_id, container->ids, + binary_noderev->node_id)); + SVN_ERR(get_id(&noderev->copy_id, container->ids, + binary_noderev->copy_id)); SVN_ERR(get_id(&noderev->predecessor_id, container->ids, - binary_noderev->predecessor_id, pool)); + binary_noderev->predecessor_id)); if (binary_noderev->flags & NODEREV_HAS_COPYFROM) { @@ -482,9 +464,9 @@ svn_fs_x__noderevs_get(node_revision_t * noderev->predecessor_count = binary_noderev->predecessor_count; - SVN_ERR(get_representation(&noderev->prop_rep, container->prop_reps, + SVN_ERR(get_representation(&noderev->prop_rep, container->reps, binary_noderev->prop_rep, pool)); - SVN_ERR(get_representation(&noderev->data_rep, container->data_reps, + SVN_ERR(get_representation(&noderev->data_rep, container->reps, binary_noderev->data_rep, pool)); if (binary_noderev->flags & NODEREV_HAS_CPATH) @@ -558,56 +540,50 @@ write_reps(svn_packed__int_stream_t *rep svn_error_t * svn_fs_x__write_noderevs_container(svn_stream_t *stream, const svn_fs_x__noderevs_t *container, - apr_pool_t *pool) + apr_pool_t *scratch_pool) { int i; string_table_t *paths = container->paths ? container->paths : svn_fs_x__string_table_create(container->builder, - pool); + scratch_pool); - svn_packed__data_root_t *root = svn_packed__data_create_root(pool); + svn_packed__data_root_t *root = svn_packed__data_create_root(scratch_pool); /* one common top-level stream for all arrays. One sub-stream */ svn_packed__int_stream_t *structs_stream = svn_packed__create_int_stream(root, FALSE, FALSE); svn_packed__int_stream_t *ids_stream = svn_packed__create_int_substream(structs_stream, FALSE, FALSE); - svn_packed__int_stream_t *data_reps_stream - = create_rep_stream(structs_stream); - svn_packed__int_stream_t *prop_reps_stream + svn_packed__int_stream_t *reps_stream = create_rep_stream(structs_stream); svn_packed__int_stream_t *noderevs_stream = svn_packed__create_int_substream(structs_stream, FALSE, FALSE); svn_packed__byte_stream_t *digests_stream = svn_packed__create_bytes_stream(root); - /* structure the CHANGES_STREAM such we can extract much of the redundancy - * from the binary_change_t structs */ - for (i = 0; i < 3 * 2; ++i) + /* structure the IDS_STREAM such we can extract much of the redundancy + * from the svn_fs_x__ip_part_t structs */ + for (i = 0; i < 2; ++i) svn_packed__create_int_substream(ids_stream, TRUE, FALSE); + /* Same storing binary_noderev_t in the NODEREVS_STREAM */ svn_packed__create_int_substream(noderevs_stream, FALSE, FALSE); - for (i = 0; i < 11; ++i) + for (i = 0; i < 13; ++i) svn_packed__create_int_substream(noderevs_stream, TRUE, FALSE); /* serialize ids array */ for (i = 0; i < container->ids->nelts; ++i) { - binary_id_t *id = &APR_ARRAY_IDX(container->ids, i, binary_id_t); + svn_fs_x__id_t *id = &APR_ARRAY_IDX(container->ids, i, svn_fs_x__id_t); - svn_packed__add_int(ids_stream, id->node_id.change_set); - svn_packed__add_uint(ids_stream, id->node_id.number); - svn_packed__add_int(ids_stream, id->copy_id.change_set); - svn_packed__add_uint(ids_stream, id->copy_id.number); - svn_packed__add_int(ids_stream, id->noderev_id.change_set); - svn_packed__add_uint(ids_stream, id->noderev_id.number); + svn_packed__add_int(ids_stream, id->change_set); + svn_packed__add_uint(ids_stream, id->number); } /* serialize rep arrays */ - write_reps(data_reps_stream, digests_stream, container->data_reps); - write_reps(prop_reps_stream, digests_stream, container->prop_reps); + write_reps(reps_stream, digests_stream, container->reps); /* serialize noderevs array */ for (i = 0; i < container->noderevs->nelts; ++i) @@ -618,6 +594,8 @@ svn_fs_x__write_noderevs_container(svn_s svn_packed__add_uint(noderevs_stream, noderev->flags); svn_packed__add_uint(noderevs_stream, noderev->id); + svn_packed__add_uint(noderevs_stream, noderev->node_id); + svn_packed__add_uint(noderevs_stream, noderev->copy_id); svn_packed__add_uint(noderevs_stream, noderev->predecessor_id); svn_packed__add_uint(noderevs_stream, noderev->predecessor_count); @@ -634,15 +612,15 @@ svn_fs_x__write_noderevs_container(svn_s } /* write to disk */ - SVN_ERR(svn_fs_x__write_string_table(stream, paths, pool)); - SVN_ERR(svn_packed__data_write(stream, root, pool)); + SVN_ERR(svn_fs_x__write_string_table(stream, paths, scratch_pool)); + SVN_ERR(svn_packed__data_write(stream, root, scratch_pool)); return SVN_NO_ERROR; } -/* Allocate a representation_t array in POOL and return it in *REPS_P. - * Deserialize the data in REP_STREAM and DIGEST_STREAM and store the - * resulting representations into the *REPS_P. +/* Allocate a svn_fs_x__representation_t array in POOL and return it in + * REPS_P. Deserialize the data in REP_STREAM and DIGEST_STREAM and store + * the resulting representations into the *REPS_P. */ static svn_error_t * read_reps(apr_array_header_t **reps_p, @@ -719,8 +697,7 @@ svn_fs_x__read_noderevs_container(svn_fs svn_packed__data_root_t *root; svn_packed__int_stream_t *structs_stream; svn_packed__int_stream_t *ids_stream; - svn_packed__int_stream_t *data_reps_stream; - svn_packed__int_stream_t *prop_reps_stream; + svn_packed__int_stream_t *reps_stream; svn_packed__int_stream_t *noderevs_stream; svn_packed__byte_stream_t *digests_stream; @@ -732,34 +709,27 @@ svn_fs_x__read_noderevs_container(svn_fs /* get streams */ structs_stream = svn_packed__first_int_stream(root); ids_stream = svn_packed__first_int_substream(structs_stream); - data_reps_stream = svn_packed__next_int_stream(ids_stream); - prop_reps_stream = svn_packed__next_int_stream(data_reps_stream); - noderevs_stream = svn_packed__next_int_stream(prop_reps_stream); + reps_stream = svn_packed__next_int_stream(ids_stream); + noderevs_stream = svn_packed__next_int_stream(reps_stream); digests_stream = svn_packed__first_byte_stream(root); /* read ids array */ count = svn_packed__int_count(svn_packed__first_int_substream(ids_stream)); noderevs->ids - = apr_array_make(result_pool, (int)count, sizeof(binary_id_t)); + = apr_array_make(result_pool, (int)count, sizeof(svn_fs_x__id_t)); for (i = 0; i < count; ++i) { - binary_id_t id; + svn_fs_x__id_t id; - id.node_id.change_set = (svn_revnum_t)svn_packed__get_int(ids_stream); - id.node_id.number = svn_packed__get_uint(ids_stream); - id.copy_id.change_set = (svn_revnum_t)svn_packed__get_int(ids_stream); - id.copy_id.number = svn_packed__get_uint(ids_stream); - id.noderev_id.change_set = (svn_revnum_t)svn_packed__get_int(ids_stream); - id.noderev_id.number = svn_packed__get_uint(ids_stream); + id.change_set = (svn_revnum_t)svn_packed__get_int(ids_stream); + id.number = svn_packed__get_uint(ids_stream); - APR_ARRAY_PUSH(noderevs->ids, binary_id_t) = id; + APR_ARRAY_PUSH(noderevs->ids, svn_fs_x__id_t) = id; } /* read rep arrays */ - SVN_ERR(read_reps(&noderevs->data_reps, data_reps_stream, digests_stream, - result_pool)); - SVN_ERR(read_reps(&noderevs->prop_reps, prop_reps_stream, digests_stream, + SVN_ERR(read_reps(&noderevs->reps, reps_stream, digests_stream, result_pool)); /* read noderevs array */ @@ -774,6 +744,8 @@ svn_fs_x__read_noderevs_container(svn_fs noderev.flags = (apr_uint32_t)svn_packed__get_uint(noderevs_stream); noderev.id = (int)svn_packed__get_uint(noderevs_stream); + noderev.node_id = (int)svn_packed__get_uint(noderevs_stream); + noderev.copy_id = (int)svn_packed__get_uint(noderevs_stream); noderev.predecessor_id = (int)svn_packed__get_uint(noderevs_stream); noderev.predecessor_count = (int)svn_packed__get_uint(noderevs_stream); @@ -806,8 +778,7 @@ svn_fs_x__serialize_noderevs_container(v svn_stringbuf_t *serialized; apr_size_t size = noderevs->ids->elt_size * noderevs->ids->nelts - + noderevs->data_reps->elt_size * noderevs->data_reps->nelts - + noderevs->prop_reps->elt_size * noderevs->prop_reps->nelts + + noderevs->reps->elt_size * noderevs->reps->nelts + noderevs->noderevs->elt_size * noderevs->noderevs->nelts + 10 * noderevs->noderevs->elt_size + 100; @@ -819,8 +790,7 @@ svn_fs_x__serialize_noderevs_container(v /* serialize sub-structures */ svn_fs_x__serialize_string_table(context, &noderevs->paths); svn_fs_x__serialize_apr_array(context, &noderevs->ids); - svn_fs_x__serialize_apr_array(context, &noderevs->data_reps); - svn_fs_x__serialize_apr_array(context, &noderevs->prop_reps); + svn_fs_x__serialize_apr_array(context, &noderevs->reps); svn_fs_x__serialize_apr_array(context, &noderevs->noderevs); /* return the serialized result */ @@ -843,8 +813,7 @@ svn_fs_x__deserialize_noderevs_container /* de-serialize sub-structures */ svn_fs_x__deserialize_string_table(noderevs, &noderevs->paths); svn_fs_x__deserialize_apr_array(noderevs, &noderevs->ids, pool); - svn_fs_x__deserialize_apr_array(noderevs, &noderevs->data_reps, pool); - svn_fs_x__deserialize_apr_array(noderevs, &noderevs->prop_reps, pool); + svn_fs_x__deserialize_apr_array(noderevs, &noderevs->reps, pool); svn_fs_x__deserialize_apr_array(noderevs, &noderevs->noderevs, pool); /* done */ @@ -878,12 +847,11 @@ svn_fs_x__noderevs_get_func(void **out, void *baton, apr_pool_t *pool) { - node_revision_t *noderev; + svn_fs_x__noderev_t *noderev; binary_noderev_t *binary_noderev; - + apr_array_header_t ids; - apr_array_header_t data_reps; - apr_array_header_t prop_reps; + apr_array_header_t reps; apr_array_header_t noderevs; apr_uint32_t idx = *(apr_uint32_t *)baton; @@ -895,18 +863,19 @@ svn_fs_x__noderevs_get_func(void **out, (const void *const *)&container->paths); resolve_apr_array_header(&ids, container, &container->ids); - resolve_apr_array_header(&data_reps, container, &container->data_reps); - resolve_apr_array_header(&prop_reps, container, &container->prop_reps); + resolve_apr_array_header(&reps, container, &container->reps); resolve_apr_array_header(&noderevs, container, &container->noderevs); - + /* allocate result struct and fill it field by field */ noderev = apr_pcalloc(pool, sizeof(*noderev)); binary_noderev = &APR_ARRAY_IDX(&noderevs, idx, binary_noderev_t); - + noderev->kind = (svn_node_kind_t)(binary_noderev->flags & NODEREV_KIND_MASK); - SVN_ERR(get_id(&noderev->id, &ids, binary_noderev->id, pool)); + SVN_ERR(get_id(&noderev->noderev_id, &ids, binary_noderev->id)); + SVN_ERR(get_id(&noderev->node_id, &ids, binary_noderev->node_id)); + SVN_ERR(get_id(&noderev->copy_id, &ids, binary_noderev->copy_id)); SVN_ERR(get_id(&noderev->predecessor_id, &ids, - binary_noderev->predecessor_id, pool)); + binary_noderev->predecessor_id)); if (binary_noderev->flags & NODEREV_HAS_COPYFROM) { @@ -940,9 +909,9 @@ svn_fs_x__noderevs_get_func(void **out, noderev->predecessor_count = binary_noderev->predecessor_count; - SVN_ERR(get_representation(&noderev->prop_rep, &prop_reps, + SVN_ERR(get_representation(&noderev->prop_rep, &reps, binary_noderev->prop_rep, pool)); - SVN_ERR(get_representation(&noderev->data_rep, &data_reps, + SVN_ERR(get_representation(&noderev->data_rep, &reps, binary_noderev->data_rep, pool)); if (binary_noderev->flags & NODEREV_HAS_CPATH) Modified: subversion/branches/pin-externals/subversion/libsvn_fs_x/noderevs.h URL: http://svn.apache.org/viewvc/subversion/branches/pin-externals/subversion/libsvn_fs_x/noderevs.h?rev=1653578&r1=1653577&r2=1653578&view=diff ============================================================================== --- subversion/branches/pin-externals/subversion/libsvn_fs_x/noderevs.h (original) +++ subversion/branches/pin-externals/subversion/libsvn_fs_x/noderevs.h Wed Jan 21 16:22:19 2015 @@ -33,7 +33,7 @@ * * In its serialized form, the svn_fs_x__noderevs_t container extracts * most of that redundancy and the run-time representation is also much - * smaller than sum of the respective node_revision_t objects. + * smaller than sum of the respective svn_fs_x__noderev_t objects. * * As with other containers, this one has two modes: 'construction', in * which you may add data to it, and 'getter' in which there is only r/o @@ -47,18 +47,19 @@ typedef struct svn_fs_x__noderevs_t svn_ /* Create and populate noderev containers. */ /* Create and return a new noderevs container with an initial capacity of - * INITIAL_COUNT node_revision_t objects. Allocate the result in POOL. + * INITIAL_COUNT svn_fs_x__noderev_t objects. + * Allocate the result in RESULT_POOL. */ svn_fs_x__noderevs_t * svn_fs_x__noderevs_create(int initial_count, - apr_pool_t *pool); + apr_pool_t *result_pool); /* Add NODEREV to the CONTAINER. Return the index that identifies the new * item in this container. */ apr_size_t svn_fs_x__noderevs_add(svn_fs_x__noderevs_t *container, - node_revision_t *noderev); + svn_fs_x__noderev_t *noderev); /* Return a rough estimate in bytes for the serialized representation * of CONTAINER. @@ -72,20 +73,20 @@ svn_fs_x__noderevs_estimate_size(const s * the result in POOL and return it in *NODEREV_P. */ svn_error_t * -svn_fs_x__noderevs_get(node_revision_t **noderev_p, +svn_fs_x__noderevs_get(svn_fs_x__noderev_t **noderev_p, const svn_fs_x__noderevs_t *container, apr_size_t idx, apr_pool_t *pool); /* I/O interface. */ -/* Write a serialized representation of CONTAINER to STREAM. Use POOL for - * temporary allocations. +/* Write a serialized representation of CONTAINER to STREAM. + * Use SCRATCH_POOL for temporary allocations. */ svn_error_t * svn_fs_x__write_noderevs_container(svn_stream_t *stream, - const svn_fs_x__noderevs_t *container, - apr_pool_t *pool); + const svn_fs_x__noderevs_t *container, + apr_pool_t *scratch_pool); /* Read a noderev container from its serialized representation in STREAM. * Allocate the result in RESULT_POOL and return it in *CONTAINER. Use @@ -116,7 +117,7 @@ svn_fs_x__deserialize_noderevs_container apr_pool_t *pool); /* Implements svn_cache__partial_getter_func_t for svn_fs_x__noderevs_t, - * setting *OUT to the node_revision_t selected by the apr_uint32_t index + * setting *OUT to the svn_fs_x__noderev_t selected by the apr_uint32_t index * passed in as *BATON. This function is similar to svn_fs_x__noderevs_get * but operates on the cache serialized representation of the container. */
