]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/blob - contrib/subversion/subversion/libsvn_fs_fs/lock.h
MFC r275385 (by bapt):
[FreeBSD/stable/10.git] / contrib / subversion / subversion / libsvn_fs_fs / lock.h
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
27 extern "C" {
28 #endif /* __cplusplus */
29
30 \f
31
32 /* These functions implement some of the calls in the FS loader
33    library's fs vtables. */
34
35 /* See svn_fs_lock(), svn_fs_lock_many(). */
36 svn_error_t *svn_fs_fs__lock(svn_fs_t *fs,
37                              apr_hash_t *targets,
38                              const char *comment,
39                              svn_boolean_t is_dav_comment,
40                              apr_time_t expiration_date,
41                              svn_boolean_t steal_lock,
42                              svn_fs_lock_callback_t lock_callback,
43                              void *lock_baton,
44                              apr_pool_t *result_pool,
45                              apr_pool_t *scratch_pool);
46
47 /* See svn_fs_generate_lock_token(). */
48 svn_error_t *svn_fs_fs__generate_lock_token(const char **token,
49                                             svn_fs_t *fs,
50                                             apr_pool_t *pool);
51
52 /* See svn_fs_unlock(), svn_fs_unlock_many(). */
53 svn_error_t *svn_fs_fs__unlock(svn_fs_t *fs,
54                                apr_hash_t *targets,
55                                svn_boolean_t break_lock,
56                                svn_fs_lock_callback_t lock_callback,
57                                void *lock_baton,
58                                apr_pool_t *result_pool,
59                                apr_pool_t *scratch_pool);
60
61 /* See svn_fs_get_lock(). */
62 svn_error_t *svn_fs_fs__get_lock(svn_lock_t **lock,
63                                  svn_fs_t *fs,
64                                  const char *path,
65                                  apr_pool_t *pool);
66
67 /* See svn_fs_get_locks2(). */
68 svn_error_t *svn_fs_fs__get_locks(svn_fs_t *fs,
69                                   const char *path,
70                                   svn_depth_t depth,
71                                   svn_fs_get_locks_callback_t get_locks_func,
72                                   void *get_locks_baton,
73                                   apr_pool_t *pool);
74
75
76 /* Examine PATH for existing locks, and check whether they can be
77    used.  Use POOL for temporary allocations.
78
79    If no locks are present, return SVN_NO_ERROR.
80
81    If PATH is locked (or contains locks "below" it, when RECURSE is
82    set), then verify that:
83
84       1. a username has been supplied to TRAIL->fs's access-context,
85          else return SVN_ERR_FS_NO_USER.
86
87       2. for every lock discovered, the current username in the access
88          context of TRAIL->fs matches the "owner" of the lock, else
89          return SVN_ERR_FS_LOCK_OWNER_MISMATCH.
90
91       3. for every lock discovered, a matching lock token has been
92          passed into TRAIL->fs's access-context, else return
93          SVN_ERR_FS_BAD_LOCK_TOKEN.
94
95    If all three conditions are met, return SVN_NO_ERROR.
96
97    If the caller (directly or indirectly) has the FS write lock,
98    HAVE_WRITE_LOCK should be true.
99 */
100 svn_error_t *svn_fs_fs__allow_locked_operation(const char *path,
101                                                svn_fs_t *fs,
102                                                svn_boolean_t recurse,
103                                                svn_boolean_t have_write_lock,
104                                                apr_pool_t *pool);
105
106 #ifdef __cplusplus
107 }
108 #endif /* __cplusplus */
109
110 #endif /* SVN_LIBSVN_FS_LOCK_H */