You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by cm...@apache.org on 2013/05/10 16:58:56 UTC
svn commit: r1481041 [12/38] - in /subversion/branches/master-passphrase: ./
build/ build/ac-macros/ build/generator/ build/generator/templates/
contrib/client-side/svncopy/ contrib/hook-scripts/
contrib/server-side/fsfsfixer/ contrib/server-side/fsfsf...
Modified: subversion/branches/master-passphrase/subversion/libsvn_fs/fs-loader.h
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/libsvn_fs/fs-loader.h?rev=1481041&r1=1481040&r2=1481041&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/libsvn_fs/fs-loader.h (original)
+++ subversion/branches/master-passphrase/subversion/libsvn_fs/fs-loader.h Fri May 10 14:58:47 2013
@@ -124,6 +124,16 @@ typedef struct fs_library_vtable_t
into the FS vtable. */
svn_fs_id_t *(*parse_id)(const char *data, apr_size_t len,
apr_pool_t *pool);
+ /* Allow an FSAP to call svn_fs_open(), which is in a higher-level library
+ (libsvn_fs-1.so) and cannot easily be moved to libsvn_fs_util. */
+ svn_error_t *(*set_svn_fs_open)(svn_fs_t *fs,
+ svn_error_t *(*svn_fs_open_)(svn_fs_t **,
+ const char *,
+ apr_hash_t *,
+ apr_pool_t *));
+ /* For svn_fs_info_fsfs_dup(). */
+ void *(*info_fsap_dup)(const void *fsap_info,
+ apr_pool_t *result_pool);
} fs_library_vtable_t;
/* This is the type of symbol an FS module defines to fetch the
@@ -204,12 +214,25 @@ typedef struct fs_vtable_t
svn_fs_get_locks_callback_t get_locks_func,
void *get_locks_baton,
apr_pool_t *pool);
- svn_error_t *(*verify_rev)(svn_fs_t *fs,
- svn_revnum_t revision,
- apr_pool_t *pool);
+ svn_error_t *(*info_format)(int *fs_format,
+ svn_version_t **supports_version,
+ svn_fs_t *fs,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool);
+ svn_error_t *(*info_config_files)(apr_array_header_t **files,
+ svn_fs_t *fs,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool);
+ svn_error_t *(*info_fsap)(const void **fsap_info,
+ svn_fs_t *fs,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool);
+ /* info_fsap_dup is in the library vtable. */
+ svn_error_t *(*verify_root)(svn_fs_root_t *root,
+ apr_pool_t *pool);
svn_error_t *(*freeze)(svn_fs_t *fs,
- svn_error_t *(*freeze_body)(void *, apr_pool_t *),
- void *baton, apr_pool_t *pool);
+ svn_fs_freeze_func_t freeze_func,
+ void *freeze_baton, apr_pool_t *pool);
svn_error_t *(*bdb_set_errcall)(svn_fs_t *fs,
void (*handler)(const char *errpfx,
char *msg));
Modified: subversion/branches/master-passphrase/subversion/libsvn_fs_base/bdb/changes-table.c
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/libsvn_fs_base/bdb/changes-table.c?rev=1481041&r1=1481040&r2=1481041&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/libsvn_fs_base/bdb/changes-table.c (original)
+++ subversion/branches/master-passphrase/subversion/libsvn_fs_base/bdb/changes-table.c Fri May 10 14:58:47 2013
@@ -25,6 +25,7 @@
#include <apr_hash.h>
#include <apr_tables.h>
+#include "svn_hash.h"
#include "svn_fs.h"
#include "svn_pools.h"
#include "svn_path.h"
@@ -132,7 +133,7 @@ fold_change(apr_hash_t *changes,
svn_fs_path_change2_t *old_change, *new_change;
const char *path;
- if ((old_change = apr_hash_get(changes, change->path, APR_HASH_KEY_STRING)))
+ if ((old_change = svn_hash_gets(changes, change->path)))
{
/* This path already exists in the hash, so we have to merge
this change into the already existing one. */
@@ -244,7 +245,7 @@ fold_change(apr_hash_t *changes,
}
/* Add (or update) this path. */
- apr_hash_set(changes, path, APR_HASH_KEY_STRING, new_change);
+ svn_hash_sets(changes, path, new_change);
return SVN_NO_ERROR;
}
Modified: subversion/branches/master-passphrase/subversion/libsvn_fs_base/bdb/env.c
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/libsvn_fs_base/bdb/env.c?rev=1481041&r1=1481040&r2=1481041&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/libsvn_fs_base/bdb/env.c (original)
+++ subversion/branches/master-passphrase/subversion/libsvn_fs_base/bdb/env.c Fri May 10 14:58:47 2013
@@ -31,6 +31,7 @@
#include <apr_strings.h>
#include <apr_hash.h>
+#include "svn_hash.h"
#include "svn_path.h"
#include "svn_pools.h"
#include "svn_utf.h"
Modified: subversion/branches/master-passphrase/subversion/libsvn_fs_base/dag.c
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/libsvn_fs_base/dag.c?rev=1481041&r1=1481040&r2=1481041&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/libsvn_fs_base/dag.c (original)
+++ subversion/branches/master-passphrase/subversion/libsvn_fs_base/dag.c Fri May 10 14:58:47 2013
@@ -350,7 +350,7 @@ dir_entry_id_from_node(const svn_fs_id_t
SVN_ERR(svn_fs_base__dag_dir_entries(&entries, parent, trail, pool));
if (entries)
- dirent = apr_hash_get(entries, name, APR_HASH_KEY_STRING);
+ dirent = svn_hash_gets(entries, name);
else
dirent = NULL;
@@ -421,7 +421,7 @@ set_entry(dag_node_t *parent,
entries = apr_hash_make(pool);
/* Now, add our new entry to the entries list. */
- apr_hash_set(entries, name, APR_HASH_KEY_STRING, id);
+ svn_hash_sets(entries, name, id);
/* Finally, replace the old entries list with the new one. */
SVN_ERR(svn_fs_base__unparse_entries_skel(&entries_skel, entries,
@@ -910,7 +910,7 @@ svn_fs_base__dag_delete(dag_node_t *pare
/* Find NAME in the ENTRIES skel. */
if (entries)
- id = apr_hash_get(entries, name, APR_HASH_KEY_STRING);
+ id = svn_hash_gets(entries, name);
/* If we never found ID in ENTRIES (perhaps because there are no
ENTRIES, perhaps because ID just isn't in the existing ENTRIES
@@ -929,7 +929,7 @@ svn_fs_base__dag_delete(dag_node_t *pare
trail, pool));
/* Remove this entry from its parent's entries list. */
- apr_hash_set(entries, name, APR_HASH_KEY_STRING, NULL);
+ svn_hash_sets(entries, name, NULL);
/* Replace the old entries list with the new one. */
{
@@ -1593,12 +1593,11 @@ svn_fs_base__dag_commit_txn(svn_revnum_t
*new_rev = SVN_INVALID_REVNUM;
SVN_ERR(svn_fs_bdb__put_rev(new_rev, fs, &revision, trail, pool));
- if (apr_hash_get(txnprops, SVN_FS__PROP_TXN_CHECK_OOD, APR_HASH_KEY_STRING))
+ if (svn_hash_gets(txnprops, SVN_FS__PROP_TXN_CHECK_OOD))
SVN_ERR(svn_fs_base__set_txn_prop
(fs, txn_id, SVN_FS__PROP_TXN_CHECK_OOD, NULL, trail, pool));
- if (apr_hash_get(txnprops, SVN_FS__PROP_TXN_CHECK_LOCKS,
- APR_HASH_KEY_STRING))
+ if (svn_hash_gets(txnprops, SVN_FS__PROP_TXN_CHECK_LOCKS))
SVN_ERR(svn_fs_base__set_txn_prop
(fs, txn_id, SVN_FS__PROP_TXN_CHECK_LOCKS, NULL, trail, pool));
Modified: subversion/branches/master-passphrase/subversion/libsvn_fs_base/fs.c
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/libsvn_fs_base/fs.c?rev=1481041&r1=1481040&r2=1481041&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/libsvn_fs_base/fs.c (original)
+++ subversion/branches/master-passphrase/subversion/libsvn_fs_base/fs.c Fri May 10 14:58:47 2013
@@ -28,6 +28,7 @@
#include <apr_pools.h>
#include <apr_file_io.h>
+#include "svn_hash.h"
#include "svn_pools.h"
#include "svn_fs.h"
#include "svn_path.h"
@@ -446,9 +447,7 @@ bdb_write_config(svn_fs_t *fs)
if (fs->config)
{
- value = apr_hash_get(fs->config,
- dbconfig_options[i].config_key,
- APR_HASH_KEY_STRING);
+ value = svn_hash_gets(fs->config, dbconfig_options[i].config_key);
}
SVN_ERR(svn_io_file_write_full(dbconfig_file,
@@ -472,9 +471,61 @@ bdb_write_config(svn_fs_t *fs)
}
static svn_error_t *
-base_bdb_verify_rev(svn_fs_t *fs,
- svn_revnum_t revision,
- apr_pool_t *scratch_pool)
+base_bdb_info_format(int *fs_format,
+ svn_version_t **supports_version,
+ svn_fs_t *fs,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
+{
+ base_fs_data_t *bfd = fs->fsap_data;
+
+ *fs_format = bfd->format;
+ *supports_version = apr_palloc(result_pool, sizeof(svn_version_t));
+
+ (*supports_version)->major = SVN_VER_MAJOR;
+ (*supports_version)->minor = 0;
+ (*supports_version)->patch = 0;
+ (*supports_version)->tag = "";
+
+ switch (bfd->format)
+ {
+ case 1:
+ break;
+ case 2:
+ (*supports_version)->minor = 4;
+ break;
+ case 3:
+ (*supports_version)->minor = 5;
+ break;
+ case 4:
+ (*supports_version)->minor = 6;
+ break;
+#ifdef SVN_DEBUG
+# if SVN_FS_BASE__FORMAT_NUMBER != 4
+# error "Need to add a 'case' statement here"
+# endif
+#endif
+ }
+
+ return SVN_NO_ERROR;
+}
+
+static svn_error_t *
+base_bdb_info_config_files(apr_array_header_t **files,
+ svn_fs_t *fs,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
+{
+ *files = apr_array_make(result_pool, 1, sizeof(const char *));
+ APR_ARRAY_PUSH(*files, const char *) = svn_dirent_join(fs->path,
+ BDB_CONFIG_FILE,
+ result_pool);
+ return SVN_NO_ERROR;
+}
+
+static svn_error_t *
+base_bdb_verify_root(svn_fs_root_t *root,
+ apr_pool_t *scratch_pool)
{
/* Verifying is currently a no op for BDB. */
return SVN_NO_ERROR;
@@ -482,8 +533,8 @@ base_bdb_verify_rev(svn_fs_t *fs,
static svn_error_t *
base_bdb_freeze(svn_fs_t *fs,
- svn_error_t *(*freeze_body)(void *, apr_pool_t *),
- void *baton,
+ svn_fs_freeze_func_t freeze_func,
+ void *freeze_baton,
apr_pool_t *pool)
{
SVN__NOT_IMPLEMENTED();
@@ -509,7 +560,10 @@ static fs_vtable_t fs_vtable = {
svn_fs_base__unlock,
svn_fs_base__get_lock,
svn_fs_base__get_locks,
- base_bdb_verify_rev,
+ base_bdb_info_format,
+ base_bdb_info_config_files,
+ NULL /* info_fsap */,
+ base_bdb_verify_root,
base_bdb_freeze,
base_bdb_set_errcall,
};
@@ -665,7 +719,7 @@ open_databases(svn_fs_t *fs,
}
-/* Called by functions that initialize an svn_fs_t struct, after that
+/* Called by functions that initialize an svn_fs_t struct, after that
initialization is done, to populate svn_fs_t->uuid. */
static svn_error_t *
populate_opened_fs(svn_fs_t *fs, apr_pool_t *scratch_pool)
@@ -684,14 +738,11 @@ base_create(svn_fs_t *fs, const char *pa
/* See if compatibility with older versions was explicitly requested. */
if (fs->config)
{
- if (apr_hash_get(fs->config, SVN_FS_CONFIG_PRE_1_4_COMPATIBLE,
- APR_HASH_KEY_STRING))
+ if (svn_hash_gets(fs->config, SVN_FS_CONFIG_PRE_1_4_COMPATIBLE))
format = 1;
- else if (apr_hash_get(fs->config, SVN_FS_CONFIG_PRE_1_5_COMPATIBLE,
- APR_HASH_KEY_STRING))
+ else if (svn_hash_gets(fs->config, SVN_FS_CONFIG_PRE_1_5_COMPATIBLE))
format = 2;
- else if (apr_hash_get(fs->config, SVN_FS_CONFIG_PRE_1_6_COMPATIBLE,
- APR_HASH_KEY_STRING))
+ else if (svn_hash_gets(fs->config, SVN_FS_CONFIG_PRE_1_6_COMPATIBLE))
format = 3;
}
@@ -1386,6 +1437,15 @@ base_get_description(void)
return _("Module for working with a Berkeley DB repository.");
}
+static svn_error_t *
+base_set_svn_fs_open(svn_fs_t *fs,
+ svn_error_t *(*svn_fs_open_)(svn_fs_t **,
+ const char *,
+ apr_hash_t *,
+ apr_pool_t *))
+{
+ return SVN_NO_ERROR;
+}
/* Base FS library vtable, used by the FS loader library. */
@@ -1402,7 +1462,9 @@ static fs_library_vtable_t library_vtabl
base_bdb_recover,
base_bdb_pack,
base_bdb_logfiles,
- svn_fs_base__id_parse
+ svn_fs_base__id_parse,
+ base_set_svn_fs_open,
+ NULL /* info_fsap_dup */
};
svn_error_t *
Modified: subversion/branches/master-passphrase/subversion/libsvn_fs_base/lock.c
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/libsvn_fs_base/lock.c?rev=1481041&r1=1481040&r2=1481041&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/libsvn_fs_base/lock.c (original)
+++ subversion/branches/master-passphrase/subversion/libsvn_fs_base/lock.c Fri May 10 14:58:47 2013
@@ -21,6 +21,7 @@
*/
+#include "svn_hash.h"
#include "svn_pools.h"
#include "svn_error.h"
#include "svn_fs.h"
@@ -37,6 +38,7 @@
#include "../libsvn_fs/fs-loader.h"
#include "private/svn_fs_util.h"
#include "private/svn_subr_private.h"
+#include "private/svn_dep_compat.h"
/* Add LOCK and its associated LOCK_TOKEN (associated with PATH) as
@@ -474,9 +476,11 @@ svn_fs_base__get_locks(svn_fs_t *fs,
while (1)
{
apr_size_t len, skel_len;
- char c, *end, *skel_buf;
+ char c, *skel_buf;
svn_skel_t *lock_skel;
svn_lock_t *lock;
+ apr_uint64_t ui64;
+ svn_error_t *err;
svn_pool_clear(iterpool);
@@ -484,9 +488,10 @@ svn_fs_base__get_locks(svn_fs_t *fs,
SVN_ERR(svn_stream_readline(stream, &buf, "\n", &eof, iterpool));
if (eof)
break;
- skel_len = (size_t) strtoul(buf->data, &end, 10);
- if (skel_len == (size_t) ULONG_MAX || *end != '\0')
- return svn_error_create(SVN_ERR_MALFORMED_FILE, NULL, NULL);
+ err = svn_cstring_strtoui64(&ui64, buf->data, 0, APR_SIZE_MAX, 10);
+ if (err)
+ return svn_error_create(SVN_ERR_MALFORMED_FILE, err, NULL);
+ skel_len = (apr_size_t)ui64;
/* Now read that much into a buffer. */
skel_buf = apr_palloc(pool, skel_len + 1);
@@ -541,8 +546,7 @@ verify_lock(svn_fs_t *fs,
_("User '%s' does not own lock on path '%s' (currently locked by '%s')"),
fs->access_ctx->username, lock->path, lock->owner);
- else if (apr_hash_get(fs->access_ctx->lock_tokens, lock->token,
- APR_HASH_KEY_STRING) == NULL)
+ else if (svn_hash_gets(fs->access_ctx->lock_tokens, lock->token) == NULL)
return svn_error_createf
(SVN_ERR_FS_BAD_LOCK_TOKEN, NULL,
_("Cannot verify lock on path '%s'; no matching lock-token available"),
Modified: subversion/branches/master-passphrase/subversion/libsvn_fs_base/revs-txns.c
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/libsvn_fs_base/revs-txns.c?rev=1481041&r1=1481040&r2=1481041&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/libsvn_fs_base/revs-txns.c (original)
+++ subversion/branches/master-passphrase/subversion/libsvn_fs_base/revs-txns.c Fri May 10 14:58:47 2013
@@ -230,7 +230,7 @@ svn_fs_base__revision_prop(svn_string_t
FALSE, pool));
/* And then the prop from that list (if there was a list). */
- *value_p = apr_hash_get(table, propname, APR_HASH_KEY_STRING);
+ *value_p = svn_hash_gets(table, propname);
return SVN_NO_ERROR;
}
@@ -262,8 +262,7 @@ svn_fs_base__set_rev_prop(svn_fs_t *fs,
if (old_value_p)
{
const svn_string_t *wanted_value = *old_value_p;
- const svn_string_t *present_value = apr_hash_get(txn->proplist, name,
- APR_HASH_KEY_STRING);
+ const svn_string_t *present_value = svn_hash_gets(txn->proplist, name);
if ((!wanted_value != !present_value)
|| (wanted_value && present_value
&& !svn_string_compare(wanted_value, present_value)))
@@ -276,7 +275,7 @@ svn_fs_base__set_rev_prop(svn_fs_t *fs,
}
/* Fall through. */
}
- apr_hash_set(txn->proplist, name, APR_HASH_KEY_STRING, value);
+ svn_hash_sets(txn->proplist, name, value);
/* Overwrite the revision. */
return put_txn(fs, txn, txn_id, trail, pool);
@@ -537,7 +536,7 @@ svn_fs_base__txn_prop(svn_string_t **val
FALSE, pool));
/* And then the prop from that list (if there was a list). */
- *value_p = apr_hash_get(table, propname, APR_HASH_KEY_STRING);
+ *value_p = svn_hash_gets(table, propname);
return SVN_NO_ERROR;
}
@@ -575,7 +574,7 @@ svn_fs_base__set_txn_prop(svn_fs_t *fs,
txn->proplist = apr_hash_make(pool);
/* Set the property. */
- apr_hash_set(txn->proplist, name, APR_HASH_KEY_STRING, value);
+ svn_hash_sets(txn->proplist, name, value);
/* Now overwrite the transaction. */
return put_txn(fs, txn, txn_name, trail, pool);
Modified: subversion/branches/master-passphrase/subversion/libsvn_fs_base/tree.c
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/libsvn_fs_base/tree.c?rev=1481041&r1=1481040&r2=1481041&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/libsvn_fs_base/tree.c (original)
+++ subversion/branches/master-passphrase/subversion/libsvn_fs_base/tree.c Fri May 10 14:58:47 2013
@@ -39,6 +39,7 @@
#include <string.h>
#include <assert.h>
#include "svn_private_config.h"
+#include "svn_hash.h"
#include "svn_pools.h"
#include "svn_error.h"
#include "svn_path.h"
@@ -160,7 +161,7 @@ dag_node_cache_get(svn_fs_root_t *root,
return NULL;
/* Look in the cache for our desired item. */
- cache_item = apr_hash_get(brd->node_cache, path, APR_HASH_KEY_STRING);
+ cache_item = svn_hash_gets(brd->node_cache, path);
if (cache_item)
return svn_fs_base__dag_dup(cache_item->node, pool);
@@ -208,7 +209,7 @@ dag_node_cache_set(svn_fs_root_t *root,
root, and that only happens once under that root. So, we'll be a
little bit sloppy here, and count on callers doing the right
thing. */
- cache_item = apr_hash_get(brd->node_cache, path, APR_HASH_KEY_STRING);
+ cache_item = svn_hash_gets(brd->node_cache, path);
if (cache_item)
{
/* ### This section is somehow broken. I don't know how, but it
@@ -250,9 +251,8 @@ dag_node_cache_set(svn_fs_root_t *root,
{
/* No room. Expire the oldest thing. */
cache_path = brd->node_cache_keys[brd->node_cache_idx];
- cache_item = apr_hash_get(brd->node_cache, cache_path,
- APR_HASH_KEY_STRING);
- apr_hash_set(brd->node_cache, cache_path, APR_HASH_KEY_STRING, NULL);
+ cache_item = svn_hash_gets(brd->node_cache, cache_path);
+ svn_hash_sets(brd->node_cache, cache_path, NULL);
cache_pool = cache_item->pool;
svn_pool_clear(cache_pool);
}
@@ -269,7 +269,7 @@ dag_node_cache_set(svn_fs_root_t *root,
/* Now add it to the cache. */
cache_path = apr_pstrdup(cache_pool, path);
- apr_hash_set(brd->node_cache, cache_path, APR_HASH_KEY_STRING, cache_item);
+ svn_hash_sets(brd->node_cache, cache_path, cache_item);
brd->node_cache_keys[brd->node_cache_idx] = cache_path;
/* Advance the cache pointer. */
@@ -309,11 +309,10 @@ txn_body_txn_root(void *baton,
/* Look for special txn props that represent the 'flags' behavior of
the transaction. */
SVN_ERR(svn_fs_base__txn_proplist_in_trail(&txnprops, svn_txn_id, trail));
- if (apr_hash_get(txnprops, SVN_FS__PROP_TXN_CHECK_OOD, APR_HASH_KEY_STRING))
+ if (svn_hash_gets(txnprops, SVN_FS__PROP_TXN_CHECK_OOD))
flags |= SVN_FS_TXN_CHECK_OOD;
- if (apr_hash_get(txnprops, SVN_FS__PROP_TXN_CHECK_LOCKS,
- APR_HASH_KEY_STRING))
+ if (svn_hash_gets(txnprops, SVN_FS__PROP_TXN_CHECK_LOCKS))
flags |= SVN_FS_TXN_CHECK_LOCKS;
root = make_txn_root(fs, svn_txn_id, txn->base_rev, flags, trail->pool);
@@ -1191,8 +1190,7 @@ txn_body_node_prop(void *baton,
trail, trail->pool));
*(args->value_p) = NULL;
if (proplist)
- *(args->value_p) = apr_hash_get(proplist, args->propname,
- APR_HASH_KEY_STRING);
+ *(args->value_p) = svn_hash_gets(proplist, args->propname);
return SVN_NO_ERROR;
}
@@ -1304,7 +1302,7 @@ txn_body_change_node_prop(void *baton,
proplist = apr_hash_make(trail->pool);
/* Set the property. */
- apr_hash_set(proplist, args->name, APR_HASH_KEY_STRING, args->value);
+ svn_hash_sets(proplist, args->name, args->value);
/* Overwrite the node's proplist. */
SVN_ERR(svn_fs_base__dag_set_proplist(parent_path->node, proplist,
@@ -2527,7 +2525,7 @@ verify_locks(const char *txn_name,
continue;
/* Fetch the change associated with our path. */
- change = apr_hash_get(changes, path, APR_HASH_KEY_STRING);
+ change = svn_hash_gets(changes, path);
/* What does it mean to succeed at lock verification for a given
path? For an existing file or directory getting modified
@@ -3732,8 +3730,7 @@ txn_body_apply_textdelta(void *baton, tr
we're calculating both SHA1 and MD5 checksums somewhere in
reps-strings.c. Could we keep them both around somehow so this
check could be more comprehensive? */
- if (tb->base_checksum->kind == checksum->kind
- && !svn_checksum_match(tb->base_checksum, checksum))
+ if (!svn_checksum_match(tb->base_checksum, checksum))
return svn_checksum_mismatch_err(tb->base_checksum, checksum,
trail->pool,
_("Base checksum mismatch on '%s'"),
@@ -5000,7 +4997,7 @@ txn_body_get_mergeinfo_data_and_entries(
SVN_ERR(svn_fs_base__dag_get_proplist(&plist, child_node,
trail, iterpool));
- pval = apr_hash_get(plist, SVN_PROP_MERGEINFO, APR_HASH_KEY_STRING);
+ pval = svn_hash_gets(plist, SVN_PROP_MERGEINFO);
if (! pval)
{
svn_string_t *id_str = svn_fs_base__id_unparse(child_id,
@@ -5024,11 +5021,10 @@ txn_body_get_mergeinfo_data_and_entries(
}
else
{
- apr_hash_set(args->result_catalog,
- svn_fspath__join(args->node_path, dirent->name,
- result_pool),
- APR_HASH_KEY_STRING,
- child_mergeinfo);
+ svn_hash_sets(args->result_catalog,
+ svn_fspath__join(args->node_path, dirent->name,
+ result_pool),
+ child_mergeinfo);
}
}
@@ -5048,10 +5044,9 @@ txn_body_get_mergeinfo_data_and_entries(
"but is not a directory"),
id_str->data);
}
- apr_hash_set(args->children_atop_mergeinfo_trees,
- apr_pstrdup(children_pool, dirent->name),
- APR_HASH_KEY_STRING,
- svn_fs_base__dag_dup(child_node, children_pool));
+ svn_hash_sets(args->children_atop_mergeinfo_trees,
+ apr_pstrdup(children_pool, dirent->name),
+ svn_fs_base__dag_dup(child_node, children_pool));
}
}
@@ -5177,8 +5172,7 @@ txn_body_get_mergeinfo_for_path(void *ba
svn_pool_destroy(iterpool);
SVN_ERR(svn_fs_base__dag_get_proplist(&proplist, node, trail, trail->pool));
- mergeinfo_string = apr_hash_get(proplist, SVN_PROP_MERGEINFO,
- APR_HASH_KEY_STRING);
+ mergeinfo_string = svn_hash_gets(proplist, SVN_PROP_MERGEINFO);
if (! mergeinfo_string)
{
svn_string_t *id_str =
@@ -5295,9 +5289,8 @@ get_mergeinfos_for_paths(svn_fs_root_t *
txn_body_get_mergeinfo_for_path,
&gmfp_args, FALSE, iterpool));
if (path_mergeinfo)
- apr_hash_set(result_catalog, apr_pstrdup(result_pool, path),
- APR_HASH_KEY_STRING,
- path_mergeinfo);
+ svn_hash_sets(result_catalog, apr_pstrdup(result_pool, path),
+ path_mergeinfo);
/* If we're including descendants, do so. */
if (include_descendants)
Modified: subversion/branches/master-passphrase/subversion/libsvn_fs_fs/caching.c
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/libsvn_fs_fs/caching.c?rev=1481041&r1=1481040&r2=1481041&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/libsvn_fs_fs/caching.c (original)
+++ subversion/branches/master-passphrase/subversion/libsvn_fs_fs/caching.c Fri May 10 14:58:47 2013
@@ -38,14 +38,48 @@
#include "private/svn_debug.h"
#include "private/svn_subr_private.h"
+/* Take the ORIGINAL string and replace all occurrences of ":" without
+ * limiting the key space. Allocate the result in POOL.
+ */
+static const char *
+normalize_key_part(const char *original,
+ apr_pool_t *pool)
+{
+ apr_size_t i;
+ apr_size_t len = strlen(original);
+ svn_stringbuf_t *normalized = svn_stringbuf_create_ensure(len, pool);
+
+ for (i = 0; i < len; ++i)
+ {
+ char c = original[i];
+ switch (c)
+ {
+ case ':': svn_stringbuf_appendbytes(normalized, "%_", 2);
+ break;
+ case '%': svn_stringbuf_appendbytes(normalized, "%%", 2);
+ break;
+ default : svn_stringbuf_appendbyte(normalized, c);
+ }
+ }
+
+ return normalized->data;
+}
+
/* Return a memcache in *MEMCACHE_P for FS if it's configured to use
memcached, or NULL otherwise. Also, sets *FAIL_STOP to a boolean
indicating whether cache errors should be returned to the caller or
- just passed to the FS warning handler. Use FS->pool for allocating
- the memcache, and POOL for temporary allocations. */
+ just passed to the FS warning handler.
+
+ *CACHE_TXDELTAS, *CACHE_FULLTEXTS and *CACHE_REVPROPS flags will be set
+ according to FS->CONFIG. *CACHE_NAMESPACE receives the cache prefix
+ to use.
+
+ Use FS->pool for allocating the memcache and CACHE_NAMESPACE, and POOL
+ for temporary allocations. */
static svn_error_t *
read_config(svn_memcache_t **memcache_p,
svn_boolean_t *fail_stop,
+ const char **cache_namespace,
svn_boolean_t *cache_txdeltas,
svn_boolean_t *cache_fulltexts,
svn_boolean_t *cache_revprops,
@@ -57,6 +91,22 @@ read_config(svn_memcache_t **memcache_p,
SVN_ERR(svn_cache__make_memcache_from_config(memcache_p, ffd->config,
fs->pool));
+ /* No cache namespace by default. I.e. all FS instances share the
+ * cached data. If you specify different namespaces, the data will
+ * share / compete for the same cache memory but keys will not match
+ * across namespaces and, thus, cached data will not be shared between
+ * namespaces.
+ *
+ * Since the namespace will be concatenated with other elements to form
+ * the complete key prefix, we must make sure that the resulting string
+ * is unique and cannot be created by any other combination of elements.
+ */
+ *cache_namespace
+ = normalize_key_part(svn_hash__get_cstring(fs->config,
+ SVN_FS_CONFIG_FSFS_CACHE_NS,
+ ""),
+ pool);
+
/* don't cache text deltas by default.
* Once we reconstructed the fulltexts from the deltas,
* these deltas are rarely re-used. Therefore, only tools
@@ -83,7 +133,7 @@ read_config(svn_memcache_t **memcache_p,
* Revprop caching significantly speeds up operations like
* svn ls -v. However, it requires synchronization that may
* not be available or efficient in the current server setup.
- *
+ *
* If the caller chose option "2", enable revprop caching if
* the required API support is there to make it efficient.
*/
@@ -235,7 +285,7 @@ init_callbacks(svn_cache__t *cache,
*
* Unless NO_HANDLER is true, register an error handler that reports errors
* as warnings to the FS warning callback.
- *
+ *
* Cache is allocated in POOL.
* */
static svn_error_t *
@@ -294,7 +344,8 @@ svn_fs_fs__initialize_caches(svn_fs_t *f
fs_fs_data_t *ffd = fs->fsap_data;
const char *prefix = apr_pstrcat(pool,
"fsfs:", fs->uuid,
- "/", fs->path, ":",
+ "/", normalize_key_part(fs->path, pool),
+ ":",
(char *)NULL);
svn_memcache_t *memcache;
svn_membuffer_t *membuffer;
@@ -302,16 +353,20 @@ svn_fs_fs__initialize_caches(svn_fs_t *f
svn_boolean_t cache_txdeltas;
svn_boolean_t cache_fulltexts;
svn_boolean_t cache_revprops;
+ const char *cache_namespace;
/* Evaluating the cache configuration. */
SVN_ERR(read_config(&memcache,
&no_handler,
+ &cache_namespace,
&cache_txdeltas,
&cache_fulltexts,
&cache_revprops,
fs,
pool));
+ prefix = apr_pstrcat(pool, "ns:", cache_namespace, ":", prefix, NULL);
+
membuffer = svn_cache__get_global_membuffer_cache();
/* Make the cache for revision roots. For the vast majority of
@@ -419,7 +474,7 @@ svn_fs_fs__initialize_caches(svn_fs_t *f
fs,
no_handler,
fs->pool));
-
+
SVN_ERR(create_cache(&(ffd->properties_cache),
NULL,
membuffer,
@@ -432,7 +487,7 @@ svn_fs_fs__initialize_caches(svn_fs_t *f
fs,
no_handler,
fs->pool));
-
+
SVN_ERR(create_cache(&(ffd->mergeinfo_cache),
NULL,
membuffer,
@@ -445,7 +500,7 @@ svn_fs_fs__initialize_caches(svn_fs_t *f
fs,
no_handler,
fs->pool));
-
+
SVN_ERR(create_cache(&(ffd->mergeinfo_existence_cache),
NULL,
membuffer,
Modified: subversion/branches/master-passphrase/subversion/libsvn_fs_fs/fs.c
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/libsvn_fs_fs/fs.c?rev=1481041&r1=1481040&r2=1481041&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/libsvn_fs_fs/fs.c (original)
+++ subversion/branches/master-passphrase/subversion/libsvn_fs_fs/fs.c Fri May 10 14:58:47 2013
@@ -126,8 +126,8 @@ fs_set_errcall(svn_fs_t *fs,
struct fs_freeze_baton_t {
svn_fs_t *fs;
- svn_error_t *(*freeze_body)(void *, apr_pool_t *);
- void *baton;
+ svn_fs_freeze_func_t freeze_func;
+ void *freeze_baton;
};
static svn_error_t *
@@ -141,22 +141,22 @@ fs_freeze_body(void *baton,
if (exists)
SVN_ERR(svn_fs_fs__lock_rep_cache(b->fs, pool));
- SVN_ERR(b->freeze_body(b->baton, pool));
+ SVN_ERR(b->freeze_func(b->freeze_baton, pool));
return SVN_NO_ERROR;
}
static svn_error_t *
fs_freeze(svn_fs_t *fs,
- svn_error_t *(*freeze_body)(void *, apr_pool_t *),
- void *baton,
+ svn_fs_freeze_func_t freeze_func,
+ void *freeze_baton,
apr_pool_t *pool)
{
struct fs_freeze_baton_t b;
b.fs = fs;
- b.freeze_body = freeze_body;
- b.baton = baton;
+ b.freeze_func = freeze_func;
+ b.freeze_baton = freeze_baton;
SVN_ERR(svn_fs__check_fs(fs, TRUE));
SVN_ERR(svn_fs_fs__with_write_lock(fs, fs_freeze_body, &b, pool));
@@ -164,6 +164,21 @@ fs_freeze(svn_fs_t *fs,
return SVN_NO_ERROR;
}
+static svn_error_t *
+fs_info(const void **fsfs_info,
+ svn_fs_t *fs,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
+{
+ fs_fs_data_t *ffd = fs->fsap_data;
+ svn_fs_fsfs_info_t *info = apr_palloc(result_pool, sizeof(*info));
+ info->fs_type = SVN_FS_TYPE_FSFS;
+ info->shard_size = ffd->max_files_per_dir;
+ info->min_unpacked_rev = ffd->min_unpacked_rev;
+ *fsfs_info = info;
+ return SVN_NO_ERROR;
+}
+
/* The vtable associated with a specific open filesystem. */
@@ -184,7 +199,10 @@ static fs_vtable_t fs_vtable = {
svn_fs_fs__unlock,
svn_fs_fs__get_lock,
svn_fs_fs__get_locks,
- svn_fs_fs__verify_rev,
+ svn_fs_fs__info_format,
+ svn_fs_fs__info_config_files,
+ fs_info,
+ svn_fs_fs__verify_root,
fs_freeze,
fs_set_errcall
};
@@ -400,6 +418,26 @@ fs_get_description(void)
return _("Module for working with a plain file (FSFS) repository.");
}
+static svn_error_t *
+fs_set_svn_fs_open(svn_fs_t *fs,
+ svn_error_t *(*svn_fs_open_)(svn_fs_t **,
+ const char *,
+ apr_hash_t *,
+ apr_pool_t *))
+{
+ fs_fs_data_t *ffd = fs->fsap_data;
+ ffd->svn_fs_open_ = svn_fs_open_;
+ return SVN_NO_ERROR;
+}
+
+static void *
+fs_info_dup(const void *fsfs_info_void,
+ apr_pool_t *result_pool)
+{
+ /* All fields are either ints or static strings. */
+ const svn_fs_fsfs_info_t *fsfs_info = fsfs_info_void;
+ return apr_pmemdup(result_pool, fsfs_info, sizeof(*fsfs_info));
+}
/* Base FS library vtable, used by the FS loader library. */
@@ -416,7 +454,10 @@ static fs_library_vtable_t library_vtabl
fs_get_description,
svn_fs_fs__recover,
fs_pack,
- fs_logfiles
+ fs_logfiles,
+ NULL /* parse_id */,
+ fs_set_svn_fs_open,
+ fs_info_dup
};
svn_error_t *
Modified: subversion/branches/master-passphrase/subversion/libsvn_fs_fs/fs.h
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/libsvn_fs_fs/fs.h?rev=1481041&r1=1481040&r2=1481041&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/libsvn_fs_fs/fs.h (original)
+++ subversion/branches/master-passphrase/subversion/libsvn_fs_fs/fs.h Fri May 10 14:58:47 2013
@@ -349,7 +349,7 @@ typedef struct fs_fs_data_t
/* Whether packed revprop files shall be compressed. */
svn_boolean_t compress_packed_revprops;
-
+
/* Whether directory nodes shall be deltified just like file nodes. */
svn_boolean_t deltify_directories;
@@ -362,6 +362,10 @@ typedef struct fs_fs_data_t
/* Maximum number of length of the linear part at the top of the
* deltification history after which skip deltas will be used. */
apr_int64_t max_linear_deltification;
+
+ /* Pointer to svn_fs_open. */
+ svn_error_t *(*svn_fs_open_)(svn_fs_t **, const char *, apr_hash_t *,
+ apr_pool_t *);
} fs_fs_data_t;
Modified: subversion/branches/master-passphrase/subversion/libsvn_fs_fs/fs_fs.c
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/libsvn_fs_fs/fs_fs.c?rev=1481041&r1=1481040&r2=1481041&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/libsvn_fs_fs/fs_fs.c (original)
+++ subversion/branches/master-passphrase/subversion/libsvn_fs_fs/fs_fs.c Fri May 10 14:58:47 2013
@@ -49,6 +49,7 @@
#include "svn_mergeinfo.h"
#include "svn_config.h"
#include "svn_ctype.h"
+#include "svn_version.h"
#include "fs.h"
#include "tree.h"
@@ -1156,9 +1157,9 @@ read_config(fs_fs_data_t *ffd,
const char *fs_path,
apr_pool_t *pool)
{
- SVN_ERR(svn_config_read2(&ffd->config,
+ SVN_ERR(svn_config_read3(&ffd->config,
svn_dirent_join(fs_path, PATH_CONFIG, pool),
- FALSE, FALSE, pool));
+ FALSE, FALSE, FALSE, pool));
/* Initialize ffd->rep_sharing_allowed. */
if (ffd->format >= SVN_FS_FS__MIN_REP_SHARING_FORMAT)
@@ -1796,7 +1797,7 @@ static svn_error_t * read_header_block(a
/* header_str is safely in our pool, so we can use bits of it as
key and value. */
- apr_hash_set(*headers, name, APR_HASH_KEY_STRING, value);
+ svn_hash_sets(*headers, name, value);
}
return SVN_NO_ERROR;
@@ -2355,7 +2356,7 @@ svn_fs_fs__read_noderev(node_revision_t
noderev = apr_pcalloc(pool, sizeof(*noderev));
/* Read the node-rev id. */
- value = apr_hash_get(headers, HEADER_ID, APR_HASH_KEY_STRING);
+ value = svn_hash_gets(headers, HEADER_ID);
if (value == NULL)
/* ### More information: filename/offset coordinates */
return svn_error_create(SVN_ERR_FS_CORRUPT, NULL,
@@ -2367,7 +2368,7 @@ svn_fs_fs__read_noderev(node_revision_t
noderev_id = value; /* for error messages later */
/* Read the type. */
- value = apr_hash_get(headers, HEADER_TYPE, APR_HASH_KEY_STRING);
+ value = svn_hash_gets(headers, HEADER_TYPE);
if ((value == NULL) ||
(strcmp(value, KIND_FILE) != 0 && strcmp(value, KIND_DIR)))
@@ -2380,14 +2381,14 @@ svn_fs_fs__read_noderev(node_revision_t
: svn_node_dir;
/* Read the 'count' field. */
- value = apr_hash_get(headers, HEADER_COUNT, APR_HASH_KEY_STRING);
+ value = svn_hash_gets(headers, HEADER_COUNT);
if (value)
SVN_ERR(svn_cstring_atoi(&noderev->predecessor_count, value));
else
noderev->predecessor_count = 0;
/* Get the properties location. */
- value = apr_hash_get(headers, HEADER_PROPS, APR_HASH_KEY_STRING);
+ value = svn_hash_gets(headers, HEADER_PROPS);
if (value)
{
SVN_ERR(read_rep_offsets(&noderev->prop_rep, value,
@@ -2395,7 +2396,7 @@ svn_fs_fs__read_noderev(node_revision_t
}
/* Get the data location. */
- value = apr_hash_get(headers, HEADER_TEXT, APR_HASH_KEY_STRING);
+ value = svn_hash_gets(headers, HEADER_TEXT);
if (value)
{
SVN_ERR(read_rep_offsets(&noderev->data_rep, value,
@@ -2404,7 +2405,7 @@ svn_fs_fs__read_noderev(node_revision_t
}
/* Get the created path. */
- value = apr_hash_get(headers, HEADER_CPATH, APR_HASH_KEY_STRING);
+ value = svn_hash_gets(headers, HEADER_CPATH);
if (value == NULL)
{
return svn_error_createf(SVN_ERR_FS_CORRUPT, NULL,
@@ -2417,13 +2418,13 @@ svn_fs_fs__read_noderev(node_revision_t
}
/* Get the predecessor ID. */
- value = apr_hash_get(headers, HEADER_PRED, APR_HASH_KEY_STRING);
+ value = svn_hash_gets(headers, HEADER_PRED);
if (value)
noderev->predecessor_id = svn_fs_fs__id_parse(value, strlen(value),
pool);
/* Get the copyroot. */
- value = apr_hash_get(headers, HEADER_COPYROOT, APR_HASH_KEY_STRING);
+ value = svn_hash_gets(headers, HEADER_COPYROOT);
if (value == NULL)
{
noderev->copyroot_path = apr_pstrdup(pool, noderev->created_path);
@@ -2449,7 +2450,7 @@ svn_fs_fs__read_noderev(node_revision_t
}
/* Get the copyfrom. */
- value = apr_hash_get(headers, HEADER_COPYFROM, APR_HASH_KEY_STRING);
+ value = svn_hash_gets(headers, HEADER_COPYFROM);
if (value == NULL)
{
noderev->copyfrom_path = NULL;
@@ -2473,18 +2474,18 @@ svn_fs_fs__read_noderev(node_revision_t
}
/* Get whether this is a fresh txn root. */
- value = apr_hash_get(headers, HEADER_FRESHTXNRT, APR_HASH_KEY_STRING);
+ value = svn_hash_gets(headers, HEADER_FRESHTXNRT);
noderev->is_fresh_txn_root = (value != NULL);
/* Get the mergeinfo count. */
- value = apr_hash_get(headers, HEADER_MINFO_CNT, APR_HASH_KEY_STRING);
+ value = svn_hash_gets(headers, HEADER_MINFO_CNT);
if (value)
SVN_ERR(svn_cstring_atoi64(&noderev->mergeinfo_count, value));
else
noderev->mergeinfo_count = 0;
/* Get whether *this* node has mergeinfo. */
- value = apr_hash_get(headers, HEADER_MINFO_HERE, APR_HASH_KEY_STRING);
+ value = svn_hash_gets(headers, HEADER_MINFO_HERE);
noderev->has_mergeinfo = (value != NULL);
*noderev_p = noderev;
@@ -2801,7 +2802,7 @@ get_fs_id_at_offset(svn_fs_id_t **id_p,
/* In error messages, the offset is relative to the pack file,
not to the rev file. */
- node_id_str = apr_hash_get(headers, HEADER_ID, APR_HASH_KEY_STRING);
+ node_id_str = svn_hash_gets(headers, HEADER_ID);
if (node_id_str == NULL)
return svn_error_createf(SVN_ERR_FS_CORRUPT, NULL,
@@ -3068,7 +3069,7 @@ svn_fs_fs__rev_get_root(svn_fs_id_t **ro
*
* Mechanism:
* ----------
- *
+ *
* Revprop caching needs to be activated and will be deactivated for the
* respective FS instance if the necessary infrastructure could not be
* initialized. In deactivated mode, there is almost no runtime overhead
@@ -3214,7 +3215,7 @@ ensure_revprop_generation(svn_fs_t *fs,
if (ffd->revprop_generation == NULL)
{
apr_int64_t current = 0;
-
+
SVN_ERR(svn_named_atomic__get(&ffd->revprop_generation,
ffd->revprop_namespace,
ATOMIC_REVPROP_GENERATION,
@@ -3259,13 +3260,13 @@ log_revprop_cache_init_warning(svn_fs_t
svn_error_t *underlying_err,
const char *message)
{
- svn_error_t *err = svn_error_createf(SVN_ERR_FS_REPPROP_CACHE_INIT_FAILURE,
+ svn_error_t *err = svn_error_createf(SVN_ERR_FS_REVPROP_CACHE_INIT_FAILURE,
underlying_err,
message, fs->path);
if (fs->warning)
(fs->warning)(fs->warning_baton, err);
-
+
svn_error_clear(err);
}
@@ -3291,7 +3292,7 @@ has_revprop_cache(svn_fs_t *fs, apr_pool
log_revprop_cache_init_warning(fs, NULL,
"Revprop caching for '%s' disabled"
" because it would be inefficient.");
-
+
return FALSE;
}
@@ -3336,7 +3337,7 @@ revprop_generation_fixup(void *void_bato
{
revprop_generation_upgrade_t *baton = void_baton;
assert(baton->ffd->has_write_lock);
-
+
/* Maybe, either the original revprop writer or some other reader has
already corrected / bumped the revprop generation. Thus, we need
to read it again. */
@@ -3502,7 +3503,7 @@ typedef struct packed_revprops_t
apr_array_header_t *offsets;
- /* concatenation of the serialized representation of all revprops
+ /* concatenation of the serialized representation of all revprops
* in the pack, i.e. the pack content without header and compression */
svn_stringbuf_t *packed_revprops;
@@ -3516,7 +3517,7 @@ typedef struct packed_revprops_t
* Three more parameters are being used to update the revprop cache: FS is
* our file system, the revprops belong to REVISION and the global revprop
* GENERATION is used as well.
- *
+ *
* The returned hash will be allocated in POOL, SCRATCH_POOL is being used
* for temporary allocations.
*/
@@ -3801,7 +3802,7 @@ read_pack_revprop(packed_revprops_t **re
/* the file content should be available now */
if (!result->packed_revprops)
- return svn_error_createf(SVN_ERR_FS_PACKED_REPPROP_READ_FAILURE, NULL,
+ return svn_error_createf(SVN_ERR_FS_PACKED_REVPROP_READ_FAILURE, NULL,
_("Failed to read revprop pack file for rev %ld"), rev);
/* parse it. RESULT will be complete afterwards. */
@@ -3892,7 +3893,7 @@ get_revision_proplist(apr_hash_t **propl
* filesystem FS to a non-packed file. Return the name of that temporary
* file in *TMP_PATH and the file path that it must be moved to in
* *FINAL_PATH.
- *
+ *
* Use POOL for allocations.
*/
static svn_error_t *
@@ -3924,7 +3925,7 @@ write_non_packed_revprop(const char **fi
* If indicated in BUMP_GENERATION, increase FS' revprop generation.
* Finally, delete all the temporary files given in FILES_TO_DELETE.
* The latter may be NULL.
- *
+ *
* Use POOL for temporary allocations.
*/
static svn_error_t *
@@ -3952,7 +3953,7 @@ switch_to_new_revprop(svn_fs_t *fs,
{
apr_pool_t *iterpool = svn_pool_create(pool);
int i;
-
+
for (i = 0; i < files_to_delete->nelts; ++i)
{
const char *path = APR_ARRAY_IDX(files_to_delete, i, const char*);
@@ -4002,7 +4003,7 @@ serialize_revprops_header(svn_stream_t *
/* Writes the a pack file to FILE_STREAM. It copies the serialized data
* from REVPROPS for the indexes [START,END) except for index CHANGED_INDEX.
- *
+ *
* The data for the latter is taken from NEW_SERIALIZED. Note, that
* CHANGED_INDEX may be outside the [START,END) range, i.e. no new data is
* taken in that case but only a subset of the old data will be copied.
@@ -4046,9 +4047,9 @@ repack_revprops(svn_fs_t *fs,
}
else
{
- apr_size_t size
+ apr_size_t size
= (apr_size_t)APR_ARRAY_IDX(revprops->sizes, i, apr_off_t);
- apr_size_t offset
+ apr_size_t offset
= (apr_size_t)APR_ARRAY_IDX(revprops->offsets, i, apr_off_t);
SVN_ERR(svn_stream_write(stream,
@@ -4109,7 +4110,7 @@ repack_stream_open(svn_stream_t **stream
return svn_error_createf(SVN_ERR_FS_CORRUPT, NULL,
_("Packed file '%s' misses a tag"),
old_filename);
-
+
SVN_ERR(svn_cstring_atoi64(&tag, tag_string + 1));
new_filename = svn_string_createf(pool, "%ld.%" APR_INT64_T_FMT,
revprops->start_revision + start,
@@ -4193,7 +4194,7 @@ write_packed_revprop(const char **final_
{
/* split the pack file into two of roughly equal size */
int right_count, left_count, i;
-
+
int left = 0;
int right = revprops->sizes->nelts - 1;
apr_off_t left_size = 2 * SVN_INT64_BUFFER_SIZE;
@@ -4278,7 +4279,7 @@ write_packed_revprop(const char **final_
SVN_ERR(svn_stream_close(stream));
}
-
+
return SVN_NO_ERROR;
}
@@ -4301,7 +4302,7 @@ set_revision_proplist(svn_fs_t *fs,
/* this info will not change while we hold the global FS write lock */
is_packed = is_packed_revprop(fs, rev);
-
+
/* Test whether revprops already exist for this revision.
* Only then will we need to bump the revprop generation. */
if (has_revprop_cache(fs, pool))
@@ -4728,7 +4729,7 @@ set_cached_combined_window(svn_stringbuf
Also, set *WINDOW_P to the base window content for *LIST, if it
could be found in cache. Otherwise, *LIST will contain the base
representation for the whole delta chain.
- Finally, return the expanded size of the representation in
+ Finally, return the expanded size of the representation in
*EXPANDED_SIZE. It will take care of cases where only the on-disk
size is known. */
static svn_error_t *
@@ -5349,7 +5350,7 @@ cache_access_wrapper(void **out,
data_len - 1, /* cache adds terminating 0 */
wrapper_baton->baton,
pool));
-
+
/* non-NULL value to signal the calling cache that all went well */
*out = baton;
@@ -5544,7 +5545,7 @@ parse_dir_entries(apr_hash_t **entries_p
dirent->id = svn_fs_fs__id_parse(str, strlen(str), pool);
- apr_hash_set(*entries_p, dirent->name, APR_HASH_KEY_STRING, dirent);
+ svn_hash_sets(*entries_p, dirent->name, dirent);
}
return SVN_NO_ERROR;
@@ -5638,7 +5639,7 @@ svn_fs_fs__rep_contents_dir_entry(svn_fs
scratch_pool));
/* find desired entry and return a copy in POOL, if found */
- entry = apr_hash_get(entries, name, APR_HASH_KEY_STRING);
+ entry = svn_hash_gets(entries, name);
if (entry != NULL)
{
entry_copy = apr_palloc(result_pool, sizeof(*entry_copy));
@@ -5692,7 +5693,7 @@ svn_fs_fs__get_proplist(apr_hash_t **pro
SVN_ERR(read_representation(&stream, fs, noderev->prop_rep, pool));
SVN_ERR(svn_hash_read2(proplist, stream, SVN_HASH_TERMINATOR, pool));
SVN_ERR(svn_stream_close(stream));
-
+
if (ffd->properties_cache && SVN_IS_VALID_REVNUM(rep->revision))
SVN_ERR(svn_cache__set(ffd->properties_cache, &key, proplist, pool));
}
@@ -6172,7 +6173,7 @@ process_changes(apr_hash_t *changed_path
for (i = 0; i < changes->nelts; ++i)
{
change_t *change = APR_ARRAY_IDX(changes, i, change_t *);
-
+
SVN_ERR(fold_change(changed_paths, change, copyfrom_cache));
/* Now, if our change was a deletion or replacement, we have to
@@ -6246,7 +6247,7 @@ read_all_changes(apr_array_header_t **ch
/* pre-allocate enough room for most change lists
(will be auto-expanded as necessary) */
*changes = apr_array_make(pool, 30, sizeof(change_t *));
-
+
SVN_ERR(read_change(&change, file, pool));
while (change)
{
@@ -6307,7 +6308,7 @@ get_changes(apr_array_header_t **changes
}
/* read changes from revision file */
-
+
SVN_ERR(ensure_revision_exists(fs, rev, pool));
SVN_ERR(open_pack_or_rev_file(&revision_file, fs, rev, pool));
@@ -6317,11 +6318,11 @@ get_changes(apr_array_header_t **changes
SVN_ERR(svn_io_file_seek(revision_file, APR_SET, &changes_offset, pool));
SVN_ERR(read_all_changes(changes, revision_file, pool));
-
+
SVN_ERR(svn_io_file_close(revision_file, pool));
/* cache for future reference */
-
+
if (ffd->changes_cache)
SVN_ERR(svn_cache__set(ffd->changes_cache, &rev, *changes, pool));
@@ -6622,7 +6623,7 @@ svn_fs_fs__change_txn_props(svn_fs_txn_t
{
svn_prop_t *prop = &APR_ARRAY_IDX(props, i, svn_prop_t);
- apr_hash_set(txn_prop, prop->name, APR_HASH_KEY_STRING, prop->value);
+ svn_hash_sets(txn_prop, prop->name, prop->value);
}
/* Create a new version of the file and write out the new props. */
@@ -7160,7 +7161,7 @@ choose_delta_base(representation_t **rep
/* If there is a shared rep along the way, we need to limit the
* length of the deltification chain.
- *
+ *
* Please note that copied nodes - such as branch directories - will
* look the same (false positive) while reps shared within the same
* revision will not be caught (false negative).
@@ -7191,7 +7192,7 @@ choose_delta_base(representation_t **rep
* extreme cases. */
apr_pool_t *sub_pool = svn_pool_create(pool);
representation_t base_rep = **rep;
-
+
/* Some reasonable limit, depending on how acceptable longer linear
* chains are in this repo. Also, allow for some minimal chain. */
int max_chain_length = 2 * (int)ffd->max_linear_deltification + 2;
@@ -7244,12 +7245,12 @@ rep_write_cleanup(void *data)
struct rep_write_baton *b = data;
const char *txn_id = svn_fs_fs__id_txn_id(b->noderev->id);
svn_error_t *err;
-
+
/* Truncate and close the protorevfile. */
err = svn_io_file_trunc(b->file, b->rep_offset, b->pool);
err = svn_error_compose_create(err, svn_io_file_close(b->file, b->pool));
- /* Remove our lock regardless of any preceeding errors so that the
+ /* Remove our lock regardless of any preceeding errors so that the
being_written flag is always removed and stays consistent with the
file lock which will be removed no matter what since the pool is
going away. */
@@ -8262,6 +8263,51 @@ write_current(svn_fs_t *fs, svn_revnum_t
return move_into_place(tmp_name, name, name, pool);
}
+/* Open a new svn_fs_t handle to FS, set that handle's concept of "current
+ youngest revision" to NEW_REV, and call svn_fs_fs__verify_root() on
+ NEW_REV's revision root.
+
+ Intended to be called as the very last step in a commit before 'current'
+ is bumped. This implies that we are holding the write lock. */
+static svn_error_t *
+verify_as_revision_before_current_plus_plus(svn_fs_t *fs,
+ svn_revnum_t new_rev,
+ apr_pool_t *pool)
+{
+#ifdef SVN_DEBUG
+ fs_fs_data_t *ffd = fs->fsap_data;
+ svn_fs_t *ft; /* fs++ == ft */
+ svn_fs_root_t *root;
+ fs_fs_data_t *ft_ffd;
+ apr_hash_t *fs_config;
+
+ SVN_ERR_ASSERT(ffd->svn_fs_open_);
+
+ /* make sure FT does not simply return data cached by other instances
+ * but actually retrieves it from disk at least once.
+ */
+ fs_config = apr_hash_make(pool);
+ svn_hash_sets(fs_config, SVN_FS_CONFIG_FSFS_CACHE_NS,
+ svn_uuid_generate(pool));
+ SVN_ERR(ffd->svn_fs_open_(&ft, fs->path,
+ fs_config,
+ pool));
+ ft_ffd = ft->fsap_data;
+ /* Don't let FT consult rep-cache.db, either. */
+ ft_ffd->rep_sharing_allowed = FALSE;
+
+ /* Time travel! */
+ ft_ffd->youngest_rev_cache = new_rev;
+
+ SVN_ERR(svn_fs_fs__revision_root(&root, ft, new_rev, pool));
+ SVN_ERR_ASSERT(root->is_txn_root == FALSE && root->rev == new_rev);
+ SVN_ERR_ASSERT(ft_ffd->youngest_rev_cache == new_rev);
+ SVN_ERR(svn_fs_fs__verify_root(root, pool));
+#endif /* SVN_DEBUG */
+
+ return SVN_NO_ERROR;
+}
+
/* Update the 'current' file to hold the correct next node and copy_ids
from transaction TXN_ID in filesystem FS. The current revision is
set to REV. Perform temporary allocations in POOL. */
@@ -8336,7 +8382,7 @@ verify_locks(svn_fs_t *fs,
continue;
/* Fetch the change associated with our path. */
- change = apr_hash_get(changes, path, APR_HASH_KEY_STRING);
+ change = svn_hash_gets(changes, path);
/* What does it mean to succeed at lock verification for a given
path? For an existing file or directory getting modified
@@ -8455,14 +8501,13 @@ commit_body(void *baton, apr_pool_t *poo
txnprop_list = apr_array_make(pool, 3, sizeof(svn_prop_t));
prop.value = NULL;
- if (apr_hash_get(txnprops, SVN_FS__PROP_TXN_CHECK_OOD, APR_HASH_KEY_STRING))
+ if (svn_hash_gets(txnprops, SVN_FS__PROP_TXN_CHECK_OOD))
{
prop.name = SVN_FS__PROP_TXN_CHECK_OOD;
APR_ARRAY_PUSH(txnprop_list, svn_prop_t) = prop;
}
- if (apr_hash_get(txnprops, SVN_FS__PROP_TXN_CHECK_LOCKS,
- APR_HASH_KEY_STRING))
+ if (svn_hash_gets(txnprops, SVN_FS__PROP_TXN_CHECK_LOCKS))
{
prop.name = SVN_FS__PROP_TXN_CHECK_LOCKS;
APR_ARRAY_PUSH(txnprop_list, svn_prop_t) = prop;
@@ -8533,6 +8578,7 @@ commit_body(void *baton, apr_pool_t *poo
old_rev_filename, pool));
/* Update the 'current' file. */
+ SVN_ERR(verify_as_revision_before_current_plus_plus(cb->fs, new_rev, pool));
SVN_ERR(write_final_current(cb->fs, cb->txn->id, new_rev, start_node_id,
start_copy_id, pool));
@@ -8670,7 +8716,7 @@ write_revision_zero(svn_fs_t *fs)
date.data = svn_time_to_cstring(apr_time_now(), fs->pool);
date.len = strlen(date.data);
proplist = apr_hash_make(fs->pool);
- apr_hash_set(proplist, SVN_PROP_REVISION_DATE, APR_HASH_KEY_STRING, &date);
+ svn_hash_sets(proplist, SVN_PROP_REVISION_DATE, &date);
return set_revision_proplist(fs, 0, proplist, fs->pool);
}
@@ -8686,17 +8732,13 @@ svn_fs_fs__create(svn_fs_t *fs,
/* See if compatibility with older versions was explicitly requested. */
if (fs->config)
{
- if (apr_hash_get(fs->config, SVN_FS_CONFIG_PRE_1_4_COMPATIBLE,
- APR_HASH_KEY_STRING))
+ if (svn_hash_gets(fs->config, SVN_FS_CONFIG_PRE_1_4_COMPATIBLE))
format = 1;
- else if (apr_hash_get(fs->config, SVN_FS_CONFIG_PRE_1_5_COMPATIBLE,
- APR_HASH_KEY_STRING))
+ else if (svn_hash_gets(fs->config, SVN_FS_CONFIG_PRE_1_5_COMPATIBLE))
format = 2;
- else if (apr_hash_get(fs->config, SVN_FS_CONFIG_PRE_1_6_COMPATIBLE,
- APR_HASH_KEY_STRING))
+ else if (svn_hash_gets(fs->config, SVN_FS_CONFIG_PRE_1_6_COMPATIBLE))
format = 3;
- else if (apr_hash_get(fs->config, SVN_FS_CONFIG_PRE_1_8_COMPATIBLE,
- APR_HASH_KEY_STRING))
+ else if (svn_hash_gets(fs->config, SVN_FS_CONFIG_PRE_1_8_COMPATIBLE))
format = 4;
}
ffd->format = format;
@@ -8900,13 +8942,13 @@ recover_find_max_ids(svn_fs_t *fs, svn_r
pool));
/* Check that this is a directory. It should be. */
- value = apr_hash_get(headers, HEADER_TYPE, APR_HASH_KEY_STRING);
+ value = svn_hash_gets(headers, HEADER_TYPE);
if (value == NULL || strcmp(value, KIND_DIR) != 0)
return svn_error_create(SVN_ERR_FS_CORRUPT, NULL,
_("Recovery encountered a non-directory node"));
/* Get the data location. No data location indicates an empty directory. */
- value = apr_hash_get(headers, HEADER_TEXT, APR_HASH_KEY_STRING);
+ value = svn_hash_gets(headers, HEADER_TEXT);
if (!value)
return SVN_NO_ERROR;
SVN_ERR(read_rep_offsets(&data_rep, value, NULL, FALSE, pool));
@@ -9015,7 +9057,7 @@ recover_find_max_ids(svn_fs_t *fs, svn_r
/* Return TRUE, if for REVISION in FS, we can find the revprop pack file.
* Use POOL for temporary allocations.
- * Set *MISSING, if the reason is a missing manifest or pack file.
+ * Set *MISSING, if the reason is a missing manifest or pack file.
*/
static svn_boolean_t
packed_revprop_available(svn_boolean_t *missing,
@@ -9361,7 +9403,7 @@ svn_fs_fs__get_node_origin(const svn_fs_
if (node_origins)
{
svn_string_t *origin_id_str =
- apr_hash_get(node_origins, node_id, APR_HASH_KEY_STRING);
+ svn_hash_gets(node_origins, node_id);
if (origin_id_str)
*origin_id = svn_fs_fs__id_parse(origin_id_str->data,
origin_id_str->len, pool);
@@ -9396,7 +9438,7 @@ set_node_origins_for_file(svn_fs_t *fs,
if (! origins_hash)
origins_hash = apr_hash_make(pool);
- old_node_rev_id = apr_hash_get(origins_hash, node_id, APR_HASH_KEY_STRING);
+ old_node_rev_id = svn_hash_gets(origins_hash, node_id);
if (old_node_rev_id && !svn_string_compare(node_rev_id, old_node_rev_id))
return svn_error_createf(SVN_ERR_FS_CORRUPT, NULL,
@@ -9405,7 +9447,7 @@ set_node_origins_for_file(svn_fs_t *fs,
"(%s)"),
node_id, old_node_rev_id->data, node_rev_id->data);
- apr_hash_set(origins_hash, node_id, APR_HASH_KEY_STRING, node_rev_id);
+ svn_hash_sets(origins_hash, node_id, node_rev_id);
/* Sure, there's a race condition here. Two processes could be
trying to add different cache elements to the same file at the
@@ -9586,7 +9628,7 @@ svn_fs_fs__revision_prop(svn_string_t **
SVN_ERR(svn_fs__check_fs(fs, TRUE));
SVN_ERR(svn_fs_fs__revision_proplist(&table, fs, rev, pool));
- *value_p = apr_hash_get(table, propname, APR_HASH_KEY_STRING);
+ *value_p = svn_hash_gets(table, propname);
return SVN_NO_ERROR;
}
@@ -9615,8 +9657,7 @@ change_rev_prop_body(void *baton, apr_po
if (cb->old_value_p)
{
const svn_string_t *wanted_value = *cb->old_value_p;
- const svn_string_t *present_value = apr_hash_get(table, cb->name,
- APR_HASH_KEY_STRING);
+ const svn_string_t *present_value = svn_hash_gets(table, cb->name);
if ((!wanted_value != !present_value)
|| (wanted_value && present_value
&& !svn_string_compare(wanted_value, present_value)))
@@ -9629,7 +9670,7 @@ change_rev_prop_body(void *baton, apr_po
}
/* Fall through. */
}
- apr_hash_set(table, cb->name, APR_HASH_KEY_STRING, cb->value);
+ svn_hash_sets(table, cb->name, cb->value);
return set_revision_proplist(cb->fs, cb->rev, table, pool);
}
@@ -9688,7 +9729,7 @@ svn_fs_fs__txn_prop(svn_string_t **value
SVN_ERR(svn_fs__check_fs(fs, TRUE));
SVN_ERR(svn_fs_fs__txn_proplist(&table, txn, pool));
- *value_p = apr_hash_get(table, propname, APR_HASH_KEY_STRING);
+ *value_p = svn_hash_gets(table, propname);
return SVN_NO_ERROR;
}
@@ -10091,7 +10132,7 @@ delete_revprops_shard(const char *shard_
* for allocations. REVPROPS_DIR will be NULL if revprop packing is not
* supported. COMPRESSION_LEVEL and MAX_PACK_SIZE will be ignored in that
* case.
- *
+ *
* CANCEL_FUNC and CANCEL_BATON are what you think they are; similarly
* NOTIFY_FUNC and NOTIFY_BATON.
*
@@ -10299,7 +10340,7 @@ typedef struct verify_walker_baton_t
{
/* number of calls to verify_walker() since the last clean */
int iteration_count;
-
+
/* number of files opened since the last clean */
int file_count;
@@ -10352,7 +10393,7 @@ verify_walker(representation_t *rep,
}
svn_pool_clear(walker_baton->pool);
-
+
walker_baton->iteration_count = 0;
walker_baton->file_count = 0;
walker_baton->file_hint = NULL;
@@ -10417,8 +10458,8 @@ svn_fs_fs__verify(svn_fs_t *fs,
baton->last_notified_revision = SVN_INVALID_REVNUM;
baton->notify_func = notify_func;
baton->notify_baton = notify_baton;
-
- /* tell the user that we are now read to do *something* */
+
+ /* tell the user that we are now ready to do *something* */
if (notify_func)
notify_func(SVN_INVALID_REVNUM, notify_baton, baton->pool);
@@ -10437,29 +10478,6 @@ svn_fs_fs__verify(svn_fs_t *fs,
return SVN_NO_ERROR;
}
-svn_error_t *
-svn_fs_fs__verify_rev(svn_fs_t *fs,
- svn_revnum_t revision,
- apr_pool_t *pool)
-{
- svn_fs_root_t *root;
-
- /* Issue #4129: bogus pred-counts and minfo-cnt's on the root node-rev
- (and elsewhere). This code makes more thorough checks than the
- commit-time checks in validate_root_noderev(). */
-
- /* ### TODO: Make sure caches are disabled.
-
- When this code is called in the library, we want to ensure we
- use the on-disk data --- rather than some data that was read
- in the possibly-distance past and cached since. */
- SVN_ERR(svn_fs_fs__revision_root(&root, fs, revision, pool));
- SVN_ERR(svn_fs_fs__verify_root(root, pool));
-
- return SVN_NO_ERROR;
-}
-
-
/** Hotcopy. **/
@@ -10478,15 +10496,15 @@ hotcopy_io_dir_file_copy(const char *src
/* Does the destination already exist? If not, we must copy it. */
dst_target = svn_dirent_join(dst_path, file, scratch_pool);
- SVN_ERR(svn_io_stat_dirent(&dst_dirent, dst_target, TRUE,
- scratch_pool, scratch_pool));
+ SVN_ERR(svn_io_stat_dirent2(&dst_dirent, dst_target, FALSE, TRUE,
+ scratch_pool, scratch_pool));
if (dst_dirent->kind != svn_node_none)
{
/* If the destination's stat information indicates that the file
* is equal to the source, don't bother copying the file again. */
src_target = svn_dirent_join(src_path, file, scratch_pool);
- SVN_ERR(svn_io_stat_dirent(&src_dirent, src_target, FALSE,
- scratch_pool, scratch_pool));
+ SVN_ERR(svn_io_stat_dirent2(&src_dirent, src_target, FALSE, FALSE,
+ scratch_pool, scratch_pool));
if (src_dirent->kind == dst_dirent->kind &&
src_dirent->special == dst_dirent->special &&
src_dirent->filesize == dst_dirent->filesize &&
@@ -11449,3 +11467,57 @@ svn_fs_fs__hotcopy(svn_fs_t *src_fs,
return SVN_NO_ERROR;
}
+
+svn_error_t *
+svn_fs_fs__info_format(int *fs_format,
+ svn_version_t **supports_version,
+ svn_fs_t *fs,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
+{
+ fs_fs_data_t *ffd = fs->fsap_data;
+ *fs_format = ffd->format;
+ *supports_version = apr_palloc(result_pool, sizeof(svn_version_t));
+
+ (*supports_version)->major = SVN_VER_MAJOR;
+ (*supports_version)->minor = 1;
+ (*supports_version)->patch = 0;
+ (*supports_version)->tag = "";
+
+ switch (ffd->format)
+ {
+ case 1:
+ break;
+ case 2:
+ (*supports_version)->minor = 4;
+ break;
+ case 3:
+ (*supports_version)->minor = 5;
+ break;
+ case 4:
+ (*supports_version)->minor = 6;
+ break;
+ case 6:
+ (*supports_version)->minor = 8;
+ break;
+#ifdef SVN_DEBUG
+# if SVN_FS_FS__FORMAT_NUMBER != 6
+# error "Need to add a 'case' statement here"
+# endif
+#endif
+ }
+
+ return SVN_NO_ERROR;
+}
+
+svn_error_t *
+svn_fs_fs__info_config_files(apr_array_header_t **files,
+ svn_fs_t *fs,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
+{
+ *files = apr_array_make(result_pool, 1, sizeof(const char *));
+ APR_ARRAY_PUSH(*files, const char *) = svn_dirent_join(fs->path, PATH_CONFIG,
+ result_pool);
+ return SVN_NO_ERROR;
+}
Modified: subversion/branches/master-passphrase/subversion/libsvn_fs_fs/fs_fs.h
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/libsvn_fs_fs/fs_fs.h?rev=1481041&r1=1481040&r2=1481041&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/libsvn_fs_fs/fs_fs.h (original)
+++ subversion/branches/master-passphrase/subversion/libsvn_fs_fs/fs_fs.h Fri May 10 14:58:47 2013
@@ -52,13 +52,6 @@ svn_error_t *svn_fs_fs__verify(svn_fs_t
void *cancel_baton,
apr_pool_t *pool);
-/* Verify metadata of REVISION in filesystem FS.
- * Use POOL for temporary allocations. */
-svn_error_t *
-svn_fs_fs__verify_rev(svn_fs_t *fs,
- svn_revnum_t revision,
- apr_pool_t *pool);
-
/* Copy the fsfs filesystem SRC_FS at SRC_PATH into a new copy DST_FS at
* DST_PATH. If INCREMENTAL is TRUE, do not re-copy data which already
* exists in DST_FS. Use POOL for temporary allocations. */
Modified: subversion/branches/master-passphrase/subversion/libsvn_fs_fs/lock.c
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/libsvn_fs_fs/lock.c?rev=1481041&r1=1481040&r2=1481041&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/libsvn_fs_fs/lock.c (original)
+++ subversion/branches/master-passphrase/subversion/libsvn_fs_fs/lock.c Fri May 10 14:58:47 2013
@@ -105,7 +105,7 @@ hash_fetch(apr_hash_t *hash,
const char *key,
apr_pool_t *pool)
{
- svn_string_t *str = apr_hash_get(hash, key, APR_HASH_KEY_STRING);
+ svn_string_t *str = svn_hash_gets(hash, key);
return str ? str->data : NULL;
}
@@ -324,8 +324,8 @@ read_digest_file(apr_hash_t **children_p
for (i = 0; i < kiddos->nelts; i++)
{
- apr_hash_set(*children_p, APR_ARRAY_IDX(kiddos, i, const char *),
- APR_HASH_KEY_STRING, (void *)1);
+ svn_hash_sets(*children_p, APR_ARRAY_IDX(kiddos, i, const char *),
+ (void *)1);
}
}
return SVN_NO_ERROR;
@@ -387,11 +387,9 @@ set_lock(const char *fs_path,
else
{
/* If we already have an entry for this path, we're done. */
- if (apr_hash_get(this_children, lock_digest_path,
- APR_HASH_KEY_STRING))
+ if (svn_hash_gets(this_children, lock_digest_path))
break;
- apr_hash_set(this_children, lock_digest_path,
- APR_HASH_KEY_STRING, (void *)1);
+ svn_hash_sets(this_children, lock_digest_path, (void *)1);
}
SVN_ERR(write_digest_file(this_children, this_lock, fs_path,
digest_path, perms_reference, subpool));
@@ -448,7 +446,7 @@ delete_lock(svn_fs_t *fs,
}
if (child_to_kill)
- apr_hash_set(this_children, child_to_kill, APR_HASH_KEY_STRING, NULL);
+ svn_hash_sets(this_children, child_to_kill, NULL);
if (! (this_lock || apr_hash_count(this_children) != 0))
{
@@ -690,8 +688,7 @@ verify_lock(svn_fs_t *fs,
_("User '%s' does not own lock on path '%s' (currently locked by '%s')"),
fs->access_ctx->username, lock->path, lock->owner);
- else if (apr_hash_get(fs->access_ctx->lock_tokens, lock->token,
- APR_HASH_KEY_STRING) == NULL)
+ else if (svn_hash_gets(fs->access_ctx->lock_tokens, lock->token) == NULL)
return svn_error_createf
(SVN_ERR_FS_BAD_LOCK_TOKEN, NULL,
_("Cannot verify lock on path '%s'; no matching lock-token available"),
Modified: subversion/branches/master-passphrase/subversion/libsvn_fs_fs/temp_serializer.c
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/libsvn_fs_fs/temp_serializer.c?rev=1481041&r1=1481040&r2=1481041&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/libsvn_fs_fs/temp_serializer.c (original)
+++ subversion/branches/master-passphrase/subversion/libsvn_fs_fs/temp_serializer.c Fri May 10 14:58:47 2013
@@ -360,7 +360,7 @@ deserialize_dir(void *buffer, hash_data_
svn_fs_fs__id_deserialize(entry, (svn_fs_id_t **)&entry->id);
/* add the entry to the hash */
- apr_hash_set(result, entry->name, APR_HASH_KEY_STRING, entry);
+ svn_hash_sets(result, entry->name, entry);
}
/* return the now complete hash */
@@ -949,10 +949,7 @@ slowly_replace_dir_entry(void **data,
*data,
hash_data->len,
pool));
- apr_hash_set(dir,
- replace_baton->name,
- APR_HASH_KEY_STRING,
- replace_baton->new_entry);
+ svn_hash_sets(dir, replace_baton->name, replace_baton->new_entry);
return svn_fs_fs__serialize_dir_entries(data, data_len, dir, pool);
}
@@ -1201,13 +1198,13 @@ typedef struct mergeinfo_data_t
{
/* number of paths in the hash */
unsigned count;
-
+
/* COUNT keys (paths) */
const char **keys;
-
+
/* COUNT keys lengths (strlen of path) */
apr_ssize_t *key_lengths;
-
+
/* COUNT entries, each giving the number of ranges for the key */
int *range_counts;
@@ -1259,7 +1256,7 @@ svn_fs_fs__serialize_mergeinfo(void **da
for (k = 0; k < ranges->nelts; ++k, ++i)
merges.ranges[i] = *APR_ARRAY_IDX(ranges, k, svn_merge_range_t*);
}
-
+
/* serialize it and all its elements */
context = svn_temp_serializer__init(&merges,
sizeof(merges),
@@ -1313,7 +1310,7 @@ svn_fs_fs__deserialize_mergeinfo(void **
int k, n;
mergeinfo_data_t *merges = (mergeinfo_data_t *)data;
svn_mergeinfo_t mergeinfo;
-
+
/* de-serialize our auxiliary data structure */
svn_temp_deserializer__resolve(merges, (void**)&merges->keys);
svn_temp_deserializer__resolve(merges, (void**)&merges->key_lengths);
@@ -1330,7 +1327,7 @@ svn_fs_fs__deserialize_mergeinfo(void **
sizeof(svn_merge_range_t*));
for (k = 0; k < merges->range_counts[i]; ++k, ++n)
APR_ARRAY_PUSH(ranges, svn_merge_range_t*) = &merges->ranges[n];
-
+
svn_temp_deserializer__resolve((void*)merges->keys,
(void**)&merges->keys[i]);
apr_hash_set(mergeinfo, merges->keys[i], merges->key_lengths[i], ranges);
Modified: subversion/branches/master-passphrase/subversion/libsvn_fs_fs/tree.c
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/libsvn_fs_fs/tree.c?rev=1481041&r1=1481040&r2=1481041&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/libsvn_fs_fs/tree.c (original)
+++ subversion/branches/master-passphrase/subversion/libsvn_fs_fs/tree.c Fri May 10 14:58:47 2013
@@ -41,6 +41,7 @@
#include <apr_pools.h>
#include <apr_hash.h>
+#include "svn_hash.h"
#include "svn_private_config.h"
#include "svn_pools.h"
#include "svn_error.h"
@@ -115,6 +116,8 @@ typedef struct fs_rev_root_data_t
typedef struct fs_txn_root_data_t
{
+ const char *txn_id;
+
/* Cache of txn DAG nodes (without their nested noderevs, because
* it's mutable). Same keys/values as ffd->rev_node_cache. */
svn_cache__t *txn_node_cache;
@@ -183,7 +186,7 @@ typedef struct cache_lock_t
{
/* pool holding the lock */
apr_pool_t *pool;
-
+
/* cache being locked */
fs_fs_dag_cache_t *cache;
@@ -198,7 +201,7 @@ typedef struct cache_lock_t
When the number of INSERTIONS (i.e. objects created form that pool)
exceeds a certain threshold, the pool will be cleared and the cache
with it.
-
+
To ensure that nodes returned from this structure remain valid, the
cache will get locked for the lifetime of the _receiving_ pools (i.e.
those in which we would allocate the node if there was no cache.).
@@ -269,7 +272,7 @@ svn_fs_fs__create_dag_cache(apr_pool_t *
result,
unregister_locks,
apr_pool_cleanup_null);
-
+
return result;
}
@@ -352,7 +355,7 @@ cache_lookup( fs_fs_dag_cache_t *cache
(HASH_VALUE has been initialized to REVISION). */
for (i = 0; i + 4 <= path_len; i += 4)
hash_value = hash_value * 0xd1f3da69 + *(const apr_uint32_t*)(path + i);
-
+
for (; i < path_len; ++i)
hash_value = hash_value * 33 + path[i];
@@ -413,7 +416,7 @@ locate_cache(svn_cache__t **cache,
/* Return NODE for PATH from ROOT's node cache, or NULL if the node
isn't cached; read it from the FS. *NODE remains valid until either
- POOL or the FS gets cleared or destroyed (whichever comes first).
+ POOL or the FS gets cleared or destroyed (whichever comes first).
Since locking can be expensive and POOL may be long-living, for
nodes that will not need to survive the next call to this function,
@@ -435,7 +438,7 @@ dag_node_cache_get(dag_node_t **node_p,
if (!root->is_txn_root)
{
/* immutable DAG node. use the global caches for it */
-
+
fs_fs_data_t *ffd = root->fs->fsap_data;
cache_entry_t *bucket;
@@ -467,7 +470,7 @@ dag_node_cache_get(dag_node_t **node_p,
else
{
/* DAG is mutable / may become invalid. Use the TXN-local cache */
-
+
locate_cache(&cache, &key, root, path, pool);
SVN_ERR(svn_cache__get((void **) &node, &found, cache, key, pool));
@@ -585,12 +588,10 @@ svn_fs_fs__txn_root(svn_fs_root_t **root
SVN_ERR(svn_fs_fs__txn_proplist(&txnprops, txn, pool));
if (txnprops)
{
- if (apr_hash_get(txnprops, SVN_FS__PROP_TXN_CHECK_OOD,
- APR_HASH_KEY_STRING))
+ if (svn_hash_gets(txnprops, SVN_FS__PROP_TXN_CHECK_OOD))
flags |= SVN_FS_TXN_CHECK_OOD;
- if (apr_hash_get(txnprops, SVN_FS__PROP_TXN_CHECK_LOCKS,
- APR_HASH_KEY_STRING))
+ if (svn_hash_gets(txnprops, SVN_FS__PROP_TXN_CHECK_LOCKS))
flags |= SVN_FS_TXN_CHECK_LOCKS;
}
@@ -903,8 +904,6 @@ open_path(parent_path_t **parent_path_p,
dag_node_t *here = NULL; /* The directory we're currently looking at. */
parent_path_t *parent_path; /* The path from HERE up to the root. */
const char *rest; /* The portion of PATH we haven't traversed yet. */
-
- /* ensure a canonical path representation */
const char *path_so_far = "/";
apr_pool_t *iterpool = svn_pool_create(pool);
@@ -912,7 +911,7 @@ open_path(parent_path_t **parent_path_p,
a sibling of PATH has been presently accessed. Try to start the lookup
directly at the parent node, if the caller did not requested the full
parent chain. */
- const char *directory;
+ const char *directory = NULL;
assert(svn_fs__is_canonical_abspath(path));
if (flags & open_path_node_only)
{
@@ -934,7 +933,7 @@ open_path(parent_path_t **parent_path_p,
SVN_ERR(root_node(&here, root, pool));
rest = path + 1; /* skip the leading '/', it saves in iteration */
}
-
+
parent_path = make_parent_path(here, 0, 0, pool);
parent_path->copy_inherit = copy_id_inherit_self;
@@ -1359,7 +1358,7 @@ fs_node_prop(svn_string_t **value_p,
SVN_ERR(svn_fs_fs__dag_get_proplist(&proplist, node, pool));
*value_p = NULL;
if (proplist)
- *value_p = apr_hash_get(proplist, propname, APR_HASH_KEY_STRING);
+ *value_p = svn_hash_gets(proplist, propname);
return SVN_NO_ERROR;
}
@@ -1460,7 +1459,7 @@ fs_change_node_prop(svn_fs_root_t *root,
}
/* Set the property. */
- apr_hash_set(proplist, name, APR_HASH_KEY_STRING, value);
+ svn_hash_sets(proplist, name, value);
/* Overwrite the node's proplist. */
SVN_ERR(svn_fs_fs__dag_set_proplist(parent_path->node, proplist,
@@ -2177,6 +2176,67 @@ fs_dir_entries(apr_hash_t **table_p,
return svn_fs_fs__dag_dir_entries(table_p, node, pool);
}
+/* Return a copy of PATH, allocated from POOL, for which newlines
+ have been escaped using the form \NNN (where NNN is the
+ octal representation of the byte's ordinal value). */
+static const char *
+escape_newline(const char *path, apr_pool_t *pool)
+{
+ svn_stringbuf_t *retstr;
+ apr_size_t i, copied = 0;
+ int c;
+
+ /* At least one control character:
+ strlen - 1 (control) + \ + N + N + N + null . */
+ retstr = svn_stringbuf_create_ensure(strlen(path) + 4, pool);
+ for (i = 0; path[i]; i++)
+ {
+ c = (unsigned char)path[i];
+ if (c != '\n')
+ continue;
+
+ /* First things first, copy all the good stuff that we haven't
+ yet copied into our output buffer. */
+ if (i - copied)
+ svn_stringbuf_appendbytes(retstr, path + copied,
+ i - copied);
+
+ /* Make sure buffer is big enough for '\' 'N' 'N' 'N' (and NUL) */
+ svn_stringbuf_ensure(retstr, retstr->len + 4);
+ /*### The backslash separator doesn't work too great with Windows,
+ but it's what we'll use for consistency with invalid utf8
+ formatting (until someone has a better idea) */
+ apr_snprintf(retstr->data + retstr->len, 5, "\\%03o", (unsigned char)c);
+ retstr->len += 4;
+
+ /* Finally, update our copy counter. */
+ copied = i + 1;
+ }
+
+ /* Anything left to copy? */
+ if (i - copied)
+ svn_stringbuf_appendbytes(retstr, path + copied, i - copied);
+
+ /* retstr is null-terminated either by apr_snprintf or the svn_stringbuf
+ functions. */
+
+ return retstr->data;
+}
+
+/* Raise an error if PATH contains a newline because FSFS cannot handle
+ * such paths. See issue #4340. */
+static svn_error_t *
+check_newline(const char *path, apr_pool_t *pool)
+{
+ char *c = strchr(path, '\n');
+
+ if (c)
+ return svn_error_createf(SVN_ERR_FS_PATH_SYNTAX, NULL,
+ _("Invalid control character '0x%02x' in path '%s'"),
+ (unsigned char)*c, escape_newline(path, pool));
+
+ return SVN_NO_ERROR;
+}
/* Create a new directory named PATH in ROOT. The new directory has
no entries, and no properties. ROOT must be the root of a
@@ -2191,6 +2251,8 @@ fs_make_dir(svn_fs_root_t *root,
dag_node_t *sub_dir;
const char *txn_id = root->txn;
+ SVN_ERR(check_newline(path, pool));
+
path = svn_fs__canonicalize_abspath(path, pool);
SVN_ERR(open_path(&parent_path, root, path, open_path_last_optional,
txn_id, pool));
@@ -2443,6 +2505,8 @@ fs_copy(svn_fs_root_t *from_root,
const char *to_path,
apr_pool_t *pool)
{
+ SVN_ERR(check_newline(to_path, pool));
+
return svn_error_trace(copy_helper(from_root,
svn_fs__canonicalize_abspath(from_path,
pool),
@@ -2490,7 +2554,7 @@ fs_copied_from(svn_revnum_t *rev_p,
entry. */
if (! root->is_txn_root) {
fs_rev_root_data_t *frd = root->fsap_data;
- copyfrom_str = apr_hash_get(frd->copyfrom_cache, path, APR_HASH_KEY_STRING);
+ copyfrom_str = svn_hash_gets(frd->copyfrom_cache, path);
}
if (copyfrom_str)
@@ -2541,6 +2605,8 @@ fs_make_file(svn_fs_root_t *root,
dag_node_t *child;
const char *txn_id = root->txn;
+ SVN_ERR(check_newline(path, pool));
+
path = svn_fs__canonicalize_abspath(path, pool);
SVN_ERR(open_path(&parent_path, root, path, open_path_last_optional,
txn_id, pool));
@@ -3751,8 +3817,7 @@ crawl_directory_dag_for_mergeinfo(svn_fs
svn_error_t *err;
SVN_ERR(svn_fs_fs__dag_get_proplist(&proplist, kid_dag, iterpool));
- mergeinfo_string = apr_hash_get(proplist, SVN_PROP_MERGEINFO,
- APR_HASH_KEY_STRING);
+ mergeinfo_string = svn_hash_gets(proplist, SVN_PROP_MERGEINFO);
if (!mergeinfo_string)
{
svn_string_t *idstr = svn_fs_fs__id_unparse(dirent->id, iterpool);
@@ -3777,10 +3842,8 @@ crawl_directory_dag_for_mergeinfo(svn_fs
}
else
{
- apr_hash_set(result_catalog,
- apr_pstrdup(result_pool, kid_path),
- APR_HASH_KEY_STRING,
- kid_mergeinfo);
+ svn_hash_sets(result_catalog, apr_pstrdup(result_pool, kid_path),
+ kid_mergeinfo);
}
}
@@ -3812,7 +3875,7 @@ mergeinfo_cache_key(const char *path,
number = number * 4
+ (inherit == svn_mergeinfo_nearest_ancestor ? 2 : 0)
+ (adjust_inherited_mergeinfo ? 1 : 0);
-
+
return svn_fs_fs__combine_number_and_string(number, path, pool);
}
@@ -3872,8 +3935,7 @@ get_mergeinfo_for_path_internal(svn_merg
SVN_ERR(svn_fs_fs__dag_get_proplist(&proplist, nearest_ancestor->node,
scratch_pool));
- mergeinfo_string = apr_hash_get(proplist, SVN_PROP_MERGEINFO,
- APR_HASH_KEY_STRING);
+ mergeinfo_string = svn_hash_gets(proplist, SVN_PROP_MERGEINFO);
if (!mergeinfo_string)
return svn_error_createf
(SVN_ERR_FS_CORRUPT, NULL,
@@ -3952,7 +4014,7 @@ get_mergeinfo_for_path(svn_mergeinfo_t *
ffd->mergeinfo_cache,
cache_key, result_pool));
}
-
+
if (! found)
{
SVN_ERR(get_mergeinfo_for_path_internal(mergeinfo, rev_root, path,
@@ -4044,8 +4106,7 @@ get_mergeinfos_for_paths(svn_fs_root_t *
}
if (path_mergeinfo)
- apr_hash_set(result_catalog, path, APR_HASH_KEY_STRING,
- path_mergeinfo);
+ svn_hash_sets(result_catalog, path, path_mergeinfo);
if (include_descendants)
SVN_ERR(add_descendant_mergeinfo(result_catalog, root, path,
result_pool, scratch_pool));
@@ -4181,6 +4242,8 @@ make_txn_root(svn_fs_root_t **root_p,
root->txn_flags = flags;
root->rev = base_rev;
+ frd->txn_id = txn;
+
/* Because this cache actually tries to invalidate elements, keep
the number of elements per page down.
@@ -4331,23 +4394,41 @@ svn_error_t *
svn_fs_fs__verify_root(svn_fs_root_t *root,
apr_pool_t *pool)
{
- fs_rev_root_data_t *frd;
+ svn_fs_t *fs = root->fs;
+ dag_node_t *root_dir;
+
+ /* Issue #4129: bogus pred-counts and minfo-cnt's on the root node-rev
+ (and elsewhere). This code makes more thorough checks than the
+ commit-time checks in validate_root_noderev(). */
+
+ /* Callers should disable caches by setting SVN_FS_CONFIG_FSFS_CACHE_NS;
+ see r1462436.
+
+ When this code is called in the library, we want to ensure we
+ use the on-disk data --- rather than some data that was read
+ in the possibly-distance past and cached since. */
if (root->is_txn_root)
- /* ### Not implemented */
- return SVN_NO_ERROR;
- frd = root->fsap_data;
+ {
+ fs_txn_root_data_t *frd = root->fsap_data;
+ SVN_ERR(svn_fs_fs__dag_txn_root(&root_dir, fs, frd->txn_id, pool));
+ }
+ else
+ {
+ fs_rev_root_data_t *frd = root->fsap_data;
+ root_dir = frd->root_dir;
+ }
/* Recursively verify ROOT_DIR. */
- SVN_ERR(verify_node(frd->root_dir, root->rev, pool));
+ SVN_ERR(verify_node(root_dir, root->rev, pool));
/* Verify explicitly the predecessor of the root. */
{
const svn_fs_id_t *pred_id;
/* Only r0 should have no predecessor. */
- SVN_ERR(svn_fs_fs__dag_get_predecessor_id(&pred_id, frd->root_dir));
- if (!!pred_id != !!root->rev)
+ SVN_ERR(svn_fs_fs__dag_get_predecessor_id(&pred_id, root_dir));
+ if (! root->is_txn_root && !!pred_id != !!root->rev)
return svn_error_createf(SVN_ERR_FS_CORRUPT, NULL,
"r%ld's root node's predecessor is "
"unexpectedly '%s'",
@@ -4355,17 +4436,28 @@ svn_fs_fs__verify_root(svn_fs_root_t *ro
(pred_id
? svn_fs_fs__id_unparse(pred_id, pool)->data
: "(null)"));
+ if (root->is_txn_root && !pred_id)
+ return svn_error_createf(SVN_ERR_FS_CORRUPT, NULL,
+ "Transaction '%s''s root node's predecessor is "
+ "unexpectedly NULL",
+ root->txn);
/* Check the predecessor's revision. */
if (pred_id)
{
svn_revnum_t pred_rev = svn_fs_fs__id_rev(pred_id);
- if (pred_rev+1 != root->rev)
+ if (! root->is_txn_root && pred_rev+1 != root->rev)
/* Issue #4129. */
return svn_error_createf(SVN_ERR_FS_CORRUPT, NULL,
"r%ld's root node's predecessor is r%ld"
" but should be r%ld",
root->rev, pred_rev, root->rev - 1);
+ if (root->is_txn_root && pred_rev != root->rev)
+ return svn_error_createf(SVN_ERR_FS_CORRUPT, NULL,
+ "Transaction '%s''s root node's predecessor"
+ " is r%ld"
+ " but should be r%ld",
+ root->txn, pred_rev, root->rev);
}
}
Modified: subversion/branches/master-passphrase/subversion/libsvn_fs_fs/tree.h
URL: http://svn.apache.org/viewvc/subversion/branches/master-passphrase/subversion/libsvn_fs_fs/tree.h?rev=1481041&r1=1481040&r2=1481041&view=diff
==============================================================================
--- subversion/branches/master-passphrase/subversion/libsvn_fs_fs/tree.h (original)
+++ subversion/branches/master-passphrase/subversion/libsvn_fs_fs/tree.h Fri May 10 14:58:47 2013
@@ -91,6 +91,20 @@ svn_error_t *
svn_fs_fs__verify_root(svn_fs_root_t *root,
apr_pool_t *pool);
+svn_error_t *
+svn_fs_fs__info_format(int *fs_format,
+ svn_version_t **supports_version,
+ svn_fs_t *fs,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool);
+
+
+svn_error_t *
+svn_fs_fs__info_config_files(apr_array_header_t **files,
+ svn_fs_t *fs,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */