Index: subversion/libsvn_fs_base/tree.c =================================================================== --- subversion/libsvn_fs_base/tree.c (revision 24569) +++ subversion/libsvn_fs_base/tree.c (working copy) @@ -369,7 +369,7 @@ struct revision_root_args args; svn_fs_root_t *root; - SVN_ERR(svn_fs_base__check_fs(fs)); + SVN_ERR(svn_fs__check_fs(fs)); args.root_p = &root; args.rev = rev; @@ -465,7 +465,7 @@ trail, pool); else /* If it's not a transaction root, we can't change its contents. */ - return svn_fs_base__err_not_mutable(root->fs, root->rev, error_path); + return svn_fs__err_not_mutable(root->fs, root->rev, error_path); } @@ -831,7 +831,7 @@ /* The path isn't finished yet; we'd better be in a directory. */ if (svn_fs_base__dag_node_kind(child) != svn_node_dir) - SVN_ERR_W(svn_fs_base__err_not_directory(fs, path_so_far), + SVN_ERR_W(svn_fs__err_not_directory(fs, path_so_far), apr_psprintf(pool, _("Failure opening '%s'"), path)); rest = next; @@ -1927,7 +1927,7 @@ } /* We have the same fs, now check it. */ - SVN_ERR(svn_fs_base__check_fs(fs)); + SVN_ERR(svn_fs__check_fs(fs)); source_id = svn_fs_base__dag_get_id(source); target_id = svn_fs_base__dag_get_id(target); Index: subversion/libsvn_fs_base/bdb/locks-table.c =================================================================== --- subversion/libsvn_fs_base/bdb/locks-table.c (revision 24569) +++ subversion/libsvn_fs_base/bdb/locks-table.c (working copy) @@ -31,6 +31,7 @@ #include "locks-table.h" #include "lock-tokens-table.h" +#include "private/svn_fs_util.h" int @@ -148,7 +149,7 @@ if (lock->expiration_date && (apr_time_now() > lock->expiration_date)) { SVN_ERR(svn_fs_bdb__lock_delete(fs, lock_token, trail, pool)); - return svn_fs_base__err_lock_expired(fs, lock_token); + return svn_fs__err_lock_expired(fs, lock_token); } *lock_p = lock; Index: subversion/libsvn_fs_base/bdb/lock-tokens-table.c =================================================================== --- subversion/libsvn_fs_base/bdb/lock-tokens-table.c (revision 24569) +++ subversion/libsvn_fs_base/bdb/lock-tokens-table.c (working copy) @@ -31,7 +31,9 @@ #include "lock-tokens-table.h" #include "locks-table.h" +#include "private/svn_fs_util.h" + int svn_fs_bdb__open_lock_tokens_table(DB **lock_tokens_p, DB_ENV *env, @@ -97,7 +99,7 @@ svn_fs_base__trail_debug(trail, "lock-tokens", "del"); db_err = bfd->lock_tokens->del(bfd->lock_tokens, trail->db_txn, &key, 0); if (db_err == DB_NOTFOUND) - return svn_fs_base__err_no_such_lock(fs, path); + return svn_fs__err_no_such_lock(fs, path); SVN_ERR(BDB_WRAP(fs, "deleting entry from 'lock-tokens' table", db_err)); return SVN_NO_ERROR; @@ -126,7 +128,7 @@ svn_fs_base__track_dbt(&value, pool); if (db_err == DB_NOTFOUND) - return svn_fs_base__err_no_such_lock(fs, path); + return svn_fs__err_no_such_lock(fs, path); SVN_ERR(BDB_WRAP(fs, "reading lock token", db_err)); lock_token = apr_pstrmemdup(pool, value.data, value.size); Index: subversion/libsvn_fs_base/bdb/rev-table.c =================================================================== --- subversion/libsvn_fs_base/bdb/rev-table.c (revision 24569) +++ subversion/libsvn_fs_base/bdb/rev-table.c (working copy) @@ -27,6 +27,7 @@ #include "rev-table.h" #include "svn_private_config.h" +#include "private/svn_fs_util.h" /* Opening/creating the `revisions' table. */ @@ -164,7 +165,7 @@ DBT key, value; db_recno_t recno; - SVN_ERR(svn_fs_base__check_fs(fs)); + SVN_ERR(svn_fs__check_fs(fs)); /* Create a database cursor. */ svn_fs_base__trail_debug(trail, "revisions", "cursor"); Index: subversion/libsvn_fs_base/uuid.c =================================================================== --- subversion/libsvn_fs_base/uuid.c (revision 24569) +++ subversion/libsvn_fs_base/uuid.c (working copy) @@ -24,7 +24,9 @@ #include "bdb/uuids-table.h" #include "../libsvn_fs/fs-loader.h" +#include "private/svn_fs_util.h" + struct get_uuid_args { int idx; @@ -48,7 +50,7 @@ { base_fs_data_t *bfd = fs->fsap_data; - SVN_ERR(svn_fs_base__check_fs(fs)); + SVN_ERR(svn_fs__check_fs(fs)); /* Check for a cached UUID first. Failing that, we hit the database. */ @@ -96,7 +98,7 @@ struct set_uuid_args args; base_fs_data_t *bfd = fs->fsap_data; - SVN_ERR(svn_fs_base__check_fs(fs)); + SVN_ERR(svn_fs__check_fs(fs)); args.idx = 1; args.uuid = uuid; Index: subversion/libsvn_fs_base/fs.c =================================================================== --- subversion/libsvn_fs_base/fs.c (revision 24569) +++ subversion/libsvn_fs_base/fs.c (working copy) @@ -58,6 +58,7 @@ #include "../libsvn_fs/fs-loader.h" #include "private/svn_fs_merge_info.h" +#include "private/svn_fs_util.h" /* Checking for return values, and reporting errors. */ @@ -310,7 +311,7 @@ { base_fs_data_t *bfd = fs->fsap_data; - SVN_ERR(svn_fs_base__check_fs(fs)); + SVN_ERR(svn_fs__check_fs(fs)); bfd->bdb->error_info->user_callback = db_errcall_fcn; return SVN_NO_ERROR; Index: subversion/libsvn_fs_base/revs-txns.c =================================================================== --- subversion/libsvn_fs_base/revs-txns.c (revision 24569) +++ subversion/libsvn_fs_base/revs-txns.c (working copy) @@ -43,6 +43,7 @@ #include "../libsvn_fs/fs-loader.h" #include "svn_private_config.h" +#include "private/svn_fs_util.h" /*** Helpers ***/ @@ -159,7 +160,7 @@ apr_pool_t *pool) { svn_revnum_t youngest; - SVN_ERR(svn_fs_base__check_fs(fs)); + SVN_ERR(svn_fs__check_fs(fs)); SVN_ERR(svn_fs_base__retry_txn(fs, txn_body_youngest_rev, &youngest, pool)); *youngest_p = youngest; @@ -194,7 +195,7 @@ struct revision_proplist_args args; apr_hash_t *table; - SVN_ERR(svn_fs_base__check_fs(fs)); + SVN_ERR(svn_fs__check_fs(fs)); args.table_p = &table; args.rev = rev; @@ -216,7 +217,7 @@ struct revision_proplist_args args; apr_hash_t *table; - SVN_ERR(svn_fs_base__check_fs(fs)); + SVN_ERR(svn_fs__check_fs(fs)); /* Get the proplist. */ args.table_p = &table; @@ -291,7 +292,7 @@ { struct change_rev_prop_args args; - SVN_ERR(svn_fs_base__check_fs(fs)); + SVN_ERR(svn_fs__check_fs(fs)); args.rev = rev; args.name = name; @@ -486,7 +487,7 @@ apr_hash_t *table; svn_fs_t *fs = txn->fs; - SVN_ERR(svn_fs_base__check_fs(fs)); + SVN_ERR(svn_fs__check_fs(fs)); args.table_p = &table; args.id = txn->id; @@ -507,7 +508,7 @@ apr_hash_t *table; svn_fs_t *fs = txn->fs; - SVN_ERR(svn_fs_base__check_fs(fs)); + SVN_ERR(svn_fs__check_fs(fs)); /* Get the proplist. */ args.table_p = &table; @@ -636,7 +637,7 @@ struct change_txn_prop_args args; svn_fs_t *fs = txn->fs; - SVN_ERR(svn_fs_base__check_fs(fs)); + SVN_ERR(svn_fs__check_fs(fs)); args.id = txn->id; args.name = name; @@ -767,7 +768,7 @@ struct begin_txn_args args; svn_string_t date; - SVN_ERR(svn_fs_base__check_fs(fs)); + SVN_ERR(svn_fs__check_fs(fs)); args.txn_p = &txn; args.rev = rev; @@ -827,7 +828,7 @@ svn_fs_txn_t *txn; struct open_txn_args args; - SVN_ERR(svn_fs_base__check_fs(fs)); + SVN_ERR(svn_fs__check_fs(fs)); args.txn_p = &txn; args.name = name; @@ -998,7 +999,7 @@ transaction_t *txn; int i; - SVN_ERR(svn_fs_base__check_fs(fs)); + SVN_ERR(svn_fs__check_fs(fs)); /* Open the transaction, expecting it to be dead. */ args.txn_p = &txn; @@ -1055,7 +1056,7 @@ svn_fs_base__abort_txn(svn_fs_txn_t *txn, apr_pool_t *pool) { - SVN_ERR(svn_fs_base__check_fs(txn->fs)); + SVN_ERR(svn_fs__check_fs(txn->fs)); /* Set the transaction to "dead". */ SVN_ERR(svn_fs_base__retry_txn(txn->fs, txn_body_abort_txn, txn, pool)); @@ -1090,7 +1091,7 @@ apr_array_header_t *names; struct list_transactions_args args; - SVN_ERR(svn_fs_base__check_fs(fs)); + SVN_ERR(svn_fs__check_fs(fs)); args.names_p = &names; args.pool = pool; Index: subversion/libsvn_fs_base/lock.c =================================================================== --- subversion/libsvn_fs_base/lock.c (revision 24569) +++ subversion/libsvn_fs_base/lock.c (working copy) @@ -90,7 +90,7 @@ /* Until we implement directory locks someday, we only allow locks on files or non-existent paths. */ if (kind == svn_node_dir) - return svn_fs_base__err_not_file(trail->fs, args->path); + return svn_fs__err_not_file(trail->fs, args->path); /* While our locking implementation easily supports the locking of nonexistent paths, we deliberately choose not to allow such madness. */ @@ -101,7 +101,7 @@ /* There better be a username attached to the fs. */ if (!trail->fs->access_ctx || !trail->fs->access_ctx->username) - return svn_fs_base__err_no_user(trail->fs); + return svn_fs__err_no_user(trail->fs); else fs_username = trail->fs->access_ctx->username; /* for convenience */ @@ -168,7 +168,7 @@ if (! args->steal_lock) { /* Sorry, the path is already locked. */ - return svn_fs_base__err_path_already_locked(trail->fs, + return svn_fs__err_path_already_locked(trail->fs, existing_lock); } else @@ -215,7 +215,7 @@ { struct lock_args args; - SVN_ERR(svn_fs_base__check_fs(fs)); + SVN_ERR(svn_fs__check_fs(fs)); args.lock_p = lock; args.path = svn_fs__canonicalize_abspath(path, pool); @@ -272,18 +272,18 @@ if (args->token == NULL) return svn_fs_base__err_no_lock_token(trail->fs, args->path); else if (strcmp(lock_token, args->token) != 0) - return svn_fs_base__err_no_such_lock(trail->fs, args->path); + return svn_fs__err_no_such_lock(trail->fs, args->path); SVN_ERR(svn_fs_bdb__lock_get(&lock, trail->fs, lock_token, trail, trail->pool)); /* There better be a username attached to the fs. */ if (!trail->fs->access_ctx || !trail->fs->access_ctx->username) - return svn_fs_base__err_no_user(trail->fs); + return svn_fs__err_no_user(trail->fs); /* And that username better be the same as the lock's owner. */ if (strcmp(trail->fs->access_ctx->username, lock->owner) != 0) - return svn_fs_base__err_lock_owner_mismatch + return svn_fs__err_lock_owner_mismatch (trail->fs, trail->fs->access_ctx->username, lock->owner); @@ -304,7 +304,7 @@ { struct unlock_args args; - SVN_ERR(svn_fs_base__check_fs(fs)); + SVN_ERR(svn_fs__check_fs(fs)); args.path = svn_fs__canonicalize_abspath(path, pool); args.token = token; @@ -378,7 +378,7 @@ { struct lock_token_get_args args; - SVN_ERR(svn_fs_base__check_fs(fs)); + SVN_ERR(svn_fs__check_fs(fs)); args.path = svn_fs__canonicalize_abspath(path, pool); args.lock_p = lock; @@ -413,7 +413,7 @@ { struct locks_get_args args; - SVN_ERR(svn_fs_base__check_fs(fs)); + SVN_ERR(svn_fs__check_fs(fs)); args.path = svn_fs__canonicalize_abspath(path, pool); args.get_locks_func = get_locks_func; args.get_locks_baton = get_locks_baton; Index: subversion/libsvn_fs_base/err.c =================================================================== --- subversion/libsvn_fs_base/err.c (revision 24569) +++ subversion/libsvn_fs_base/err.c (working copy) @@ -28,17 +28,7 @@ #include "../libsvn_fs/fs-loader.h" -svn_error_t * -svn_fs_base__check_fs(svn_fs_t *fs) -{ - if (fs->fsap_data) - return SVN_NO_ERROR; - else - return svn_error_create(SVN_ERR_FS_NOT_OPEN, 0, - _("Filesystem object has not been opened yet")); -} - /* Building common error objects. */ @@ -98,17 +88,6 @@ svn_error_t * -svn_fs_base__err_not_mutable(svn_fs_t *fs, svn_revnum_t rev, const char *path) -{ - return - svn_error_createf - (SVN_ERR_FS_NOT_MUTABLE, 0, - _("File is not mutable: filesystem '%s', revision %ld, path '%s'"), - fs->path, rev, path); -} - - -svn_error_t * svn_fs_base__err_no_such_txn(svn_fs_t *fs, const char *txn) { return @@ -141,28 +120,6 @@ svn_error_t * -svn_fs_base__err_not_directory(svn_fs_t *fs, const char *path) -{ - return - svn_error_createf - (SVN_ERR_FS_NOT_DIRECTORY, 0, - _("'%s' is not a directory in filesystem '%s'"), - path, fs->path); -} - - -svn_error_t * -svn_fs_base__err_not_file(svn_fs_t *fs, const char *path) -{ - return - svn_error_createf - (SVN_ERR_FS_NOT_FILE, 0, - _("'%s' is not a file in filesystem '%s'"), - path, fs->path); -} - - -svn_error_t * svn_fs_base__err_bad_lock_token(svn_fs_t *fs, const char *lock_token) { return @@ -191,59 +148,3 @@ lock_token, fs->path); } -svn_error_t * -svn_fs_base__err_no_such_lock(svn_fs_t *fs, const char *path) -{ - return - svn_error_createf - (SVN_ERR_FS_NO_SUCH_LOCK, 0, - _("No lock on path '%s' in filesystem '%s'"), - path, fs->path); -} - - -svn_error_t * -svn_fs_base__err_lock_expired(svn_fs_t *fs, const char *token) -{ - return - svn_error_createf - (SVN_ERR_FS_LOCK_EXPIRED, 0, - _("Lock has expired: lock-token '%s' in filesystem '%s'"), - token, fs->path); -} - - -svn_error_t * -svn_fs_base__err_no_user(svn_fs_t *fs) -{ - return - svn_error_createf - (SVN_ERR_FS_NO_USER, 0, - _("No username is currently associated with filesystem '%s'"), - fs->path); -} - - -svn_error_t * -svn_fs_base__err_lock_owner_mismatch(svn_fs_t *fs, - const char *username, - const char *lock_owner) -{ - return - svn_error_createf - (SVN_ERR_FS_LOCK_OWNER_MISMATCH, 0, - _("User '%s' is trying to use a lock owned by '%s' in filesystem '%s'"), - username, lock_owner, fs->path); -} - - -svn_error_t * -svn_fs_base__err_path_already_locked(svn_fs_t *fs, - svn_lock_t *lock) -{ - return - svn_error_createf - (SVN_ERR_FS_PATH_ALREADY_LOCKED, 0, - _("Path '%s' is already locked by user '%s' in filesystem '%s'"), - lock->path, lock->owner, fs->path); -} Index: subversion/libsvn_fs_base/err.h =================================================================== --- subversion/libsvn_fs_base/err.h (revision 24569) +++ subversion/libsvn_fs_base/err.h (working copy) @@ -30,11 +30,7 @@ extern "C" { #endif /* __cplusplus */ -/* Verify that FS refers to an open database; return an appropriate - error if this is not the case. */ -svn_error_t *svn_fs_base__check_fs(svn_fs_t *fs); - /* Building common error objects. */ @@ -60,11 +56,6 @@ is corrupt. */ svn_error_t *svn_fs_base__err_corrupt_copy(svn_fs_t *fs, const char *copy_id); -/* SVN_ERR_FS_NOT_MUTABLE: the caller attempted to change a node - outside of a transaction. */ -svn_error_t *svn_fs_base__err_not_mutable(svn_fs_t *fs, svn_revnum_t rev, - const char *path); - /* SVN_ERR_FS_NO_SUCH_TRANSACTION: there is no transaction named TXN in FS. */ svn_error_t *svn_fs_base__err_no_such_txn(svn_fs_t *fs, const char *txn); @@ -75,12 +66,6 @@ /* SVN_ERR_FS_NO_SUCH_COPY: there is no copy with id COPY_ID in FS. */ svn_error_t *svn_fs_base__err_no_such_copy(svn_fs_t *fs, const char *copy_id); -/* SVN_ERR_FS_NOT_DIRECTORY: PATH does not refer to a directory in FS. */ -svn_error_t *svn_fs_base__err_not_directory(svn_fs_t *fs, const char *path); - -/* SVN_ERR_FS_NOT_FILE: PATH does not refer to a file in FS. */ -svn_error_t *svn_fs_base__err_not_file(svn_fs_t *fs, const char *path); - /* SVN_ERR_FS_BAD_LOCK_TOKEN: LOCK_TOKEN does not refer to a lock in FS. */ svn_error_t *svn_fs_base__err_bad_lock_token(svn_fs_t *fs, const char *lock_token); @@ -92,25 +77,6 @@ svn_error_t *svn_fs_base__err_corrupt_lock(svn_fs_t *fs, const char *lock_token); -/* SVN_ERR_FS_PATH_ALREADY_LOCKED: a path is already locked. */ -svn_error_t *svn_fs_base__err_path_already_locked(svn_fs_t *fs, - svn_lock_t *lock); - -/* SVN_ERR_FS_NO_SUCH_LOCK: there is no lock on PATH in FS. */ -svn_error_t *svn_fs_base__err_no_such_lock(svn_fs_t *fs, const char *path); - -/* SVN_ERR_FS_LOCK_EXPIRED: TOKEN's lock in FS has been auto-expired. */ -svn_error_t *svn_fs_base__err_lock_expired(svn_fs_t *fs, const char *token); - -/* SVN_ERR_FS_NO_USER: FS does not have a user associated with it. */ -svn_error_t *svn_fs_base__err_no_user(svn_fs_t *fs); - -/* SVN_ERR_FS_LOCK_OWNER_MISMATCH: trying to use a lock whose LOCK_OWNER - doesn't match the USERNAME associated with FS. */ -svn_error_t *svn_fs_base__err_lock_owner_mismatch(svn_fs_t *fs, - const char *username, - const char *lock_owner); - #ifdef __cplusplus } #endif /* __cplusplus */ Index: subversion/libsvn_fs_util/fs-util.c =================================================================== --- subversion/libsvn_fs_util/fs-util.c (revision 24569) +++ subversion/libsvn_fs_util/fs-util.c (working copy) @@ -21,8 +21,12 @@ #include #include +#include "svn_fs.h" #include "svn_path.h" +#include "svn_private_config.h" + #include "private/svn_fs_util.h" +#include "../libsvn_fs/fs-loader.h" const char * svn_fs__canonicalize_abspath(const char *path, apr_pool_t *pool) @@ -82,3 +86,104 @@ return newpath; } +svn_error_t * +svn_fs__check_fs(svn_fs_t *fs) +{ + if (fs->fsap_data) + return SVN_NO_ERROR; + else + return svn_error_create(SVN_ERR_FS_NOT_OPEN, 0, + _("Filesystem object has not been opened yet")); +} + + +svn_error_t * +svn_fs__err_not_mutable(svn_fs_t *fs, svn_revnum_t rev, const char *path) +{ + return + svn_error_createf + (SVN_ERR_FS_NOT_MUTABLE, 0, + _("File is not mutable: filesystem '%s', revision %ld, path '%s'"), + fs->path, rev, path); +} + + +svn_error_t * +svn_fs__err_not_directory(svn_fs_t *fs, const char *path) +{ + return + svn_error_createf + (SVN_ERR_FS_NOT_DIRECTORY, 0, + _("'%s' is not a directory in filesystem '%s'"), + path, fs->path); +} + + +svn_error_t * +svn_fs__err_not_file(svn_fs_t *fs, const char *path) +{ + return + svn_error_createf + (SVN_ERR_FS_NOT_FILE, 0, + _("'%s' is not a file in filesystem '%s'"), + path, fs->path); +} + + +svn_error_t * +svn_fs__err_no_such_lock(svn_fs_t *fs, const char *path) +{ + return + svn_error_createf + (SVN_ERR_FS_NO_SUCH_LOCK, 0, + _("No lock on path '%s' in filesystem '%s'"), + path, fs->path); +} + + +svn_error_t * +svn_fs__err_lock_expired(svn_fs_t *fs, const char *token) +{ + return + svn_error_createf + (SVN_ERR_FS_LOCK_EXPIRED, 0, + _("Lock has expired: lock-token '%s' in filesystem '%s'"), + token, fs->path); +} + + +svn_error_t * +svn_fs__err_no_user(svn_fs_t *fs) +{ + return + svn_error_createf + (SVN_ERR_FS_NO_USER, 0, + _("No username is currently associated with filesystem '%s'"), + fs->path); +} + + +svn_error_t * +svn_fs__err_lock_owner_mismatch(svn_fs_t *fs, + const char *username, + const char *lock_owner) +{ + return + svn_error_createf + (SVN_ERR_FS_LOCK_OWNER_MISMATCH, 0, + _("User '%s' is trying to use a lock owned by '%s' in filesystem '%s'"), + username, lock_owner, fs->path); +} + + +svn_error_t * +svn_fs__err_path_already_locked(svn_fs_t *fs, + svn_lock_t *lock) +{ + return + svn_error_createf + (SVN_ERR_FS_PATH_ALREADY_LOCKED, 0, + _("Path '%s' is already locked by user '%s' in filesystem '%s'"), + lock->path, lock->owner, fs->path); +} + Index: subversion/include/private/svn_fs_util.h =================================================================== --- subversion/include/private/svn_fs_util.h (revision 24569) +++ subversion/include/private/svn_fs_util.h (working copy) @@ -35,6 +35,40 @@ const char * svn_fs__canonicalize_abspath(const char *path, apr_pool_t *pool); +/* Verify that FS refers to an open database; return an appropriate + error if this is not the case. */ +svn_error_t *svn_fs__check_fs(svn_fs_t *fs); + +/* SVN_ERR_FS_NOT_MUTABLE: the caller attempted to change a node + outside of a transaction. */ +svn_error_t *svn_fs__err_not_mutable(svn_fs_t *fs, svn_revnum_t rev, + const char *path); + +/* SVN_ERR_FS_NOT_DIRECTORY: PATH does not refer to a directory in FS. */ +svn_error_t *svn_fs__err_not_directory(svn_fs_t *fs, const char *path); + +/* SVN_ERR_FS_NOT_FILE: PATH does not refer to a file in FS. */ +svn_error_t *svn_fs__err_not_file(svn_fs_t *fs, const char *path); + +/* SVN_ERR_FS_PATH_ALREADY_LOCKED: a path is already locked. */ +svn_error_t *svn_fs__err_path_already_locked(svn_fs_t *fs, + svn_lock_t *lock); + +/* SVN_ERR_FS_NO_SUCH_LOCK: there is no lock on PATH in FS. */ +svn_error_t *svn_fs__err_no_such_lock(svn_fs_t *fs, const char *path); + +/* SVN_ERR_FS_LOCK_EXPIRED: TOKEN's lock in FS has been auto-expired. */ +svn_error_t *svn_fs__err_lock_expired(svn_fs_t *fs, const char *token); + +/* SVN_ERR_FS_NO_USER: FS does not have a user associated with it. */ +svn_error_t *svn_fs__err_no_user(svn_fs_t *fs); + +/* SVN_ERR_FS_LOCK_OWNER_MISMATCH: trying to use a lock whose LOCK_OWNER + doesn't match the USERNAME associated with FS. */ +svn_error_t *svn_fs__err_lock_owner_mismatch(svn_fs_t *fs, + const char *username, + const char *lock_owner); + #ifdef __cplusplus } #endif /* __cplusplus */ Index: subversion/libsvn_fs_fs/tree.c =================================================================== --- subversion/libsvn_fs_fs/tree.c (revision 24569) +++ subversion/libsvn_fs_fs/tree.c (working copy) @@ -289,7 +289,7 @@ { dag_node_t *root_dir; - SVN_ERR(svn_fs_fs__check_fs(fs)); + SVN_ERR(svn_fs__check_fs(fs)); SVN_ERR(svn_fs_fs__dag_revision_root(&root_dir, fs, rev, pool)); @@ -389,7 +389,7 @@ return svn_fs_fs__dag_clone_root(node_p, root->fs, root->txn, pool); else /* If it's not a transaction root, we can't change its contents. */ - return svn_fs_fs__err_not_mutable(root->fs, root->rev, error_path); + return svn_fs__err_not_mutable(root->fs, root->rev, error_path); } @@ -752,7 +752,7 @@ /* The path isn't finished yet; we'd better be in a directory. */ if (svn_fs_fs__dag_node_kind(child) != svn_node_dir) - SVN_ERR_W(svn_fs_fs__err_not_directory(fs, path_so_far), + SVN_ERR_W(svn_fs__err_not_directory(fs, path_so_far), apr_psprintf(pool, _("Failure opening '%s'"), path)); rest = next; @@ -1313,7 +1313,7 @@ } /* We have the same fs, now check it. */ - SVN_ERR(svn_fs_fs__check_fs(fs)); + SVN_ERR(svn_fs__check_fs(fs)); source_id = svn_fs_fs__dag_get_id(source); target_id = svn_fs_fs__dag_get_id(target); Index: subversion/libsvn_fs_fs/fs_fs.c =================================================================== --- subversion/libsvn_fs_fs/fs_fs.c (revision 24569) +++ subversion/libsvn_fs_fs/fs_fs.c (working copy) @@ -48,6 +48,7 @@ #include "id.h" #include "private/svn_fs_merge_info.h" +#include "private/svn_fs_util.h" #include "../libsvn_fs/fs-loader.h" #include "svn_private_config.h" @@ -3299,7 +3300,7 @@ { fs_fs_data_t *ffd; - SVN_ERR(svn_fs_fs__check_fs(txn->fs)); + SVN_ERR(svn_fs__check_fs(txn->fs)); /* Clean out the directory cache. */ ffd = txn->fs->fsap_data; @@ -5165,7 +5166,7 @@ { apr_hash_t *table; - SVN_ERR(svn_fs_fs__check_fs(fs)); + SVN_ERR(svn_fs__check_fs(fs)); SVN_ERR(svn_fs_fs__revision_proplist(&table, fs, rev, pool)); *value_p = apr_hash_get(table, propname, APR_HASH_KEY_STRING); @@ -5210,7 +5211,7 @@ { struct change_rev_prop_baton cb; - SVN_ERR(svn_fs_fs__check_fs(fs)); + SVN_ERR(svn_fs__check_fs(fs)); cb.fs = fs; cb.rev = rev; @@ -5250,7 +5251,7 @@ apr_hash_t *table; svn_fs_t *fs = txn->fs; - SVN_ERR(svn_fs_fs__check_fs(fs)); + SVN_ERR(svn_fs__check_fs(fs)); SVN_ERR(svn_fs_fs__txn_proplist(&table, txn, pool)); *value_p = apr_hash_get(table, propname, APR_HASH_KEY_STRING); @@ -5267,7 +5268,7 @@ { svn_string_t date; - SVN_ERR(svn_fs_fs__check_fs(fs)); + SVN_ERR(svn_fs__check_fs(fs)); SVN_ERR(svn_fs_fs__create_txn(txn_p, fs, rev, pool)); Index: subversion/libsvn_fs_fs/lock.c =================================================================== --- subversion/libsvn_fs_fs/lock.c (revision 24569) +++ subversion/libsvn_fs_fs/lock.c (working copy) @@ -492,7 +492,7 @@ SVN_ERR(read_digest_file(NULL, &lock, fs, digest_path, pool)); if (! lock) - return svn_fs_fs__err_no_such_lock(fs, path); + return svn_fs__err_no_such_lock(fs, path); /* Don't return an expired lock. */ if (lock->expiration_date && (apr_time_now() > lock->expiration_date)) @@ -502,7 +502,7 @@ if (have_write_lock) SVN_ERR(delete_lock(fs, lock, pool)); *lock_p = NULL; - return svn_fs_fs__err_lock_expired(fs, lock->token); + return svn_fs__err_lock_expired(fs, lock->token); } *lock_p = lock; @@ -707,7 +707,7 @@ SVN_ERR(lb->fs->vtable->revision_root(&root, lb->fs, youngest, pool)); SVN_ERR(svn_fs_fs__check_path(&kind, root, lb->path, pool)); if (kind == svn_node_dir) - return svn_fs_fs__err_not_file(lb->fs, lb->path); + return svn_fs__err_not_file(lb->fs, lb->path); /* While our locking implementation easily supports the locking of nonexistent paths, we deliberately choose not to allow such madness. */ @@ -718,7 +718,7 @@ /* We need to have a username attached to the fs. */ if (!lb->fs->access_ctx || !lb->fs->access_ctx->username) - return svn_fs_fs__err_no_user(lb->fs); + return svn_fs__err_no_user(lb->fs); /* Is the caller attempting to lock an out-of-date working file? */ if (SVN_IS_VALID_REVNUM(lb->current_rev)) @@ -764,7 +764,7 @@ if (! lb->steal_lock) { /* Sorry, the path is already locked. */ - return svn_fs_fs__err_path_already_locked(lb->fs, existing_lock); + return svn_fs__err_path_already_locked(lb->fs, existing_lock); } else { @@ -819,15 +819,15 @@ { /* Sanity check: the incoming token should match lock->token. */ if (strcmp(ub->token, lock->token) != 0) - return svn_fs_fs__err_no_such_lock(ub->fs, lock->path); + return svn_fs__err_no_such_lock(ub->fs, lock->path); /* There better be a username attached to the fs. */ if (! (ub->fs->access_ctx && ub->fs->access_ctx->username)) - return svn_fs_fs__err_no_user(ub->fs); + return svn_fs__err_no_user(ub->fs); /* And that username better be the same as the lock's owner. */ if (strcmp(ub->fs->access_ctx->username, lock->owner) != 0) - return svn_fs_fs__err_lock_owner_mismatch + return svn_fs__err_lock_owner_mismatch (ub->fs, ub->fs->access_ctx->username, lock->owner); } @@ -854,7 +854,7 @@ { struct lock_baton lb; - SVN_ERR(svn_fs_fs__check_fs(fs)); + SVN_ERR(svn_fs__check_fs(fs)); path = svn_fs__canonicalize_abspath(path, pool); lb.lock_p = lock_p; @@ -879,7 +879,7 @@ svn_fs_t *fs, apr_pool_t *pool) { - SVN_ERR(svn_fs_fs__check_fs(fs)); + SVN_ERR(svn_fs__check_fs(fs)); /* Notice that 'fs' is currently unused. But perhaps someday, we'll want to use the fs UUID + some incremented number? For now, we @@ -900,7 +900,7 @@ { struct unlock_baton ub; - SVN_ERR(svn_fs_fs__check_fs(fs)); + SVN_ERR(svn_fs__check_fs(fs)); path = svn_fs__canonicalize_abspath(path, pool); ub.fs = fs; @@ -920,7 +920,7 @@ const char *path, apr_pool_t *pool) { - SVN_ERR(svn_fs_fs__check_fs(fs)); + SVN_ERR(svn_fs__check_fs(fs)); path = svn_fs__canonicalize_abspath(path, pool); return get_lock_helper(fs, lock_p, path, FALSE, pool); } @@ -935,7 +935,7 @@ { const char *digest_path; - SVN_ERR(svn_fs_fs__check_fs(fs)); + SVN_ERR(svn_fs__check_fs(fs)); path = svn_fs__canonicalize_abspath(path, pool); /* Get the top digest path in our tree of interest, and then walk it. */ Index: subversion/libsvn_fs_fs/err.c =================================================================== --- subversion/libsvn_fs_fs/err.c (revision 24569) +++ subversion/libsvn_fs_fs/err.c (working copy) @@ -28,17 +28,7 @@ #include "../libsvn_fs/fs-loader.h" -svn_error_t * -svn_fs_fs__check_fs(svn_fs_t *fs) -{ - if (fs->fsap_data) - return SVN_NO_ERROR; - else - return svn_error_create(SVN_ERR_FS_NOT_OPEN, 0, - _("Filesystem object has not been opened yet")); -} - /* Building common error objects. */ @@ -53,41 +43,7 @@ id_str->data, fs->path); } - svn_error_t * -svn_fs_fs__err_not_mutable(svn_fs_t *fs, svn_revnum_t rev, const char *path) -{ - return - svn_error_createf - (SVN_ERR_FS_NOT_MUTABLE, 0, - _("File is not mutable: filesystem '%s', revision %ld, path '%s'"), - fs->path, rev, path); -} - - -svn_error_t * -svn_fs_fs__err_not_directory(svn_fs_t *fs, const char *path) -{ - return - svn_error_createf - (SVN_ERR_FS_NOT_DIRECTORY, 0, - _("'%s' is not a directory in filesystem '%s'"), - path, fs->path); -} - - -svn_error_t * -svn_fs_fs__err_not_file(svn_fs_t *fs, const char *path) -{ - return - svn_error_createf - (SVN_ERR_FS_NOT_FILE, 0, - _("'%s' is not a file in filesystem '%s'"), - path, fs->path); -} - - -svn_error_t * svn_fs_fs__err_corrupt_lockfile(svn_fs_t *fs, const char *path) { return @@ -97,59 +53,3 @@ path, fs->path); } -svn_error_t * -svn_fs_fs__err_no_such_lock(svn_fs_t *fs, const char *path) -{ - return - svn_error_createf - (SVN_ERR_FS_NO_SUCH_LOCK, 0, - _("No lock on path '%s' in filesystem '%s'"), - path, fs->path); -} - - -svn_error_t * -svn_fs_fs__err_lock_expired(svn_fs_t *fs, const char *token) -{ - return - svn_error_createf - (SVN_ERR_FS_LOCK_EXPIRED, 0, - _("Lock has expired: lock-token '%s' in filesystem '%s'"), - token, fs->path); -} - - -svn_error_t * -svn_fs_fs__err_no_user(svn_fs_t *fs) -{ - return - svn_error_createf - (SVN_ERR_FS_NO_USER, 0, - _("No username is currently associated with filesystem '%s'"), - fs->path); -} - - -svn_error_t * -svn_fs_fs__err_lock_owner_mismatch(svn_fs_t *fs, - const char *username, - const char *lock_owner) -{ - return - svn_error_createf - (SVN_ERR_FS_LOCK_OWNER_MISMATCH, 0, - _("User '%s' is trying to use a lock owned by '%s' in filesystem '%s'"), - username, lock_owner, fs->path); -} - - -svn_error_t * -svn_fs_fs__err_path_already_locked(svn_fs_t *fs, - svn_lock_t *lock) -{ - return - svn_error_createf - (SVN_ERR_FS_PATH_ALREADY_LOCKED, 0, - _("Path '%s' is already locked by user '%s' in filesystem '%s'"), - lock->path, lock->owner, fs->path); -} Index: subversion/libsvn_fs_fs/err.h =================================================================== --- subversion/libsvn_fs_fs/err.h (revision 24569) +++ subversion/libsvn_fs_fs/err.h (working copy) @@ -30,11 +30,7 @@ extern "C" { #endif /* __cplusplus */ -/* Verify that FS refers to an open database; return an appropriate - error if this is not the case. */ -svn_error_t *svn_fs_fs__check_fs(svn_fs_t *fs); - /* Building common error objects. */ @@ -44,40 +40,10 @@ svn_error_t *svn_fs_fs__err_dangling_id(svn_fs_t *fs, const svn_fs_id_t *id); -/* SVN_ERR_FS_NOT_MUTABLE: the caller attempted to change a node - outside of a transaction. */ -svn_error_t *svn_fs_fs__err_not_mutable(svn_fs_t *fs, svn_revnum_t rev, - const char *path); - -/* SVN_ERR_FS_NOT_DIRECTORY: PATH does not refer to a directory in FS. */ -svn_error_t *svn_fs_fs__err_not_directory(svn_fs_t *fs, const char *path); - -/* SVN_ERR_FS_NOT_FILE: PATH does not refer to a file in FS. */ -svn_error_t *svn_fs_fs__err_not_file(svn_fs_t *fs, const char *path); - /* SVN_ERR_FS_CORRUPT: the lockfile for PATH in FS is corrupt. */ svn_error_t *svn_fs_fs__err_corrupt_lockfile(svn_fs_t *fs, const char *path); -/* SVN_ERR_FS_PATH_ALREADY_LOCKED: a path is already locked. */ -svn_error_t *svn_fs_fs__err_path_already_locked(svn_fs_t *fs, - svn_lock_t *lock); - -/* SVN_ERR_FS_NO_SUCH_LOCK: there is no lock on PATH in FS. */ -svn_error_t *svn_fs_fs__err_no_such_lock(svn_fs_t *fs, const char *path); - -/* SVN_ERR_FS_LOCK_EXPIRED: TOKEN's lock in FS has been auto-expired. */ -svn_error_t *svn_fs_fs__err_lock_expired(svn_fs_t *fs, const char *token); - -/* SVN_ERR_FS_NO_USER: FS does not have a user associated with it. */ -svn_error_t *svn_fs_fs__err_no_user(svn_fs_t *fs); - -/* SVN_ERR_FS_LOCK_OWNER_MISMATCH: trying to use a lock whose LOCK_OWNER - doesn't match the USERNAME associated with FS. */ -svn_error_t *svn_fs_fs__err_lock_owner_mismatch(svn_fs_t *fs, - const char *username, - const char *lock_owner); - #ifdef __cplusplus } #endif /* __cplusplus */