Index: subversion/libsvn_fs_base/tree.c =================================================================== --- subversion/libsvn_fs_base/tree.c (revision 25291) +++ subversion/libsvn_fs_base/tree.c (working copy) @@ -466,7 +466,7 @@ trail, pool); else /* If it's not a transaction root, we can't change its contents. */ - return svn_fs__err_not_mutable(root->fs, root->rev, error_path); + return SVN_FS__ERR_NOT_MUTABLE(root->fs, root->rev, error_path); } @@ -786,7 +786,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__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; Index: subversion/libsvn_fs_base/bdb/locks-table.c =================================================================== --- subversion/libsvn_fs_base/bdb/locks-table.c (revision 25291) +++ subversion/libsvn_fs_base/bdb/locks-table.c (working copy) @@ -149,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__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 25291) +++ subversion/libsvn_fs_base/bdb/lock-tokens-table.c (working copy) @@ -99,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__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; @@ -128,7 +128,7 @@ svn_fs_base__track_dbt(&value, pool); if (db_err == DB_NOTFOUND) - return svn_fs__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/lock.c =================================================================== --- subversion/libsvn_fs_base/lock.c (revision 25291) +++ 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__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__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__err_path_already_locked(trail->fs, + return SVN_FS__ERR_PATH_ALREADY_LOCKED(trail->fs, existing_lock); } else @@ -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__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__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__err_lock_owner_mismatch + return SVN_FS__ERR_LOCK_OWNER_MISMATCH (trail->fs, trail->fs->access_ctx->username, lock->owner); Index: subversion/libsvn_fs_util/fs-util.c =================================================================== --- subversion/libsvn_fs_util/fs-util.c (revision 25291) +++ subversion/libsvn_fs_util/fs-util.c (working copy) @@ -96,97 +96,6 @@ _("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); -} - char * svn_fs__next_entry_name(const char **next_p, const char *path, Index: subversion/include/private/svn_fs_util.h =================================================================== --- subversion/include/private/svn_fs_util.h (revision 25291) +++ subversion/include/private/svn_fs_util.h (working copy) @@ -20,6 +20,7 @@ #ifndef SVN_FS_UTIL_H #define SVN_FS_UTIL_H +#include "svn_private_config.h" #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ @@ -39,35 +40,66 @@ 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_FS__ERR_NOT_MUTABLE: attempted to change a node outside of a + transaction. F is of type "svn_fs_t *", R is of type + "svn_rev_num_t *", P is of type "const char *". */ +#define SVN_FS__ERR_NOT_MUTABLE(f, r, p) \ + svn_error_createf \ + (SVN_ERR_FS_NOT_MUTABLE, 0, \ + _("File is not mutable: filesystem '%s', revision %ld, path '%s'"), \ + f->path, r, p) -/* 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); +/* F is of type "svn fs_t *", P is of type "const char *". */ +#define SVN_FS__ERR_NOT_DIRECTORY(f, p) \ + svn_error_createf \ + (SVN_ERR_FS_NOT_DIRECTORY, 0, \ + _("'%s' is not a directory in filesystem '%s'"), \ + p, f->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); +/* F is of type "svn fs_t *", P is of type "const char *". */ +#define SVN_FS__ERR_NOT_FILE(f, p) \ + svn_error_createf \ + (SVN_ERR_FS_NOT_FILE, 0, \ + _("'%s' is not a file in filesystem '%s'"), \ + p, f->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); +/* F is of type "svn fs_t *", L is of type "svn_lock_t *". */ +#define SVN_FS__ERR_PATH_ALREADY_LOCKED(f, l) \ + svn_error_createf \ + (SVN_ERR_FS_PATH_ALREADY_LOCKED, 0, \ + _("Path '%s' is already locked by user '%s' in filesystem '%s'"), \ + l->path, l->owner, f->path) -/* 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); +/* F is of type "svn fs_t *", P is of type "const char *". */ +#define SVN_FS__ERR_NO_SUCH_LOCK(f, p) \ + svn_error_createf \ + (SVN_ERR_FS_NO_SUCH_LOCK, 0, \ + _("No lock on path '%s' in filesystem '%s'"), \ + p, f->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); +/* F is of type "svn fs_t *", T is of type "const char *". */ +#define SVN_FS__ERR_LOCK_EXPIRED(f, t) \ + svn_error_createf \ + (SVN_ERR_FS_LOCK_EXPIRED, 0, \ + _("Lock has expired: lock-token '%s' in filesystem '%s'"), \ + t, f->path) -/* 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); +#define SVN_FS__ERR_NO_USER(fs) \ + svn_error_createf \ + (SVN_ERR_FS_NO_USER, 0, \ + _("No username is currently associated with filesystem '%s'"), \ + fs->path) -/* 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); +/* SVN_FS__ERR_LOCK_OWNER_MISMATCH: trying to use a lock whose + LOCK_OWNER doesn't match the USERNAME associated with FS. + F is of type "svn fs_t *", U is of type "const char *", + O is of type "const char *". */ +#define SVN_FS__ERR_LOCK_OWNER_MISMATCH(f, u, o) \ + svn_error_createf \ + (SVN_ERR_FS_LOCK_OWNER_MISMATCH, 0, \ + _("User '%s' is trying to use a lock owned by '%s' in " \ + "filesystem '%s'"), \ + u, o, f->path) /* Return a NULL-terminated copy of the first component of PATH, allocated in POOL. If path is empty, or consists entirely of Index: subversion/libsvn_fs_fs/tree.c =================================================================== --- subversion/libsvn_fs_fs/tree.c (revision 25291) +++ subversion/libsvn_fs_fs/tree.c (working copy) @@ -390,7 +390,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__err_not_mutable(root->fs, root->rev, error_path); + return SVN_FS__ERR_NOT_MUTABLE(root->fs, root->rev, error_path); } @@ -707,7 +707,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__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; Index: subversion/libsvn_fs_fs/lock.c =================================================================== --- subversion/libsvn_fs_fs/lock.c (revision 25291) +++ 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__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__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__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__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__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__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__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__err_lock_owner_mismatch + return SVN_FS__ERR_LOCK_OWNER_MISMATCH (ub->fs, ub->fs->access_ctx->username, lock->owner); }