summaryrefslogtreecommitdiff
path: root/subversion/libsvn_fs_base/fs.c
diff options
context:
space:
mode:
Diffstat (limited to 'subversion/libsvn_fs_base/fs.c')
-rw-r--r--subversion/libsvn_fs_base/fs.c149
1 files changed, 123 insertions, 26 deletions
diff --git a/subversion/libsvn_fs_base/fs.c b/subversion/libsvn_fs_base/fs.c
index 4ad9e6f..06dfbaf 100644
--- a/subversion/libsvn_fs_base/fs.c
+++ b/subversion/libsvn_fs_base/fs.c
@@ -65,8 +65,6 @@
#include "../libsvn_fs/fs-loader.h"
#include "private/svn_fs_util.h"
-#include "private/svn_subr_private.h"
-
/* Checking for return values, and reporting errors. */
@@ -473,6 +471,59 @@ bdb_write_config(svn_fs_t *fs)
}
static svn_error_t *
+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)
{
@@ -509,6 +560,9 @@ static fs_vtable_t fs_vtable = {
svn_fs_base__unlock,
svn_fs_base__get_lock,
svn_fs_base__get_locks,
+ base_bdb_info_format,
+ base_bdb_info_config_files,
+ NULL /* info_fsap */,
base_bdb_verify_root,
base_bdb_freeze,
base_bdb_set_errcall,
@@ -675,7 +729,10 @@ populate_opened_fs(svn_fs_t *fs, apr_pool_t *scratch_pool)
}
static svn_error_t *
-base_create(svn_fs_t *fs, const char *path, apr_pool_t *pool,
+base_create(svn_fs_t *fs,
+ const char *path,
+ svn_mutex__t *common_pool_lock,
+ apr_pool_t *pool,
apr_pool_t *common_pool)
{
int format = SVN_FS_BASE__FORMAT_NUMBER;
@@ -684,12 +741,27 @@ base_create(svn_fs_t *fs, const char *path, apr_pool_t *pool,
/* See if compatibility with older versions was explicitly requested. */
if (fs->config)
{
- if (svn_hash_gets(fs->config, SVN_FS_CONFIG_PRE_1_4_COMPATIBLE))
- format = 1;
- else if (svn_hash_gets(fs->config, SVN_FS_CONFIG_PRE_1_5_COMPATIBLE))
- format = 2;
- else if (svn_hash_gets(fs->config, SVN_FS_CONFIG_PRE_1_6_COMPATIBLE))
- format = 3;
+ svn_version_t *compatible_version;
+ SVN_ERR(svn_fs__compatible_version(&compatible_version, fs->config,
+ pool));
+
+ /* select format number */
+ switch(compatible_version->minor)
+ {
+ case 0:
+ case 1:
+ case 2:
+ case 3: format = 1;
+ break;
+
+ case 4: format = 2;
+ break;
+
+ case 5: format = 3;
+ break;
+
+ default:format = SVN_FS_BASE__FORMAT_NUMBER;
+ }
}
/* Create the environment and databases. */
@@ -711,8 +783,8 @@ base_create(svn_fs_t *fs, const char *path, apr_pool_t *pool,
return SVN_NO_ERROR;;
error:
- svn_error_clear(cleanup_fs(fs));
- return svn_err;
+ return svn_error_compose_create(svn_err,
+ svn_error_trace(cleanup_fs(fs)));
}
@@ -751,7 +823,10 @@ check_format(int format)
}
static svn_error_t *
-base_open(svn_fs_t *fs, const char *path, apr_pool_t *pool,
+base_open(svn_fs_t *fs,
+ const char *path,
+ svn_mutex__t *common_pool_lock,
+ apr_pool_t *pool,
apr_pool_t *common_pool)
{
int format;
@@ -796,8 +871,8 @@ base_open(svn_fs_t *fs, const char *path, apr_pool_t *pool,
return SVN_NO_ERROR;
error:
- svn_error_clear(cleanup_fs(fs));
- return svn_err;
+ return svn_error_compose_create(svn_err,
+ svn_error_trace(cleanup_fs(fs)));
}
@@ -834,7 +909,10 @@ bdb_recover(const char *path, svn_boolean_t fatal, apr_pool_t *pool)
}
static svn_error_t *
-base_open_for_recovery(svn_fs_t *fs, const char *path, apr_pool_t *pool,
+base_open_for_recovery(svn_fs_t *fs,
+ const char *path,
+ svn_mutex__t *common_pool_lock,
+ apr_pool_t *pool,
apr_pool_t *common_pool)
{
/* Just stash the path in the fs pointer - it's all we really need. */
@@ -844,7 +922,14 @@ base_open_for_recovery(svn_fs_t *fs, const char *path, apr_pool_t *pool,
}
static svn_error_t *
-base_upgrade(svn_fs_t *fs, const char *path, apr_pool_t *pool,
+base_upgrade(svn_fs_t *fs,
+ const char *path,
+ svn_fs_upgrade_notify_t notify_func,
+ void *notify_baton,
+ svn_cancel_func_t cancel_func,
+ void *cancel_baton,
+ svn_mutex__t *common_pool_lock,
+ apr_pool_t *pool,
apr_pool_t *common_pool)
{
const char *version_file_path;
@@ -867,6 +952,9 @@ base_upgrade(svn_fs_t *fs, const char *path, apr_pool_t *pool,
/* Bump the format file's stored version number. */
SVN_ERR(svn_io_write_version_file(version_file_path,
SVN_FS_BASE__FORMAT_NUMBER, pool));
+ if (notify_func)
+ SVN_ERR(notify_func(notify_baton, SVN_FS_BASE__FORMAT_NUMBER,
+ svn_fs_upgrade_format_bumped, pool));
/* Check and see if we need to record the "bump" revision. */
if (old_format_number < SVN_FS_BASE__MIN_FORWARD_DELTAS_FORMAT)
@@ -883,7 +971,7 @@ base_upgrade(svn_fs_t *fs, const char *path, apr_pool_t *pool,
But it's better to use the existing encapsulation of "opening
the filesystem" rather than duplicating (or worse, partially
duplicating) that logic here. */
- SVN_ERR(base_open(fs, path, subpool, common_pool));
+ SVN_ERR(base_open(fs, path, common_pool_lock, subpool, common_pool));
/* Fetch the youngest rev, and record it */
SVN_ERR(svn_fs_base__youngest_rev(&youngest_rev, fs, subpool));
@@ -905,6 +993,7 @@ base_verify(svn_fs_t *fs, const char *path,
void *notify_baton,
svn_cancel_func_t cancel_func,
void *cancel_baton,
+ svn_mutex__t *common_pool_lock,
apr_pool_t *pool,
apr_pool_t *common_pool)
{
@@ -929,6 +1018,7 @@ base_bdb_pack(svn_fs_t *fs,
void *notify_baton,
svn_cancel_func_t cancel,
void *cancel_baton,
+ svn_mutex__t *common_pool_lock,
apr_pool_t *pool,
apr_pool_t *common_pool)
{
@@ -994,7 +1084,7 @@ svn_fs_base__clean_logs(const char *live_path,
{ /* Process unused logs from live area */
int idx;
- apr_pool_t *sub_pool = svn_pool_create(pool);
+ apr_pool_t *subpool = svn_pool_create(pool);
/* Process log files. */
for (idx = 0; idx < logfiles->nelts; idx++)
@@ -1003,9 +1093,9 @@ svn_fs_base__clean_logs(const char *live_path,
const char *live_log_path;
const char *backup_log_path;
- svn_pool_clear(sub_pool);
- live_log_path = svn_dirent_join(live_path, log_file, sub_pool);
- backup_log_path = svn_dirent_join(backup_path, log_file, sub_pool);
+ svn_pool_clear(subpool);
+ live_log_path = svn_dirent_join(live_path, log_file, subpool);
+ backup_log_path = svn_dirent_join(backup_path, log_file, subpool);
{ /* Compare files. No point in using MD5 and wasting CPU cycles as we
got full copies of both logs */
@@ -1022,17 +1112,17 @@ svn_fs_base__clean_logs(const char *live_path,
SVN_ERR(svn_io_files_contents_same_p(&files_match,
live_log_path,
backup_log_path,
- sub_pool));
+ subpool));
/* If log files do not match, go to the next log file. */
if (!files_match)
continue;
}
- SVN_ERR(svn_io_remove_file2(live_log_path, FALSE, sub_pool));
+ SVN_ERR(svn_io_remove_file2(live_log_path, FALSE, subpool));
}
- svn_pool_destroy(sub_pool);
+ svn_pool_destroy(subpool);
}
return SVN_NO_ERROR;
@@ -1201,9 +1291,13 @@ base_hotcopy(svn_fs_t *src_fs,
const char *dest_path,
svn_boolean_t clean_logs,
svn_boolean_t incremental,
+ svn_fs_hotcopy_notify_t notify_func,
+ void *notify_baton,
svn_cancel_func_t cancel_func,
void *cancel_baton,
- apr_pool_t *pool)
+ svn_mutex__t *common_pool_lock,
+ apr_pool_t *pool,
+ apr_pool_t *common_pool)
{
svn_error_t *err;
u_int32_t pagesize;
@@ -1388,6 +1482,7 @@ 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 *,
apr_pool_t *))
{
return SVN_NO_ERROR;
@@ -1409,7 +1504,8 @@ static fs_library_vtable_t library_vtable = {
base_bdb_pack,
base_bdb_logfiles,
svn_fs_base__id_parse,
- base_set_svn_fs_open
+ base_set_svn_fs_open,
+ NULL /* info_fsap_dup */
};
svn_error_t *
@@ -1420,6 +1516,7 @@ svn_fs_base__init(const svn_version_t *loader_version,
{
{ "svn_subr", svn_subr_version },
{ "svn_delta", svn_delta_version },
+ { "svn_fs_util", svn_fs_util__version },
{ NULL, NULL }
};