1/* lock.h : internal interface to lock functions 2 * 3 * ==================================================================== 4 * Licensed to the Apache Software Foundation (ASF) under one 5 * or more contributor license agreements. See the NOTICE file 6 * distributed with this work for additional information 7 * regarding copyright ownership. The ASF licenses this file 8 * to you under the Apache License, Version 2.0 (the 9 * "License"); you may not use this file except in compliance 10 * with the License. You may obtain a copy of the License at 11 * 12 * http://www.apache.org/licenses/LICENSE-2.0 13 * 14 * Unless required by applicable law or agreed to in writing, 15 * software distributed under the License is distributed on an 16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 * KIND, either express or implied. See the License for the 18 * specific language governing permissions and limitations 19 * under the License. 20 * ==================================================================== 21 */ 22 23#ifndef SVN_LIBSVN_FS_LOCK_H 24#define SVN_LIBSVN_FS_LOCK_H 25 26#ifdef __cplusplus 27extern "C" { 28#endif /* __cplusplus */ 29 30 31 32/* These functions implement some of the calls in the FS loader 33 library's fs vtables. */ 34 35svn_error_t *svn_fs_fs__lock(svn_lock_t **lock, 36 svn_fs_t *fs, 37 const char *path, 38 const char *token, 39 const char *comment, 40 svn_boolean_t is_dav_comment, 41 apr_time_t expiration_date, 42 svn_revnum_t current_rev, 43 svn_boolean_t steal_lock, 44 apr_pool_t *pool); 45 46svn_error_t *svn_fs_fs__generate_lock_token(const char **token, 47 svn_fs_t *fs, 48 apr_pool_t *pool); 49 50svn_error_t *svn_fs_fs__unlock(svn_fs_t *fs, 51 const char *path, 52 const char *token, 53 svn_boolean_t break_lock, 54 apr_pool_t *pool); 55 56svn_error_t *svn_fs_fs__get_lock(svn_lock_t **lock, 57 svn_fs_t *fs, 58 const char *path, 59 apr_pool_t *pool); 60 61svn_error_t *svn_fs_fs__get_locks(svn_fs_t *fs, 62 const char *path, 63 svn_depth_t depth, 64 svn_fs_get_locks_callback_t get_locks_func, 65 void *get_locks_baton, 66 apr_pool_t *pool); 67 68 69/* Examine PATH for existing locks, and check whether they can be 70 used. Use POOL for temporary allocations. 71 72 If no locks are present, return SVN_NO_ERROR. 73 74 If PATH is locked (or contains locks "below" it, when RECURSE is 75 set), then verify that: 76 77 1. a username has been supplied to TRAIL->fs's access-context, 78 else return SVN_ERR_FS_NO_USER. 79 80 2. for every lock discovered, the current username in the access 81 context of TRAIL->fs matches the "owner" of the lock, else 82 return SVN_ERR_FS_LOCK_OWNER_MISMATCH. 83 84 3. for every lock discovered, a matching lock token has been 85 passed into TRAIL->fs's access-context, else return 86 SVN_ERR_FS_BAD_LOCK_TOKEN. 87 88 If all three conditions are met, return SVN_NO_ERROR. 89 90 If the caller (directly or indirectly) has the FS write lock, 91 HAVE_WRITE_LOCK should be true. 92*/ 93svn_error_t *svn_fs_fs__allow_locked_operation(const char *path, 94 svn_fs_t *fs, 95 svn_boolean_t recurse, 96 svn_boolean_t have_write_lock, 97 apr_pool_t *pool); 98 99#ifdef __cplusplus 100} 101#endif /* __cplusplus */ 102 103#endif /* SVN_LIBSVN_FS_LOCK_H */ 104