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
12 * http://www.apache.org/licenses/LICENSE-2.0
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
20 * ====================================================================
23 * @file svn_io_private.h
24 * @brief Private IO API
27 #ifndef SVN_IO_PRIVATE_H
28 #define SVN_IO_PRIVATE_H
34 #endif /* __cplusplus */
36 /* The flags to pass to apr_stat to check for executable and/or readonly */
37 #if defined(WIN32) || defined(__OS2__)
38 #define SVN__APR_FINFO_EXECUTABLE (0)
39 #define SVN__APR_FINFO_READONLY (0)
40 #define SVN__APR_FINFO_MASK_OUT (APR_FINFO_PROT | APR_FINFO_OWNER)
42 #define SVN__APR_FINFO_EXECUTABLE (APR_FINFO_PROT)
43 #define SVN__APR_FINFO_READONLY (APR_FINFO_PROT | APR_FINFO_OWNER)
44 #define SVN__APR_FINFO_MASK_OUT (0)
47 /* 90% of the lines we encounter will be less than this many chars.
49 * Line-based functions like svn_stream_readline should fetch data in
50 * blocks no longer than this. Although using a larger prefetch size is
51 * not illegal and must not break any functionality, it may be
52 * significantly less efficient in certain situations.
54 #define SVN__LINE_CHUNK_SIZE 80
57 /** Set @a *executable TRUE if @a file_info is executable for the
58 * user, FALSE otherwise.
60 * Always returns FALSE on Windows or platforms without user support.
63 svn_io__is_finfo_executable(svn_boolean_t *executable,
64 apr_finfo_t *file_info,
67 /** Set @a *read_only TRUE if @a file_info is read-only for the user,
71 svn_io__is_finfo_read_only(svn_boolean_t *read_only,
72 apr_finfo_t *file_info,
77 * Lock file at @a lock_file. If that file does not exist, create an empty
80 * Lock will be automatically released when @a pool is cleared or destroyed.
81 * Use @a pool for memory allocations.
84 svn_io__file_lock_autocreate(const char *lock_file,
88 /** Return the underlying file, if any, associated with the stream, or
89 * NULL if not available. Accessing the file bypasses the stream.
92 svn_stream__aprfile(svn_stream_t *stream);
94 /* Creates as *INSTALL_STREAM a stream that once completed can be installed
95 using Windows checkouts much slower than Unix.
97 While writing the stream is temporarily stored in TMP_ABSPATH.
100 svn_stream__create_for_install(svn_stream_t **install_stream,
101 const char *tmp_abspath,
102 apr_pool_t *result_pool,
103 apr_pool_t *scratch_pool);
105 /* Installs a stream created with svn_stream__create_for_install in its final
106 location FINAL_ABSPATH, potentially using platform specific optimizations.
108 If MAKE_PARENTS is TRUE, this function will create missing parent
109 directories if needed.
112 svn_stream__install_stream(svn_stream_t *install_stream,
113 const char *final_abspath,
114 svn_boolean_t make_parents,
115 apr_pool_t *scratch_pool);
117 /* Deletes the install stream (when installing is not necessary after all) */
119 svn_stream__install_delete(svn_stream_t *install_stream,
120 apr_pool_t *scratch_pool);
122 /* Optimized apr_file_stat / apr_file_info_get operating on a closed
125 svn_stream__install_get_info(apr_finfo_t *finfo,
126 svn_stream_t *install_stream,
128 apr_pool_t *scratch_pool);
130 /* Internal version of svn_stream_from_aprfile2() supporting the
131 additional TRUNCATE_ON_SEEK argument. */
133 svn_stream__from_aprfile(apr_file_t *file,
134 svn_boolean_t disown,
135 svn_boolean_t truncate_on_seek,
140 /* ### Move to something like io.h or subr.h, to avoid making it
141 part of the DLL api */
143 /* This is semantically the same as the APR utf8_to_unicode_path
144 function, but reimplemented here because APR does not export it.
146 Note that this function creates "\\?\" paths so the resulting path
147 can only be used for WINAPI functions that explicitly document support
148 for this kind of paths. Newer Windows functions (Vista+) that support
149 long paths directly DON'T want this kind of escaping.
152 svn_io__utf8_to_unicode_longpath(const WCHAR **result,
154 apr_pool_t *result_pool);
156 /* This Windows-specific function marks the file to be deleted on close using
157 an existing file handle. It can be used to avoid having to reopen the file
158 as part of the delete handling. Return SVN_ERR_UNSUPPORTED_FEATURE if
159 delete on close operation is not supported by OS. */
161 svn_io__win_delete_file_on_close(apr_file_t *file,
165 /* This Windows-specific function renames the file using an existing file
166 handle. It can be used to avoid having to reopen the file as part of the
167 rename operation. Return SVN_ERR_UNSUPPORTED_FEATURE if renaming open
168 file is not supported by OS.*/
170 svn_io__win_rename_open_file(apr_file_t *file,
171 const char *from_path,
179 #endif /* __cplusplus */
182 #endif /* SVN_IO_PRIVATE_H */