Modified: subversion/branches/svn-auth-x509/subversion/libsvn_fs_x/id.c URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_fs_x/id.c?rev=1652409&r1=1652408&r2=1652409&view=diff ============================================================================== --- subversion/branches/svn-auth-x509/subversion/libsvn_fs_x/id.c (original) +++ subversion/branches/svn-auth-x509/subversion/libsvn_fs_x/id.c Fri Jan 16 14:01:35 2015 @@ -1,4 +1,4 @@ -/* id.c : operations on node-revision IDs +/* id.c : implements FSX-internal ID functions * * ==================================================================== * Licensed to the Apache Software Foundation (ASF) under one @@ -21,32 +21,14 @@ */ #include <assert.h> -#include <string.h> -#include <stdlib.h> #include "id.h" #include "index.h" #include "util.h" -#include "../libsvn_fs/fs-loader.h" -#include "private/svn_temp_serializer.h" #include "private/svn_string_private.h" -typedef struct fs_x__id_t -{ - /* API visible part */ - svn_fs_id_t generic_id; - - /* private members */ - svn_fs_x__id_part_t node_id; - svn_fs_x__id_part_t copy_id; - svn_fs_x__id_part_t noderev_id; - - apr_pool_t *pool; /* pool that was used to allocate this struct */ -} fs_x__id_t; - - svn_boolean_t svn_fs_x__is_txn(svn_fs_x__change_set_t change_set) @@ -95,7 +77,7 @@ svn_fs_x__change_set_by_txn(apr_int64_t /* Parse the NUL-terminated ID part at DATA and write the result into *PART. * Return TRUE if no errors were detected. */ static svn_boolean_t -part_parse(svn_fs_x__id_part_t *part, +part_parse(svn_fs_x__id_t *part, const char *data) { part->number = svn__base36toui64(&data, data); @@ -119,7 +101,7 @@ part_parse(svn_fs_x__id_part_t *part, */ static char * part_unparse(char *p, - const svn_fs_x__id_part_t *part) + const svn_fs_x__id_t *part) { p += svn__ui64tobase36(p, part->number); if (part->change_set >= 0) @@ -141,151 +123,71 @@ part_unparse(char *p, /* Operations on ID parts */ svn_boolean_t -svn_fs_x__id_part_is_root(const svn_fs_x__id_part_t* part) +svn_fs_x__id_is_root(const svn_fs_x__id_t* part) { return part->change_set == 0 && part->number == 0; } svn_boolean_t -svn_fs_x__id_part_eq(const svn_fs_x__id_part_t *lhs, - const svn_fs_x__id_part_t *rhs) +svn_fs_x__id_eq(const svn_fs_x__id_t *lhs, + const svn_fs_x__id_t *rhs) { return lhs->change_set == rhs->change_set && lhs->number == rhs->number; } - - -/* Accessing ID Pieces. */ - -const svn_fs_x__id_part_t * -svn_fs_x__id_node_id(const svn_fs_id_t *fs_id) -{ - const fs_x__id_t *id = (const fs_x__id_t *)fs_id; - - return &id->node_id; -} - - -const svn_fs_x__id_part_t * -svn_fs_x__id_copy_id(const svn_fs_id_t *fs_id) -{ - const fs_x__id_t *id = (const fs_x__id_t *)fs_id; - - return &id->copy_id; -} - - -svn_fs_x__txn_id_t -svn_fs_x__id_txn_id(const svn_fs_id_t *fs_id) -{ - const fs_x__id_t *id = (const fs_x__id_t *)fs_id; - - return svn_fs_x__get_txn_id(id->noderev_id.change_set); -} - - -const svn_fs_x__id_part_t * -svn_fs_x__id_noderev_id(const svn_fs_id_t *fs_id) -{ - const fs_x__id_t *id = (const fs_x__id_t *)fs_id; - - return &id->noderev_id; -} - -svn_revnum_t -svn_fs_x__id_rev(const svn_fs_id_t *fs_id) -{ - const fs_x__id_t *id = (const fs_x__id_t *)fs_id; - - return svn_fs_x__get_revnum(id->noderev_id.change_set); -} - - -apr_uint64_t -svn_fs_x__id_item(const svn_fs_id_t *fs_id) +svn_error_t * +svn_fs_x__id_parse(svn_fs_x__id_t *part, + const char *data) { - const fs_x__id_t *id = (const fs_x__id_t *)fs_id; + if (!part_parse(part, data)) + return svn_error_createf(SVN_ERR_FS_MALFORMED_NODEREV_ID, NULL, + "Malformed ID string"); - return id->noderev_id.number; + return SVN_NO_ERROR; } -svn_boolean_t -svn_fs_x__id_is_txn(const svn_fs_id_t *fs_id) +svn_string_t * +svn_fs_x__id_unparse(const svn_fs_x__id_t *id, + apr_pool_t *result_pool) { - const fs_x__id_t *id = (const fs_x__id_t *)fs_id; + char string[2 * SVN_INT64_BUFFER_SIZE + 1]; + char *p = part_unparse(string, id); - return svn_fs_x__is_txn(id->noderev_id.change_set); + return svn_string_ncreate(string, p - string, result_pool); } -svn_string_t * -svn_fs_x__id_unparse(const svn_fs_id_t *fs_id, - apr_pool_t *pool) +void +svn_fs_x__id_reset(svn_fs_x__id_t *part) { - char string[6 * SVN_INT64_BUFFER_SIZE + 10]; - const fs_x__id_t *id = (const fs_x__id_t *)fs_id; - - char *p = part_unparse(string, &id->node_id); - *(p++) = '.'; - p = part_unparse(p, &id->copy_id); - *(p++) = '.'; - p = part_unparse(p, &id->noderev_id); - - return svn_string_ncreate(string, p - string, pool); + part->change_set = SVN_FS_X__INVALID_CHANGE_SET; + part->number = 0; } - -/*** Comparing node IDs ***/ - svn_boolean_t -svn_fs_x__id_eq(const svn_fs_id_t *a, - const svn_fs_id_t *b) +svn_fs_x__id_used(const svn_fs_x__id_t *part) { - const fs_x__id_t *id_a = (const fs_x__id_t *)a; - const fs_x__id_t *id_b = (const fs_x__id_t *)b; - - if (a == b) - return TRUE; - - return svn_fs_x__id_part_eq(&id_a->node_id, &id_b->node_id) - && svn_fs_x__id_part_eq(&id_a->copy_id, &id_b->copy_id) - && svn_fs_x__id_part_eq(&id_a->noderev_id, &id_b->noderev_id); + return part->change_set != SVN_FS_X__INVALID_CHANGE_SET; } - -svn_boolean_t -svn_fs_x__id_check_related(const svn_fs_id_t *a, - const svn_fs_id_t *b) +void +svn_fs_x__init_txn_root(svn_fs_x__id_t *noderev_id, + svn_fs_x__txn_id_t txn_id) { - const fs_x__id_t *id_a = (const fs_x__id_t *)a; - const fs_x__id_t *id_b = (const fs_x__id_t *)b; - - if (a == b) - return TRUE; - - /* Items from different txns are unrelated. */ - if ( svn_fs_x__is_txn(id_a->noderev_id.change_set) - && svn_fs_x__is_txn(id_b->noderev_id.change_set) - && id_a->noderev_id.change_set != id_b->noderev_id.change_set) - return FALSE; - - /* related if they trace back to the same node creation */ - return svn_fs_x__id_part_eq(&id_a->node_id, &id_b->node_id); + noderev_id->change_set = svn_fs_x__change_set_by_txn(txn_id); + noderev_id->number = SVN_FS_X__ITEM_INDEX_ROOT_NODE; } - -svn_fs_node_relation_t -svn_fs_x__id_compare(const svn_fs_id_t *a, - const svn_fs_id_t *b) +void +svn_fs_x__init_rev_root(svn_fs_x__id_t *noderev_id, + svn_revnum_t rev) { - if (svn_fs_x__id_eq(a, b)) - return svn_fs_node_same; - return (svn_fs_x__id_check_related(a, b) ? svn_fs_node_common_ancestor - : svn_fs_node_unrelated); + noderev_id->change_set = svn_fs_x__change_set_by_rev(rev); + noderev_id->number = SVN_FS_X__ITEM_INDEX_ROOT_NODE; } int -svn_fs_x__id_part_compare(const svn_fs_x__id_part_t *a, - const svn_fs_x__id_part_t *b) +svn_fs_x__id_compare(const svn_fs_x__id_t *a, + const svn_fs_x__id_t *b) { if (a->change_set < b->change_set) return -1; @@ -294,210 +196,3 @@ svn_fs_x__id_part_compare(const svn_fs_x return a->number < b->number ? -1 : a->number == b->number ? 0 : 1; } - - - -/* Creating ID's. */ - -static id_vtable_t id_vtable = { - svn_fs_x__id_unparse, - svn_fs_x__id_compare -}; - -svn_fs_id_t * -svn_fs_x__id_txn_create_root(svn_fs_x__txn_id_t txn_id, - apr_pool_t *pool) -{ - fs_x__id_t *id = apr_pcalloc(pool, sizeof(*id)); - - /* node ID and copy ID are "0" */ - - id->noderev_id.change_set = svn_fs_x__change_set_by_txn(txn_id); - id->noderev_id.number = SVN_FS_X__ITEM_INDEX_ROOT_NODE; - - id->generic_id.vtable = &id_vtable; - id->generic_id.fsap_data = id; - id->pool = pool; - - return (svn_fs_id_t *)id; -} - -svn_fs_id_t *svn_fs_x__id_create_root(const svn_revnum_t revision, - apr_pool_t *pool) -{ - fs_x__id_t *id = apr_pcalloc(pool, sizeof(*id)); - - /* node ID and copy ID are "0" */ - - id->noderev_id.change_set = svn_fs_x__change_set_by_rev(revision); - id->noderev_id.number = SVN_FS_X__ITEM_INDEX_ROOT_NODE; - - id->generic_id.vtable = &id_vtable; - id->generic_id.fsap_data = id; - id->pool = pool; - - return (svn_fs_id_t *)id; -} - -svn_fs_id_t * -svn_fs_x__id_txn_create(const svn_fs_x__id_part_t *node_id, - const svn_fs_x__id_part_t *copy_id, - svn_fs_x__txn_id_t txn_id, - apr_uint64_t item, - apr_pool_t *pool) -{ - fs_x__id_t *id = apr_pcalloc(pool, sizeof(*id)); - - id->node_id = *node_id; - id->copy_id = *copy_id; - - id->noderev_id.change_set = svn_fs_x__change_set_by_txn(txn_id); - id->noderev_id.number = item; - - id->generic_id.vtable = &id_vtable; - id->generic_id.fsap_data = id; - id->pool = pool; - - return (svn_fs_id_t *)id; -} - - -svn_fs_id_t * -svn_fs_x__id_create(const svn_fs_x__id_part_t *node_id, - const svn_fs_x__id_part_t *copy_id, - const svn_fs_x__id_part_t *noderev_id, - apr_pool_t *pool) -{ - fs_x__id_t *id = apr_pcalloc(pool, sizeof(*id)); - - id->node_id = *node_id; - id->copy_id = *copy_id; - id->noderev_id = *noderev_id; - - id->generic_id.vtable = &id_vtable; - id->generic_id.fsap_data = id; - id->pool = pool; - - return (svn_fs_id_t *)id; -} - - -svn_fs_id_t * -svn_fs_x__id_copy(const svn_fs_id_t *source, apr_pool_t *pool) -{ - const fs_x__id_t *id = (const fs_x__id_t *)source; - fs_x__id_t *new_id = apr_pmemdup(pool, id, sizeof(*new_id)); - - new_id->generic_id.fsap_data = new_id; - new_id->pool = pool; - - return (svn_fs_id_t *)new_id; -} - -/* Return an ID resulting from parsing the string DATA, or NULL if DATA is - an invalid ID string. *DATA will be modified / invalidated by this call. */ -static svn_fs_id_t * -id_parse(char *data, - apr_pool_t *pool) -{ - fs_x__id_t *id; - char *str; - - /* Alloc a new svn_fs_id_t structure. */ - id = apr_pcalloc(pool, sizeof(*id)); - id->generic_id.vtable = &id_vtable; - id->generic_id.fsap_data = id; - id->pool = pool; - - /* Now, we basically just need to "split" this data on `.' - characters. We will use svn_cstring_tokenize, which will put - terminators where each of the '.'s used to be. Then our new - id field will reference string locations inside our duplicate - string.*/ - - /* Node Id */ - str = svn_cstring_tokenize(".", &data); - if (str == NULL) - return NULL; - if (! part_parse(&id->node_id, str)) - return NULL; - - /* Copy Id */ - str = svn_cstring_tokenize(".", &data); - if (str == NULL) - return NULL; - if (! part_parse(&id->copy_id, str)) - return NULL; - - /* NodeRev Id */ - str = svn_cstring_tokenize(".", &data); - if (str == NULL) - return NULL; - - if (! part_parse(&id->noderev_id, str)) - return NULL; - - return (svn_fs_id_t *)id; -} - -svn_error_t * -svn_fs_x__id_parse(const svn_fs_id_t **id_p, - char *data, - apr_pool_t *pool) -{ - svn_fs_id_t *id = id_parse(data, pool); - if (id == NULL) - return svn_error_createf(SVN_ERR_FS_MALFORMED_NODEREV_ID, NULL, - "Malformed node revision ID string"); - - *id_p = id; - - return SVN_NO_ERROR; -} - -/* (de-)serialization support */ - -/* Serialize an ID within the serialization CONTEXT. - */ -void -svn_fs_x__id_serialize(svn_temp_serializer__context_t *context, - const svn_fs_id_t * const *in) -{ - const fs_x__id_t *id = (const fs_x__id_t *)*in; - - /* nothing to do for NULL ids */ - if (id == NULL) - return; - - /* serialize the id data struct itself */ - svn_temp_serializer__add_leaf(context, - (const void * const *)in, - sizeof(fs_x__id_t)); -} - -/* Deserialize an ID inside the BUFFER. - */ -void -svn_fs_x__id_deserialize(void *buffer, - svn_fs_id_t **in_out, - apr_pool_t *pool) -{ - fs_x__id_t *id; - - /* The id maybe all what is in the whole buffer. - * Don't try to fixup the pointer in that case*/ - if (*in_out != buffer) - svn_temp_deserializer__resolve(buffer, (void**)in_out); - - id = (fs_x__id_t *)*in_out; - - /* no id, no sub-structure fixup necessary */ - if (id == NULL) - return; - - /* the stored vtable is bogus at best -> set the right one */ - id->generic_id.vtable = &id_vtable; - id->generic_id.fsap_data = id; - id->pool = pool; -} -
Modified: subversion/branches/svn-auth-x509/subversion/libsvn_fs_x/id.h URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_fs_x/id.h?rev=1652409&r1=1652408&r2=1652409&view=diff ============================================================================== --- subversion/branches/svn-auth-x509/subversion/libsvn_fs_x/id.h (original) +++ subversion/branches/svn-auth-x509/subversion/libsvn_fs_x/id.h Fri Jan 16 14:01:35 2015 @@ -1,4 +1,4 @@ -/* id.h : interface to node ID functions, private to libsvn_fs_x +/* id.h : interface to FSX-internal ID functions * * ==================================================================== * Licensed to the Apache Software Foundation (ASF) under one @@ -45,149 +45,88 @@ typedef apr_int64_t svn_fs_x__change_set /* Return TRUE iff the CHANGE_SET refers to a revision (will return FALSE for SVN_INVALID_REVNUM). */ -svn_boolean_t svn_fs_x__is_revision(svn_fs_x__change_set_t change_set); +svn_boolean_t +svn_fs_x__is_revision(svn_fs_x__change_set_t change_set); /* Return TRUE iff the CHANGE_SET refers to a transaction (will return FALSE for SVN_FS_X__INVALID_TXN_ID). */ -svn_boolean_t svn_fs_x__is_txn(svn_fs_x__change_set_t change_set); +svn_boolean_t +svn_fs_x__is_txn(svn_fs_x__change_set_t change_set); /* Return the revision number that corresponds to CHANGE_SET. Will SVN_INVALID_REVNUM for transactions. */ -svn_revnum_t svn_fs_x__get_revnum(svn_fs_x__change_set_t change_set); +svn_revnum_t +svn_fs_x__get_revnum(svn_fs_x__change_set_t change_set); /* Return the transaction ID that corresponds to CHANGE_SET. Will SVN_FS_X__INVALID_TXN_ID for revisions. */ -apr_int64_t svn_fs_x__get_txn_id(svn_fs_x__change_set_t change_set); +svn_fs_x__txn_id_t +svn_fs_x__get_txn_id(svn_fs_x__change_set_t change_set); /* Convert REVNUM into a change set number */ -svn_fs_x__change_set_t svn_fs_x__change_set_by_rev(svn_revnum_t revnum); +svn_fs_x__change_set_t +svn_fs_x__change_set_by_rev(svn_revnum_t revnum); /* Convert TXN_ID into a change set number */ -svn_fs_x__change_set_t svn_fs_x__change_set_by_txn(apr_int64_t txn_id); +svn_fs_x__change_set_t +svn_fs_x__change_set_by_txn(svn_fs_x__txn_id_t txn_id); -/* A rev node ID in FSX consists of a 3 of sub-IDs ("parts") that consist - * of a creation CHANGE_SET number and some revision-local counter value - * (NUMBER). +/* An ID in FSX consists of a creation CHANGE_SET number and some changeset- + * local counter value (NUMBER). */ -typedef struct svn_fs_x__id_part_t +typedef struct svn_fs_x__id_t { svn_fs_x__change_set_t change_set; apr_uint64_t number; -} svn_fs_x__id_part_t; +} svn_fs_x__id_t; /*** Operations on ID parts. ***/ /* Return TRUE, if both elements of the PART is 0, i.e. this is the default * value if e.g. no copies were made of this node. */ -svn_boolean_t svn_fs_x__id_part_is_root(const svn_fs_x__id_part_t *part); +svn_boolean_t +svn_fs_x__id_is_root(const svn_fs_x__id_t *part); /* Return TRUE, if all element values of *LHS and *RHS match. */ -svn_boolean_t svn_fs_x__id_part_eq(const svn_fs_x__id_part_t *lhs, - const svn_fs_x__id_part_t *rhs); +svn_boolean_t +svn_fs_x__id_eq(const svn_fs_x__id_t *lhs, + const svn_fs_x__id_t *rhs); - -/*** ID accessor functions. ***/ - -/* Get the "node id" portion of ID. */ -const svn_fs_x__id_part_t *svn_fs_x__id_node_id(const svn_fs_id_t *id); - -/* Get the "copy id" portion of ID. */ -const svn_fs_x__id_part_t *svn_fs_x__id_copy_id(const svn_fs_id_t *id); - -/* Get the "txn id" portion of ID, - * or SVN_FS_X__INVALID_TXN_ID if it is a permanent ID. */ -svn_fs_x__txn_id_t svn_fs_x__id_txn_id(const svn_fs_id_t *id); - -/* Get the "noderev id" portion of ID. */ -const svn_fs_x__id_part_t *svn_fs_x__id_noderev_id(const svn_fs_id_t *id); - -/* Get the "rev" portion of ID, or SVN_INVALID_REVNUM if it is a - transaction ID. */ -svn_revnum_t svn_fs_x__id_rev(const svn_fs_id_t *id); - -/* Access the "item" portion of the ID, or 0 if it is a transaction - ID. */ -apr_uint64_t svn_fs_x__id_item(const svn_fs_id_t *id); - -/* Return TRUE, if this is a transaction ID. */ -svn_boolean_t svn_fs_x__id_is_txn(const svn_fs_id_t *id); - -/* Convert ID into string form, allocated in POOL. */ -svn_string_t *svn_fs_x__id_unparse(const svn_fs_id_t *id, - apr_pool_t *pool); +/* Parse the NUL-terminated ID part at DATA and write the result into *PART. + */ +svn_error_t * +svn_fs_x__id_parse(svn_fs_x__id_t *part, + const char *data); -/* Return true if A and B are equal. */ -svn_boolean_t svn_fs_x__id_eq(const svn_fs_id_t *a, - const svn_fs_id_t *b); +/* Convert ID into string form, allocated in RESULT_POOL. */ +svn_string_t * +svn_fs_x__id_unparse(const svn_fs_x__id_t*id, + apr_pool_t *result_pool); -/* Return true if A and B are related. */ -svn_boolean_t svn_fs_x__id_check_related(const svn_fs_id_t *a, - const svn_fs_id_t *b); +/* Set *PART to "unused". */ +void +svn_fs_x__id_reset(svn_fs_x__id_t *part); -/* Return the noderev relationship between A and B. */ -svn_fs_node_relation_t svn_fs_x__id_compare(const svn_fs_id_t *a, - const svn_fs_id_t *b); +/* Return TRUE if *PART is belongs to either a revision or transaction. */ +svn_boolean_t +svn_fs_x__id_used(const svn_fs_x__id_t *part); /* Return 0 if A and B are equal, 1 if A is "greater than" B, -1 otherwise. */ -int svn_fs_x__id_part_compare(const svn_fs_x__id_part_t *a, - const svn_fs_x__id_part_t *b); - -/* Create the txn root ID for transaction TXN_ID. Allocate it in POOL. */ -svn_fs_id_t *svn_fs_x__id_txn_create_root(svn_fs_x__txn_id_t txnnum, - apr_pool_t *pool); - -/* Create the root ID for REVISION. Allocate it in POOL. */ -svn_fs_id_t *svn_fs_x__id_create_root(const svn_revnum_t revision, - apr_pool_t *pool); - -/* Create an ID within a transaction based on NODE_ID, COPY_ID, TXN_ID - and ITEM number, allocated in POOL. */ -svn_fs_id_t *svn_fs_x__id_txn_create(const svn_fs_x__id_part_t *node_id, - const svn_fs_x__id_part_t *copy_id, - svn_fs_x__txn_id_t txn_id, - apr_uint64_t item, - apr_pool_t *pool); - -/* Create a permanent ID based on NODE_ID, COPY_ID and NODEREV_ID, - allocated in POOL. */ -svn_fs_id_t *svn_fs_x__id_create(const svn_fs_x__id_part_t *node_id, - const svn_fs_x__id_part_t *copy_id, - const svn_fs_x__id_part_t *noderev_id, - apr_pool_t *pool); - -/* Return a copy of ID, allocated from POOL. */ -svn_fs_id_t *svn_fs_x__id_copy(const svn_fs_id_t *id, - apr_pool_t *pool); - -/* Return an ID in *ID_P resulting from parsing the string DATA, or an error - if DATA is an invalid ID string. *DATA will be modified / invalidated by - this call. */ -svn_error_t * -svn_fs_x__id_parse(const svn_fs_id_t **id_p, - char *data, - apr_pool_t *pool); - +int +svn_fs_x__id_compare(const svn_fs_x__id_t *a, + const svn_fs_x__id_t *b); -/* (de-)serialization support*/ - -struct svn_temp_serializer__context_t; - -/** - * Serialize an @a id within the serialization @a context. - */ +/* Set *NODEREV_ID to the root node ID of transaction TXN_ID. */ void -svn_fs_x__id_serialize(struct svn_temp_serializer__context_t *context, - const svn_fs_id_t * const *id); +svn_fs_x__init_txn_root(svn_fs_x__id_t *noderev_id, + svn_fs_x__txn_id_t txn_id); -/** - * Deserialize an @a id within the @a buffer and associate it with @a pool. - */ +/* Set *NODEREV_ID to the root node ID of revision REV. */ void -svn_fs_x__id_deserialize(void *buffer, - svn_fs_id_t **id, - apr_pool_t *pool); +svn_fs_x__init_rev_root(svn_fs_x__id_t *noderev_id, + svn_revnum_t rev); #ifdef __cplusplus } Modified: subversion/branches/svn-auth-x509/subversion/libsvn_fs_x/index.c URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_fs_x/index.c?rev=1652409&r1=1652408&r2=1652409&view=diff ============================================================================== --- subversion/branches/svn-auth-x509/subversion/libsvn_fs_x/index.c (original) +++ subversion/branches/svn-auth-x509/subversion/libsvn_fs_x/index.c Fri Jan 16 14:01:35 2015 @@ -234,10 +234,10 @@ stream_error_create(svn_fs_x__packed_num const char *message) { const char *file_name; - apr_off_t offset = 0; + apr_off_t offset; SVN_ERR(svn_io_file_name_get(&file_name, stream->file, stream->pool)); - SVN_ERR(svn_io_file_seek(stream->file, APR_CUR, &offset, stream->pool)); + SVN_ERR(svn_fs_x__get_file_offset(&offset, stream->file, stream->pool)); return svn_error_createf(err, NULL, message, file_name, apr_psprintf(stream->pool, @@ -905,7 +905,7 @@ svn_fs_x__l2p_index_append(svn_checksum_ apr_pool_t * result_pool, apr_pool_t *scratch_pool) { - fs_x_data_t *ffd = fs->fsap_data; + svn_fs_x__data_t *ffd = fs->fsap_data; apr_file_t *proto_index = NULL; svn_stream_t *stream; int i; @@ -1076,7 +1076,7 @@ svn_fs_x__l2p_index_append(svn_checksum_ static svn_revnum_t base_revision(svn_fs_t *fs, svn_revnum_t revision) { - fs_x_data_t *ffd = fs->fsap_data; + svn_fs_x__data_t *ffd = fs->fsap_data; return svn_fs_x__is_packed_rev(fs, revision) ? revision - (revision % ffd->max_files_per_dir) : revision; @@ -1241,7 +1241,7 @@ auto_open_l2p_index(svn_fs_x__revision_f { if (rev_file->l2p_stream == NULL) { - fs_x_data_t *ffd = fs->fsap_data; + svn_fs_x__data_t *ffd = fs->fsap_data; SVN_ERR(svn_fs_x__auto_read_footer(rev_file)); SVN_ERR(packed_stream_open(&rev_file->l2p_stream, @@ -1269,7 +1269,7 @@ get_l2p_header_body(l2p_header_t **heade apr_pool_t *result_pool, apr_pool_t *scratch_pool) { - fs_x_data_t *ffd = fs->fsap_data; + svn_fs_x__data_t *ffd = fs->fsap_data; apr_uint64_t value; apr_size_t i; apr_size_t page, page_count; @@ -1280,7 +1280,7 @@ get_l2p_header_body(l2p_header_t **heade apr_array_header_t *expanded_values = apr_array_make(scratch_pool, 16, sizeof(apr_uint64_t)); - pair_cache_key_t key; + svn_fs_x__pair_cache_key_t key; key.revision = rev_file->start_revision; key.second = rev_file->is_packed; @@ -1397,13 +1397,13 @@ get_l2p_page_info(l2p_page_info_baton_t svn_fs_t *fs, apr_pool_t *scratch_pool) { - fs_x_data_t *ffd = fs->fsap_data; + svn_fs_x__data_t *ffd = fs->fsap_data; l2p_header_t *result; svn_boolean_t is_cached = FALSE; void *dummy = NULL; /* try to find the info in the cache */ - pair_cache_key_t key; + svn_fs_x__pair_cache_key_t key; key.revision = base_revision(fs, baton->revision); key.second = svn_fs_x__is_packed_rev(fs, baton->revision); SVN_ERR(svn_cache__get_partial((void**)&dummy, &is_cached, @@ -1435,11 +1435,11 @@ get_l2p_header(l2p_header_t **header, apr_pool_t *result_pool, apr_pool_t *scratch_pool) { - fs_x_data_t *ffd = fs->fsap_data; + svn_fs_x__data_t *ffd = fs->fsap_data; svn_boolean_t is_cached = FALSE; /* first, try cache lookop */ - pair_cache_key_t key; + svn_fs_x__pair_cache_key_t key; key.revision = rev_file->start_revision; key.second = rev_file->is_packed; SVN_ERR(svn_cache__get((void**)header, &is_cached, ffd->l2p_header_cache, @@ -1556,20 +1556,21 @@ typedef struct l2p_page_baton_t /* Return the rev / pack file offset of the item at BATON->PAGE_OFFSET in * OFFSETS of PAGE and write it to *OFFSET. + * Allocate temporaries in SCRATCH_POOL. */ static svn_error_t * l2p_page_get_offset(l2p_page_baton_t *baton, const l2p_page_t *page, const apr_off_t *offsets, const apr_uint32_t *sub_items, - apr_pool_t *pool) + apr_pool_t *scratch_pool) { /* overflow check */ if (page->entry_count <= baton->page_offset) return svn_error_createf(SVN_ERR_FS_INDEX_OVERFLOW , NULL, _("Item index %s too large in" " revision %ld"), - apr_psprintf(pool, "%" APR_UINT64_T_FMT, + apr_psprintf(scratch_pool, "%" APR_UINT64_T_FMT, baton->item_index), baton->revision); @@ -1667,11 +1668,11 @@ get_l2p_page_table(apr_array_header_t *p svn_revnum_t revision, apr_pool_t *scratch_pool) { - fs_x_data_t *ffd = fs->fsap_data; + svn_fs_x__data_t *ffd = fs->fsap_data; svn_boolean_t is_cached = FALSE; l2p_page_table_baton_t baton; - pair_cache_key_t key; + svn_fs_x__pair_cache_key_t key; key.revision = base_revision(fs, revision); key.second = svn_fs_x__is_packed_rev(fs, revision); @@ -1707,7 +1708,7 @@ prefetch_l2p_pages(svn_boolean_t *end, apr_off_t max_offset, apr_pool_t *scratch_pool) { - fs_x_data_t *ffd = fs->fsap_data; + svn_fs_x__data_t *ffd = fs->fsap_data; int i; apr_pool_t *iterpool; svn_fs_x__page_cache_key_t key = { 0 }; @@ -1794,7 +1795,7 @@ l2p_index_lookup(apr_off_t *offset, apr_uint64_t item_index, apr_pool_t *scratch_pool) { - fs_x_data_t *ffd = fs->fsap_data; + svn_fs_x__data_t *ffd = fs->fsap_data; l2p_page_info_baton_t info_baton; l2p_page_baton_t page_baton; l2p_page_t *page = NULL; @@ -2000,13 +2001,12 @@ svn_fs_x__l2p_get_max_ids(apr_array_head */ svn_fs_x__p2l_entry_t * svn_fs_x__p2l_entry_dup(const svn_fs_x__p2l_entry_t *entry, - apr_pool_t *pool) + apr_pool_t *result_pool) { - svn_fs_x__p2l_entry_t *new_entry = apr_palloc(pool, sizeof(*new_entry)); - *new_entry = *entry; - + svn_fs_x__p2l_entry_t *new_entry = apr_pmemdup(result_pool, entry, + sizeof(*new_entry)); if (new_entry->item_count) - new_entry->items = apr_pmemdup(pool, + new_entry->items = apr_pmemdup(result_pool, entry->items, entry->item_count * sizeof(*entry->items)); @@ -2063,7 +2063,7 @@ svn_fs_x__p2l_proto_index_add_entry(apr_ /* Add sub-items. */ for (i = 0; i < entry->item_count; ++i) { - const svn_fs_x__id_part_t *sub_item = &entry->items[i]; + const svn_fs_x__id_t *sub_item = &entry->items[i]; /* Make sure all signed elements of ENTRY have non-negative values. * @@ -2128,7 +2128,7 @@ read_p2l_sub_items_from_proto_index(apr_ for (i = 0; i < entry->item_count; ++i) { apr_uint64_t revision; - svn_fs_x__id_part_t *sub_item = &entry->items[i]; + svn_fs_x__id_t *sub_item = &entry->items[i]; SVN_ERR(read_uint64_from_proto_index(proto_index, &revision, eof, scratch_pool)); @@ -2204,7 +2204,7 @@ svn_fs_x__p2l_index_append(svn_checksum_ apr_pool_t *result_pool, apr_pool_t *scratch_pool) { - fs_x_data_t *ffd = fs->fsap_data; + svn_fs_x__data_t *ffd = fs->fsap_data; apr_uint64_t page_size = ffd->p2l_page_size; apr_file_t *proto_index = NULL; svn_stream_t *stream; @@ -2392,7 +2392,7 @@ auto_open_p2l_index(svn_fs_x__revision_f { if (rev_file->p2l_stream == NULL) { - fs_x_data_t *ffd = fs->fsap_data; + svn_fs_x__data_t *ffd = fs->fsap_data; SVN_ERR(svn_fs_x__auto_read_footer(rev_file)); SVN_ERR(packed_stream_open(&rev_file->p2l_stream, @@ -2509,7 +2509,7 @@ get_p2l_header(p2l_header_t **header, apr_pool_t *result_pool, apr_pool_t *scratch_pool) { - fs_x_data_t *ffd = fs->fsap_data; + svn_fs_x__data_t *ffd = fs->fsap_data; apr_uint64_t value; apr_size_t i; apr_off_t offset; @@ -2517,7 +2517,7 @@ get_p2l_header(p2l_header_t **header, svn_boolean_t is_cached = FALSE; /* look for the header data in our cache */ - pair_cache_key_t key; + svn_fs_x__pair_cache_key_t key; key.revision = rev_file->start_revision; key.second = rev_file->is_packed; @@ -2595,13 +2595,13 @@ get_p2l_page_info(p2l_page_info_baton_t svn_fs_t *fs, apr_pool_t *scratch_pool) { - fs_x_data_t *ffd = fs->fsap_data; + svn_fs_x__data_t *ffd = fs->fsap_data; p2l_header_t *header; svn_boolean_t is_cached = FALSE; void *dummy = NULL; /* look for the header data in our cache */ - pair_cache_key_t key; + svn_fs_x__pair_cache_key_t key; key.revision = base_revision(fs, baton->revision); key.second = svn_fs_x__is_packed_rev(fs, baton->revision); @@ -2803,7 +2803,7 @@ prefetch_p2l_page(svn_boolean_t *end, apr_off_t min_offset, apr_pool_t *scratch_pool) { - fs_x_data_t *ffd = fs->fsap_data; + svn_fs_x__data_t *ffd = fs->fsap_data; svn_boolean_t already_cached; apr_array_header_t *page; svn_fs_x__page_cache_key_t key = { 0 }; @@ -2954,7 +2954,7 @@ append_p2l_entries(apr_array_header_t *e /* Copy the items of that entries. */ if (entry->item_count) { - const svn_fs_x__id_part_t *items + const svn_fs_x__id_t *items = resolve_ptr ? svn_temp_deserializer__ptr(page_entries->elts, (const void * const *)&entry->items) @@ -3014,7 +3014,7 @@ p2l_index_lookup(apr_array_header_t *ent apr_off_t block_end, apr_pool_t *scratch_pool) { - fs_x_data_t *ffd = fs->fsap_data; + svn_fs_x__data_t *ffd = fs->fsap_data; svn_fs_x__page_cache_key_t key; svn_boolean_t is_cached = FALSE; p2l_page_info_baton_t page_info; @@ -3241,7 +3241,7 @@ get_p2l_entry_from_cached_page(const voi svn_fs_x__p2l_entry_t *result = apr_pmemdup(result_pool, entry, sizeof(*result)); result->items - = (svn_fs_x__id_part_t *)svn_temp_deserializer__ptr(entries->elts, + = (svn_fs_x__id_t *)svn_temp_deserializer__ptr(entries->elts, (const void *const *)&entry->items); return result; } @@ -3280,7 +3280,7 @@ p2l_entry_lookup(svn_fs_x__p2l_entry_t * apr_pool_t *result_pool, apr_pool_t *scratch_pool) { - fs_x_data_t *ffd = fs->fsap_data; + svn_fs_x__data_t *ffd = fs->fsap_data; svn_fs_x__page_cache_key_t key = { 0 }; svn_boolean_t is_cached = FALSE; p2l_page_info_baton_t page_info; @@ -3338,7 +3338,7 @@ typedef struct p2l_item_lookup_baton_t } p2l_item_lookup_baton_t; /* Implements svn_cache__partial_getter_func_t for P2L index pages, copying - * the svn_fs_x__id_part_t for the item described 2l_item_lookup_baton_t + * the svn_fs_x__id_t for the item described 2l_item_lookup_baton_t * *BATON. *OUT will be NULL if there is no matching index entry or the * sub-item is out of range. */ @@ -3366,7 +3366,7 @@ p2l_item_lookup_func(void **out, } svn_error_t * -svn_fs_x__p2l_item_lookup(svn_fs_x__id_part_t **item, +svn_fs_x__p2l_item_lookup(svn_fs_x__id_t **item, svn_fs_t *fs, svn_fs_x__revision_file_t *rev_file, svn_revnum_t revision, @@ -3375,7 +3375,7 @@ svn_fs_x__p2l_item_lookup(svn_fs_x__id_p apr_pool_t *result_pool, apr_pool_t *scratch_pool) { - fs_x_data_t *ffd = fs->fsap_data; + svn_fs_x__data_t *ffd = fs->fsap_data; svn_fs_x__page_cache_key_t key = { 0 }; svn_boolean_t is_cached = FALSE; p2l_page_info_baton_t page_info; @@ -3432,13 +3432,13 @@ svn_fs_x__p2l_get_max_offset(apr_off_t * svn_revnum_t revision, apr_pool_t *scratch_pool) { - fs_x_data_t *ffd = fs->fsap_data; + svn_fs_x__data_t *ffd = fs->fsap_data; p2l_header_t *header; svn_boolean_t is_cached = FALSE; apr_off_t *offset_p; /* look for the header data in our cache */ - pair_cache_key_t key; + svn_fs_x__pair_cache_key_t key; key.revision = base_revision(fs, revision); key.second = svn_fs_x__is_packed_rev(fs, revision); @@ -3464,7 +3464,7 @@ svn_fs_x__item_offset(apr_off_t *absolut apr_uint32_t *sub_item, svn_fs_t *fs, svn_fs_x__revision_file_t *rev_file, - const svn_fs_x__id_part_t *item_id, + const svn_fs_x__id_t *item_id, apr_pool_t *scratch_pool) { if (svn_fs_x__is_txn(item_id->change_set)) @@ -3583,15 +3583,15 @@ typedef struct sub_item_ordered_t /* Array of pointers into ENTRY->ITEMS, sorted by their revision member * _descending_ order. May be NULL if ENTRY->ITEM_COUNT < 2. */ - svn_fs_x__id_part_t **order; + svn_fs_x__id_t **order; } sub_item_ordered_t; /* implements compare_fn_t. Place LHS before RHS, if the latter is younger. * Used to sort sub_item_ordered_t::order */ static int -compare_sub_items(const svn_fs_x__id_part_t * const * lhs, - const svn_fs_x__id_part_t * const * rhs) +compare_sub_items(const svn_fs_x__id_t * const * lhs, + const svn_fs_x__id_t * const * rhs) { return (*lhs)->change_set < (*rhs)->change_set ? 1 @@ -3605,8 +3605,8 @@ static int compare_p2l_info_rev(const sub_item_ordered_t * lhs, const sub_item_ordered_t * rhs) { - svn_fs_x__id_part_t *lhs_part; - svn_fs_x__id_part_t *rhs_part; + svn_fs_x__id_t *lhs_part; + svn_fs_x__id_t *rhs_part; assert(lhs != rhs); if (lhs->entry->item_count == 0) @@ -3697,7 +3697,7 @@ svn_fs_x__l2p_index_from_p2l_entries(con /* write index entries */ for (i = 0; i < count; ++i) { - svn_fs_x__id_part_t *sub_item; + svn_fs_x__id_t *sub_item; sub_item_ordered_t *ordered = svn_priority_queue__peek(queue); if (ordered->entry->item_count > 0) Modified: subversion/branches/svn-auth-x509/subversion/libsvn_fs_x/index.h URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_fs_x/index.h?rev=1652409&r1=1652408&r2=1652409&view=diff ============================================================================== --- subversion/branches/svn-auth-x509/subversion/libsvn_fs_x/index.h (original) +++ subversion/branches/svn-auth-x509/subversion/libsvn_fs_x/index.h Fri Jan 16 14:01:35 2015 @@ -77,14 +77,14 @@ typedef struct svn_fs_x__p2l_entry_t apr_uint32_t item_count; /* List of items in that block / container */ - svn_fs_x__id_part_t *items; + svn_fs_x__id_t *items; } svn_fs_x__p2l_entry_t; -/* Return a (deep) copy of ENTRY, allocated in POOL. +/* Return a (deep) copy of ENTRY, allocated in RESULT_POOL. */ svn_fs_x__p2l_entry_t * svn_fs_x__p2l_entry_dup(const svn_fs_x__p2l_entry_t *entry, - apr_pool_t *pool); + apr_pool_t *result_pool); /* Open / create a log-to-phys index file with the full file path name * FILE_NAME. Return the open file in *PROTO_INDEX allocated in @@ -220,7 +220,7 @@ svn_fs_x__p2l_entry_lookup(svn_fs_x__p2l apr_pool_t *result_pool, apr_pool_t *scratch_pool); -/* Use the phys-to-log mapping files in FS to return the svn_fs_x__id_part_t +/* Use the phys-to-log mapping files in FS to return the svn_fs_x__id_t * for the SUB_ITEM of the container starting at global OFFSET in the rep / * pack file containing REVISION in *ITEM, allocated in RESULT_POOL. Sets * *ITEM to NULL if no element starts at exactly that offset or if it @@ -229,7 +229,7 @@ svn_fs_x__p2l_entry_lookup(svn_fs_x__p2l * Use SCRATCH_POOL for temporary allocations. */ svn_error_t * -svn_fs_x__p2l_item_lookup(svn_fs_x__id_part_t **item, +svn_fs_x__p2l_item_lookup(svn_fs_x__id_t **item, svn_fs_t *fs, svn_fs_x__revision_file_t *rev_file, svn_revnum_t revision, @@ -254,7 +254,7 @@ svn_fs_x__item_offset(apr_off_t *absolut apr_uint32_t *sub_item, svn_fs_t *fs, svn_fs_x__revision_file_t *rev_file, - const svn_fs_x__id_part_t *item_id, + const svn_fs_x__id_t *item_id, apr_pool_t *scratch_pool); /* Use the log-to-phys indexes in FS to determine the maximum item indexes Modified: subversion/branches/svn-auth-x509/subversion/libsvn_fs_x/lock.c URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_fs_x/lock.c?rev=1652409&r1=1652408&r2=1652409&view=diff ============================================================================== --- subversion/branches/svn-auth-x509/subversion/libsvn_fs_x/lock.c (original) +++ subversion/branches/svn-auth-x509/subversion/libsvn_fs_x/lock.c Fri Jan 16 14:01:35 2015 @@ -37,6 +37,7 @@ #include "tree.h" #include "fs_x.h" #include "transaction.h" +#include "util.h" #include "../libsvn_fs/fs-loader.h" #include "private/svn_fs_util.h" @@ -161,7 +162,7 @@ digest_path_from_path(const char **diges empty, if the versioned path in FS represented by DIGEST_PATH has no children) and LOCK (which may be NULL if that versioned path is lock itself locked). Set the permissions of DIGEST_PATH to those of - PERMS_REFERENCE. Use POOL for all allocations. + PERMS_REFERENCE. Use POOL for temporary allocations. */ static svn_error_t * write_digest_file(apr_hash_t *children, @@ -169,45 +170,53 @@ write_digest_file(apr_hash_t *children, const char *fs_path, const char *digest_path, const char *perms_reference, - apr_pool_t *pool) + apr_pool_t *scratch_pool) { svn_error_t *err = SVN_NO_ERROR; svn_stream_t *stream; apr_hash_index_t *hi; - apr_hash_t *hash = apr_hash_make(pool); + apr_hash_t *hash = apr_hash_make(scratch_pool); const char *tmp_path; SVN_ERR(svn_fs_x__ensure_dir_exists(svn_dirent_join(fs_path, PATH_LOCKS_DIR, - pool), fs_path, pool)); - SVN_ERR(svn_fs_x__ensure_dir_exists(svn_dirent_dirname(digest_path, pool), - fs_path, pool)); + scratch_pool), + fs_path, scratch_pool)); + SVN_ERR(svn_fs_x__ensure_dir_exists(svn_dirent_dirname(digest_path, + scratch_pool), + fs_path, scratch_pool)); if (lock) { const char *creation_date = NULL, *expiration_date = NULL; if (lock->creation_date) - creation_date = svn_time_to_cstring(lock->creation_date, pool); + creation_date = svn_time_to_cstring(lock->creation_date, + scratch_pool); if (lock->expiration_date) - expiration_date = svn_time_to_cstring(lock->expiration_date, pool); + expiration_date = svn_time_to_cstring(lock->expiration_date, + scratch_pool); + hash_store(hash, PATH_KEY, sizeof(PATH_KEY)-1, - lock->path, APR_HASH_KEY_STRING, pool); + lock->path, APR_HASH_KEY_STRING, scratch_pool); hash_store(hash, TOKEN_KEY, sizeof(TOKEN_KEY)-1, - lock->token, APR_HASH_KEY_STRING, pool); + lock->token, APR_HASH_KEY_STRING, scratch_pool); hash_store(hash, OWNER_KEY, sizeof(OWNER_KEY)-1, - lock->owner, APR_HASH_KEY_STRING, pool); + lock->owner, APR_HASH_KEY_STRING, scratch_pool); hash_store(hash, COMMENT_KEY, sizeof(COMMENT_KEY)-1, - lock->comment, APR_HASH_KEY_STRING, pool); + lock->comment, APR_HASH_KEY_STRING, scratch_pool); hash_store(hash, IS_DAV_COMMENT_KEY, sizeof(IS_DAV_COMMENT_KEY)-1, - lock->is_dav_comment ? "1" : "0", 1, pool); + lock->is_dav_comment ? "1" : "0", 1, scratch_pool); hash_store(hash, CREATION_DATE_KEY, sizeof(CREATION_DATE_KEY)-1, - creation_date, APR_HASH_KEY_STRING, pool); + creation_date, APR_HASH_KEY_STRING, scratch_pool); hash_store(hash, EXPIRATION_DATE_KEY, sizeof(EXPIRATION_DATE_KEY)-1, - expiration_date, APR_HASH_KEY_STRING, pool); + expiration_date, APR_HASH_KEY_STRING, scratch_pool); } if (apr_hash_count(children)) { - svn_stringbuf_t *children_list = svn_stringbuf_create_empty(pool); - for (hi = apr_hash_first(pool, children); hi; hi = apr_hash_next(hi)) + svn_stringbuf_t *children_list + = svn_stringbuf_create_empty(scratch_pool); + for (hi = apr_hash_first(scratch_pool, children); + hi; + hi = apr_hash_next(hi)) { svn_stringbuf_appendbytes(children_list, apr_hash_this_key(hi), @@ -215,24 +224,28 @@ write_digest_file(apr_hash_t *children, svn_stringbuf_appendbyte(children_list, '\n'); } hash_store(hash, CHILDREN_KEY, sizeof(CHILDREN_KEY)-1, - children_list->data, children_list->len, pool); + children_list->data, children_list->len, scratch_pool); } SVN_ERR(svn_stream_open_unique(&stream, &tmp_path, - svn_dirent_dirname(digest_path, pool), - svn_io_file_del_none, pool, pool)); - if ((err = svn_hash_write2(hash, stream, SVN_HASH_TERMINATOR, pool))) + svn_dirent_dirname(digest_path, + scratch_pool), + svn_io_file_del_none, scratch_pool, + scratch_pool)); + if ((err = svn_hash_write2(hash, stream, SVN_HASH_TERMINATOR, + scratch_pool))) { svn_error_clear(svn_stream_close(stream)); return svn_error_createf(err->apr_err, err, _("Cannot write lock/entries hashfile '%s'"), - svn_dirent_local_style(tmp_path, pool)); + svn_dirent_local_style(tmp_path, + scratch_pool)); } SVN_ERR(svn_stream_close(stream)); - SVN_ERR(svn_io_file_rename(tmp_path, digest_path, pool)); - SVN_ERR(svn_io_copy_perms(perms_reference, digest_path, pool)); + SVN_ERR(svn_io_file_rename(tmp_path, digest_path, scratch_pool)); + SVN_ERR(svn_io_copy_perms(perms_reference, digest_path, scratch_pool)); return SVN_NO_ERROR; } @@ -345,19 +358,21 @@ static svn_error_t * set_lock(const char *fs_path, svn_lock_t *lock, const char *perms_reference, - apr_pool_t *pool) + apr_pool_t *scratch_pool) { const char *digest_path; apr_hash_t *children; - SVN_ERR(digest_path_from_path(&digest_path, fs_path, lock->path, pool)); + SVN_ERR(digest_path_from_path(&digest_path, fs_path, lock->path, + scratch_pool)); /* We could get away without reading the file as children should always come back empty. */ - SVN_ERR(read_digest_file(&children, NULL, fs_path, digest_path, pool)); + SVN_ERR(read_digest_file(&children, NULL, fs_path, digest_path, + scratch_pool)); SVN_ERR(write_digest_file(children, lock, fs_path, digest_path, - perms_reference, pool)); + perms_reference, scratch_pool)); return SVN_NO_ERROR; } @@ -365,13 +380,13 @@ set_lock(const char *fs_path, static svn_error_t * delete_lock(const char *fs_path, const char *path, - apr_pool_t *pool) + apr_pool_t *scratch_pool) { const char *digest_path; - SVN_ERR(digest_path_from_path(&digest_path, fs_path, path, pool)); + SVN_ERR(digest_path_from_path(&digest_path, fs_path, path, scratch_pool)); - SVN_ERR(svn_io_remove_file2(digest_path, TRUE, pool)); + SVN_ERR(svn_io_remove_file2(digest_path, TRUE, scratch_pool)); return SVN_NO_ERROR; } @@ -381,7 +396,7 @@ add_to_digest(const char *fs_path, apr_array_header_t *paths, const char *index_path, const char *perms_reference, - apr_pool_t *pool) + apr_pool_t *scratch_pool) { const char *index_digest_path; apr_hash_t *children; @@ -389,9 +404,10 @@ add_to_digest(const char *fs_path, int i; unsigned int original_count; - SVN_ERR(digest_path_from_path(&index_digest_path, fs_path, index_path, pool)); - - SVN_ERR(read_digest_file(&children, &lock, fs_path, index_digest_path, pool)); + SVN_ERR(digest_path_from_path(&index_digest_path, fs_path, index_path, + scratch_pool)); + SVN_ERR(read_digest_file(&children, &lock, fs_path, index_digest_path, + scratch_pool)); original_count = apr_hash_count(children); @@ -400,14 +416,15 @@ add_to_digest(const char *fs_path, const char *path = APR_ARRAY_IDX(paths, i, const char *); const char *digest_path, *digest_file; - SVN_ERR(digest_path_from_path(&digest_path, fs_path, path, pool)); + SVN_ERR(digest_path_from_path(&digest_path, fs_path, path, + scratch_pool)); digest_file = svn_dirent_basename(digest_path, NULL); svn_hash_sets(children, digest_file, (void *)1); } if (apr_hash_count(children) != original_count) SVN_ERR(write_digest_file(children, lock, fs_path, index_digest_path, - perms_reference, pool)); + perms_reference, scratch_pool)); return SVN_NO_ERROR; } @@ -417,32 +434,34 @@ delete_from_digest(const char *fs_path, apr_array_header_t *paths, const char *index_path, const char *perms_reference, - apr_pool_t *pool) + apr_pool_t *scratch_pool) { const char *index_digest_path; apr_hash_t *children; svn_lock_t *lock; int i; - SVN_ERR(digest_path_from_path(&index_digest_path, fs_path, index_path, pool)); - - SVN_ERR(read_digest_file(&children, &lock, fs_path, index_digest_path, pool)); + SVN_ERR(digest_path_from_path(&index_digest_path, fs_path, index_path, + scratch_pool)); + SVN_ERR(read_digest_file(&children, &lock, fs_path, index_digest_path, + scratch_pool)); for (i = 0; i < paths->nelts; ++i) { const char *path = APR_ARRAY_IDX(paths, i, const char *); const char *digest_path, *digest_file; - SVN_ERR(digest_path_from_path(&digest_path, fs_path, path, pool)); + SVN_ERR(digest_path_from_path(&digest_path, fs_path, path, + scratch_pool)); digest_file = svn_dirent_basename(digest_path, NULL); svn_hash_sets(children, digest_file, NULL); } if (apr_hash_count(children) || lock) SVN_ERR(write_digest_file(children, lock, fs_path, index_digest_path, - perms_reference, pool)); + perms_reference, scratch_pool)); else - SVN_ERR(svn_io_remove_file2(index_digest_path, TRUE, pool)); + SVN_ERR(svn_io_remove_file2(index_digest_path, TRUE, scratch_pool)); return SVN_NO_ERROR; } @@ -694,24 +713,26 @@ svn_fs_x__allow_locked_operation(const c svn_fs_t *fs, svn_boolean_t recurse, svn_boolean_t have_write_lock, - apr_pool_t *pool) + apr_pool_t *scratch_pool) { - path = svn_fs__canonicalize_abspath(path, pool); + path = svn_fs__canonicalize_abspath(path, scratch_pool); if (recurse) { /* Discover all locks at or below the path. */ const char *digest_path; - SVN_ERR(digest_path_from_path(&digest_path, fs->path, path, pool)); + SVN_ERR(digest_path_from_path(&digest_path, fs->path, path, + scratch_pool)); SVN_ERR(walk_locks(fs, digest_path, get_locks_callback, - fs, have_write_lock, pool)); + fs, have_write_lock, scratch_pool)); } else { /* Discover and verify any lock attached to the path. */ svn_lock_t *lock; - SVN_ERR(get_lock_helper(fs, &lock, path, have_write_lock, pool)); + SVN_ERR(get_lock_helper(fs, &lock, path, have_write_lock, + scratch_pool)); if (lock) - SVN_ERR(verify_lock(fs, lock, pool)); + SVN_ERR(verify_lock(fs, lock, scratch_pool)); } return SVN_NO_ERROR; } @@ -1168,11 +1189,11 @@ unlock_body(void *baton, apr_pool_t *poo static svn_error_t * unlock_single(svn_fs_t *fs, svn_lock_t *lock, - apr_pool_t *pool) + apr_pool_t *scratch_pool) { struct unlock_baton ub; svn_sort__item_t item; - apr_array_header_t *targets = apr_array_make(pool, 1, + apr_array_header_t *targets = apr_array_make(scratch_pool, 1, sizeof(svn_sort__item_t)); item.key = lock->path; item.klen = strlen(item.key); @@ -1182,10 +1203,10 @@ unlock_single(svn_fs_t *fs, ub.fs = fs; ub.targets = targets; ub.skip_check = TRUE; - ub.result_pool = pool; + ub.result_pool = scratch_pool; /* No ub.infos[].fs_err error because skip_check is TRUE. */ - SVN_ERR(unlock_body(&ub, pool)); + SVN_ERR(unlock_body(&ub, scratch_pool)); return SVN_NO_ERROR; } @@ -1434,13 +1455,13 @@ svn_fs_x__get_locks(svn_fs_t *fs, svn_depth_t depth, svn_fs_get_locks_callback_t get_locks_func, void *get_locks_baton, - apr_pool_t *pool) + apr_pool_t *scratch_pool) { const char *digest_path; get_locks_filter_baton_t glfb; SVN_ERR(svn_fs__check_fs(fs, TRUE)); - path = svn_fs__canonicalize_abspath(path, pool); + path = svn_fs__canonicalize_abspath(path, scratch_pool); glfb.path = path; glfb.requested_depth = depth; @@ -1448,8 +1469,8 @@ svn_fs_x__get_locks(svn_fs_t *fs, glfb.get_locks_baton = get_locks_baton; /* Get the top digest path in our tree of interest, and then walk it. */ - SVN_ERR(digest_path_from_path(&digest_path, fs->path, path, pool)); + SVN_ERR(digest_path_from_path(&digest_path, fs->path, path, scratch_pool)); SVN_ERR(walk_locks(fs, digest_path, get_locks_filter_func, &glfb, - FALSE, pool)); + FALSE, scratch_pool)); return SVN_NO_ERROR; } Modified: subversion/branches/svn-auth-x509/subversion/libsvn_fs_x/lock.h URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_fs_x/lock.h?rev=1652409&r1=1652408&r2=1652409&view=diff ============================================================================== --- subversion/branches/svn-auth-x509/subversion/libsvn_fs_x/lock.h (original) +++ subversion/branches/svn-auth-x509/subversion/libsvn_fs_x/lock.h Fri Jan 16 14:01:35 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/svn-auth-x509/subversion/libsvn_fs_x/low_level.c URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_fs_x/low_level.c?rev=1652409&r1=1652408&r2=1652409&view=diff ============================================================================== --- subversion/branches/svn-auth-x509/subversion/libsvn_fs_x/low_level.c (original) +++ subversion/branches/svn-auth-x509/subversion/libsvn_fs_x/low_level.c Fri Jan 16 14:01:35 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/svn-auth-x509/subversion/libsvn_fs_x/low_level.h URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/libsvn_fs_x/low_level.h?rev=1652409&r1=1652408&r2=1652409&view=diff ============================================================================== --- subversion/branches/svn-auth-x509/subversion/libsvn_fs_x/low_level.h (original) +++ subversion/branches/svn-auth-x509/subversion/libsvn_fs_x/low_level.h Fri Jan 16 14:01:35 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.
