Subversion
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
svn_io.h
Go to the documentation of this file.
1 /**
2  * @copyright
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  * @endcopyright
22  *
23  * @file svn_io.h
24  * @brief General file I/O for Subversion
25  */
26 
27 /* ==================================================================== */
28 
29 
30 #ifndef SVN_IO_H
31 #define SVN_IO_H
32 
33 #include <apr.h>
34 #include <apr_pools.h>
35 #include <apr_time.h>
36 #include <apr_hash.h>
37 #include <apr_tables.h>
38 #include <apr_file_io.h>
39 #include <apr_file_info.h>
40 #include <apr_thread_proc.h> /* for apr_proc_t, apr_exit_why_e */
41 
42 #include "svn_types.h"
43 #include "svn_string.h"
44 #include "svn_checksum.h"
45 
46 #ifdef __cplusplus
47 extern "C" {
48 #endif /* __cplusplus */
49 
50 
51 
52 /** Used as an argument when creating temporary files to indicate
53  * when a file should be removed.
54  *
55  * @since New in 1.4.
56  *
57  * Not specifying any of these means no removal at all. */
58 typedef enum svn_io_file_del_t
59 {
60  /** No deletion ever */
62  /** Remove when the file is closed */
64  /** Remove when the associated pool is cleared */
67 
68 /** A set of directory entry data elements as returned by svn_io_get_dirents
69  *
70  * Note that the first two fields are exactly identical to svn_io_dirent_t
71  * to allow returning a svn_io_dirent2_t as a svn_io_dirent_t.
72  *
73  * Use svn_io_dirent2_create() to create new svn_dirent2_t instances or
74  * svn_io_dirent2_dup() to duplicate an existing instance.
75  *
76  * @since New in 1.7.
77  */
78 typedef struct svn_io_dirent2_t {
79  /* New fields must be added at the end to preserve binary compatibility */
80 
81  /** The kind of this entry. */
83 
84  /** If @c kind is #svn_node_file, whether this entry is a special file;
85  * else FALSE.
86  *
87  * @see svn_io_check_special_path().
88  */
90 
91  /** The filesize of this entry or undefined for a directory */
93 
94  /** The time the file was last modified */
95  apr_time_t mtime;
96 
97  /* Don't forget to update svn_io_dirent2_dup() when adding new fields */
99 
100 
101 /** Creates a new #svn_io_dirent2_t structure
102  *
103  * @since New in 1.7.
104  */
106 svn_io_dirent2_create(apr_pool_t *result_pool);
107 
108 /** Duplicates a @c svn_io_dirent2_t structure into @a result_pool.
109  *
110  * @since New in 1.7.
111  */
114  apr_pool_t *result_pool);
115 
116 /** Represents the kind and special status of a directory entry.
117  *
118  * Note that the first two fields are exactly identical to svn_io_dirent2_t
119  * to allow returning a svn_io_dirent2_t as a svn_io_dirent_t.
120  *
121  * @since New in 1.3.
122  */
123 typedef struct svn_io_dirent_t {
124  /** The kind of this entry. */
126  /** If @c kind is #svn_node_file, whether this entry is a special file;
127  * else FALSE.
128  *
129  * @see svn_io_check_special_path().
130  */
133 
134 /** Determine the @a kind of @a path. @a path should be UTF-8 encoded.
135  *
136  * If @a path is a file, set @a *kind to #svn_node_file.
137  *
138  * If @a path is a directory, set @a *kind to #svn_node_dir.
139  *
140  * If @a path does not exist, set @a *kind to #svn_node_none.
141  *
142  * If @a path exists but is none of the above, set @a *kind to
143  * #svn_node_unknown.
144  *
145  * If @a path is not a valid pathname, set @a *kind to #svn_node_none. If
146  * unable to determine @a path's kind for any other reason, return an error,
147  * with @a *kind's value undefined.
148  *
149  * Use @a pool for temporary allocations.
150  *
151  * @see svn_node_kind_t
152  */
153 svn_error_t *
154 svn_io_check_path(const char *path,
155  svn_node_kind_t *kind,
156  apr_pool_t *pool);
157 
158 /**
159  * Like svn_io_check_path(), but also set *is_special to @c TRUE if
160  * the path is not a normal file.
161  *
162  * @since New in 1.1.
163  */
164 svn_error_t *
165 svn_io_check_special_path(const char *path,
166  svn_node_kind_t *kind,
167  svn_boolean_t *is_special,
168  apr_pool_t *pool);
169 
170 /** Like svn_io_check_path(), but resolve symlinks. This returns the
171  same varieties of @a kind as svn_io_check_path(). */
172 svn_error_t *
173 svn_io_check_resolved_path(const char *path,
174  svn_node_kind_t *kind,
175  apr_pool_t *pool);
176 
177 
178 /** Open a new file (for reading and writing) with a unique name based on
179  * utf-8 encoded @a filename, in the directory @a dirpath. The file handle is
180  * returned in @a *file, and the name, which ends with @a suffix, is returned
181  * in @a *unique_name, also utf8-encoded. Either @a file or @a unique_name
182  * may be @c NULL. If @a file is @c NULL, the file will be created but not
183  * open.
184  *
185  * If @a delete_when is #svn_io_file_del_on_close, then the @c APR_DELONCLOSE
186  * flag will be used when opening the file. The @c APR_BUFFERED flag will
187  * always be used.
188  *
189  * The first attempt will just append @a suffix. If the result is not
190  * a unique name, then subsequent attempts will append a dot,
191  * followed by an iteration number ("2", then "3", and so on),
192  * followed by the suffix. For example, successive calls to
193  *
194  * svn_io_open_uniquely_named(&f, &u, "tests/t1/A/D/G", "pi", ".tmp", ...)
195  *
196  * will open
197  *
198  * tests/t1/A/D/G/pi.tmp
199  * tests/t1/A/D/G/pi.2.tmp
200  * tests/t1/A/D/G/pi.3.tmp
201  * tests/t1/A/D/G/pi.4.tmp
202  * tests/t1/A/D/G/pi.5.tmp
203  * ...
204  *
205  * Assuming @a suffix is non-empty, @a *unique_name will never be exactly
206  * the same as @a filename, even if @a filename does not exist.
207  *
208  * If @a dirpath is NULL, then the directory returned by svn_io_temp_dir()
209  * will be used.
210  *
211  * If @a filename is NULL, then "tempfile" will be used.
212  *
213  * If @a suffix is NULL, then ".tmp" will be used.
214  *
215  * Allocates @a *file and @a *unique_name in @a result_pool. All
216  * intermediate allocations will be performed in @a scratch_pool.
217  *
218  * If no unique name can be found, #SVN_ERR_IO_UNIQUE_NAMES_EXHAUSTED is
219  * the error returned.
220  *
221  * Claim of Historical Inevitability: this function was written
222  * because
223  *
224  * - tmpnam() is not thread-safe.
225  * - tempname() tries standard system tmp areas first.
226  *
227  * @since New in 1.6
228  */
229 svn_error_t *
230 svn_io_open_uniquely_named(apr_file_t **file,
231  const char **unique_name,
232  const char *dirpath,
233  const char *filename,
234  const char *suffix,
235  svn_io_file_del_t delete_when,
236  apr_pool_t *result_pool,
237  apr_pool_t *scratch_pool);
238 
239 
240 /** Create a writable file, with an arbitrary and unique name, in the
241  * directory @a dirpath. Set @a *temp_path to its full path, and set
242  * @a *file to the file handle, both allocated from @a result_pool. Either
243  * @a file or @a unique_name may be @c NULL. If @a file is @c NULL, the file
244  * will be created but not open.
245  *
246  * If @a dirpath is @c NULL, use the path returned from svn_io_temp_dir().
247  * (Note that when using the system-provided temp directory, it may not
248  * be possible to atomically rename the resulting file due to cross-device
249  * issues.)
250  *
251  * The file will be deleted according to @a delete_when. If @a delete_when
252  * is @c svn_io_file_del_on_close and @a file is @c NULL, the file will be
253  * deleted before this function returns.
254  *
255  * When passing @c svn_io_file_del_none please don't forget to eventually
256  * remove the temporary file to avoid filling up the system temp directory.
257  * It is often appropriate to bind the lifetime of the temporary file to
258  * the lifetime of a pool by using @c svn_io_file_del_on_pool_cleanup.
259  *
260  * Temporary allocations will be performed in @a scratch_pool.
261  *
262  * @since New in 1.6
263  * @see svn_stream_open_unique()
264  */
265 svn_error_t *
266 svn_io_open_unique_file3(apr_file_t **file,
267  const char **temp_path,
268  const char *dirpath,
269  svn_io_file_del_t delete_when,
270  apr_pool_t *result_pool,
271  apr_pool_t *scratch_pool);
272 
273 
274 /** Like svn_io_open_uniquely_named(), but takes a joined dirpath and
275  * filename, and a single pool.
276  *
277  * @since New in 1.4
278  *
279  * @deprecated Provided for backward compatibility with the 1.5 API
280  */
282 svn_error_t *
283 svn_io_open_unique_file2(apr_file_t **f,
284  const char **unique_name_p,
285  const char *path,
286  const char *suffix,
287  svn_io_file_del_t delete_when,
288  apr_pool_t *pool);
289 
290 /** Like svn_io_open_unique_file2, but can't delete on pool cleanup.
291  *
292  * @deprecated Provided for backward compatibility with the 1.3 API
293  *
294  * @note In 1.4 the API was extended to require either @a f or
295  * @a unique_name_p (the other can be NULL). Before that, both were
296  * required.
297  */
299 svn_error_t *
300 svn_io_open_unique_file(apr_file_t **f,
301  const char **unique_name_p,
302  const char *path,
303  const char *suffix,
304  svn_boolean_t delete_on_close,
305  apr_pool_t *pool);
306 
307 
308 /**
309  * Like svn_io_open_unique_file(), except that instead of creating a
310  * file, a symlink is generated that references the path @a dest.
311  *
312  * @since New in 1.1.
313  */
314 svn_error_t *
315 svn_io_create_unique_link(const char **unique_name_p,
316  const char *path,
317  const char *dest,
318  const char *suffix,
319  apr_pool_t *pool);
320 
321 
322 /**
323  * Set @a *dest to the path that the symlink at @a path references.
324  * Allocate the string from @a pool.
325  *
326  * @since New in 1.1.
327  */
328 svn_error_t *
330  const char *path,
331  apr_pool_t *pool);
332 
333 
334 /** Set @a *dir to a directory path (allocated in @a pool) deemed
335  * usable for the creation of temporary files and subdirectories.
336  */
337 svn_error_t *
338 svn_io_temp_dir(const char **dir,
339  apr_pool_t *pool);
340 
341 
342 /** Copy @a src to @a dst atomically, in a "byte-for-byte" manner.
343  * Overwrite @a dst if it exists, else create it. Both @a src and @a dst
344  * are utf8-encoded filenames. If @a copy_perms is TRUE, set @a dst's
345  * permissions to match those of @a src.
346  */
347 svn_error_t *
348 svn_io_copy_file(const char *src,
349  const char *dst,
350  svn_boolean_t copy_perms,
351  apr_pool_t *pool);
352 
353 
354 /** Copy permission flags from @a src onto the file at @a dst. Both
355  * filenames are utf8-encoded filenames.
356  *
357  * @since New in 1.6.
358  */
359 svn_error_t *
360 svn_io_copy_perms(const char *src,
361  const char *dst,
362  apr_pool_t *pool);
363 
364 
365 /**
366  * Copy symbolic link @a src to @a dst atomically. Overwrite @a dst
367  * if it exists, else create it. Both @a src and @a dst are
368  * utf8-encoded filenames. After copying, the @a dst link will point
369  * to the same thing @a src does.
370  *
371  * @since New in 1.1.
372  */
373 svn_error_t *
374 svn_io_copy_link(const char *src,
375  const char *dst,
376  apr_pool_t *pool);
377 
378 
379 /** Recursively copy directory @a src into @a dst_parent, as a new entry named
380  * @a dst_basename. If @a dst_basename already exists in @a dst_parent,
381  * return error. @a copy_perms will be passed through to svn_io_copy_file()
382  * when any files are copied. @a src, @a dst_parent, and @a dst_basename are
383  * all utf8-encoded.
384  *
385  * If @a cancel_func is non-NULL, invoke it with @a cancel_baton at
386  * various points during the operation. If it returns any error
387  * (typically #SVN_ERR_CANCELLED), return that error immediately.
388  */
389 svn_error_t *
390 svn_io_copy_dir_recursively(const char *src,
391  const char *dst_parent,
392  const char *dst_basename,
393  svn_boolean_t copy_perms,
394  svn_cancel_func_t cancel_func,
395  void *cancel_baton,
396  apr_pool_t *pool);
397 
398 
399 /** Create directory @a path on the file system, creating intermediate
400  * directories as required, like <tt>mkdir -p</tt>. Report no error if @a
401  * path already exists. @a path is utf8-encoded.
402  *
403  * This is essentially a wrapper for apr_dir_make_recursive(), passing
404  * @c APR_OS_DEFAULT as the permissions.
405  */
406 svn_error_t *
407 svn_io_make_dir_recursively(const char *path,
408  apr_pool_t *pool);
409 
410 
411 /** Set @a *is_empty_p to @c TRUE if directory @a path is empty, else to
412  * @c FALSE if it is not empty. @a path must be a directory, and is
413  * utf8-encoded. Use @a pool for temporary allocation.
414  */
415 svn_error_t *
416 svn_io_dir_empty(svn_boolean_t *is_empty_p,
417  const char *path,
418  apr_pool_t *pool);
419 
420 
421 /** Append @a src to @a dst. @a dst will be appended to if it exists, else it
422  * will be created. Both @a src and @a dst are utf8-encoded.
423  */
424 svn_error_t *
425 svn_io_append_file(const char *src,
426  const char *dst,
427  apr_pool_t *pool);
428 
429 
430 /** Make a file as read-only as the operating system allows.
431  * @a path is the utf8-encoded path to the file. If @a ignore_enoent is
432  * @c TRUE, don't fail if the target file doesn't exist.
433  *
434  * If @a path is a symlink, do nothing.
435  *
436  * @note If @a path is a directory, act on it as though it were a
437  * file, as described above, but note that you probably don't want to
438  * call this function on directories. We have left it effective on
439  * directories for compatibility reasons, but as its name implies, it
440  * should be used only for files.
441  */
442 svn_error_t *
443 svn_io_set_file_read_only(const char *path,
444  svn_boolean_t ignore_enoent,
445  apr_pool_t *pool);
446 
447 
448 /** Make a file as writable as the operating system allows.
449  * @a path is the utf8-encoded path to the file. If @a ignore_enoent is
450  * @c TRUE, don't fail if the target file doesn't exist.
451  * @warning On Unix this function will do the equivalent of chmod a+w path.
452  * If this is not what you want you should not use this function, but rather
453  * use apr_file_perms_set().
454  *
455  * If @a path is a symlink, do nothing.
456  *
457  * @note If @a path is a directory, act on it as though it were a
458  * file, as described above, but note that you probably don't want to
459  * call this function on directories. We have left it effective on
460  * directories for compatibility reasons, but as its name implies, it
461  * should be used only for files.
462  */
463 svn_error_t *
464 svn_io_set_file_read_write(const char *path,
465  svn_boolean_t ignore_enoent,
466  apr_pool_t *pool);
467 
468 
469 /** Similar to svn_io_set_file_read_* functions.
470  * Change the read-write permissions of a file.
471  * @since New in 1.1.
472  *
473  * When making @a path read-write on operating systems with unix style
474  * permissions, set the permissions on @a path to the permissions that
475  * are set when a new file is created (effectively honoring the user's
476  * umask).
477  *
478  * When making the file read-only on operating systems with unix style
479  * permissions, remove all write permissions.
480  *
481  * On other operating systems, toggle the file's "writability" as much as
482  * the operating system allows.
483  *
484  * @a path is the utf8-encoded path to the file. If @a enable_write
485  * is @c TRUE, then make the file read-write. If @c FALSE, make it
486  * read-only. If @a ignore_enoent is @c TRUE, don't fail if the target
487  * file doesn't exist.
488  *
489  * @deprecated Provided for backward compatibility with the 1.3 API.
490  */
492 svn_error_t *
493 svn_io_set_file_read_write_carefully(const char *path,
494  svn_boolean_t enable_write,
495  svn_boolean_t ignore_enoent,
496  apr_pool_t *pool);
497 
498 /** Set @a path's "executability" (but do nothing if it is a symlink).
499  *
500  * @a path is the utf8-encoded path to the file. If @a executable
501  * is @c TRUE, then make the file executable. If @c FALSE, make it
502  * non-executable. If @a ignore_enoent is @c TRUE, don't fail if the target
503  * file doesn't exist.
504  *
505  * When making the file executable on operating systems with unix style
506  * permissions, never add an execute permission where there is not
507  * already a read permission: that is, only make the file executable
508  * for the user, group or world if the corresponding read permission
509  * is already set for user, group or world.
510  *
511  * When making the file non-executable on operating systems with unix style
512  * permissions, remove all execute permissions.
513  *
514  * On other operating systems, toggle the file's "executability" as much as
515  * the operating system allows.
516  *
517  * @note If @a path is a directory, act on it as though it were a
518  * file, as described above, but note that you probably don't want to
519  * call this function on directories. We have left it effective on
520  * directories for compatibility reasons, but as its name implies, it
521  * should be used only for files.
522  */
523 svn_error_t *
524 svn_io_set_file_executable(const char *path,
525  svn_boolean_t executable,
526  svn_boolean_t ignore_enoent,
527  apr_pool_t *pool);
528 
529 /** Determine whether a file is executable by the current user.
530  * Set @a *executable to @c TRUE if the file @a path is executable by the
531  * current user, otherwise set it to @c FALSE.
532  *
533  * On Windows and on platforms without userids, always returns @c FALSE.
534  */
535 svn_error_t *
537  const char *path,
538  apr_pool_t *pool);
539 
540 
541 /** Read a line from @a file into @a buf, but not exceeding @a *limit bytes.
542  * Does not include newline, instead '\\0' is put there.
543  * Length (as in strlen) is returned in @a *limit.
544  * @a buf should be pre-allocated.
545  * @a file should be already opened.
546  *
547  * When the file is out of lines, @c APR_EOF will be returned.
548  */
549 svn_error_t *
550 svn_io_read_length_line(apr_file_t *file,
551  char *buf,
552  apr_size_t *limit,
553  apr_pool_t *pool);
554 
555 
556 /** Set @a *apr_time to the time of last modification of the contents of the
557  * file @a path. @a path is utf8-encoded.
558  *
559  * @note This is the APR mtime which corresponds to the traditional mtime
560  * on Unix, and the last write time on Windows.
561  */
562 svn_error_t *
563 svn_io_file_affected_time(apr_time_t *apr_time,
564  const char *path,
565  apr_pool_t *pool);
566 
567 /** Set the timestamp of file @a path to @a apr_time. @a path is
568  * utf8-encoded.
569  *
570  * @note This is the APR mtime which corresponds to the traditional mtime
571  * on Unix, and the last write time on Windows.
572  */
573 svn_error_t *
574 svn_io_set_file_affected_time(apr_time_t apr_time,
575  const char *path,
576  apr_pool_t *pool);
577 
578 /** Sleep to ensure that any files modified after we exit have a different
579  * timestamp than the one we recorded. If @a path is not NULL, check if we
580  * can determine how long we should wait for a new timestamp on the filesystem
581  * containing @a path, an existing file or directory. If @a path is NULL or we
582  * can't determine the timestamp resolution, sleep until the next second.
583  *
584  * Use @a pool for any necessary allocations. @a pool can be null if @a path
585  * is NULL.
586  *
587  * Errors while retrieving the timestamp resolution will result in sleeping
588  * to the next second, to keep the working copy stable in error conditions.
589  *
590  * @since New in 1.6.
591  */
592 void
593 svn_io_sleep_for_timestamps(const char *path, apr_pool_t *pool);
594 
595 /** Set @a *different_p to non-zero if @a file1 and @a file2 have different
596  * sizes, else set to zero. Both @a file1 and @a file2 are utf8-encoded.
597  *
598  * Setting @a *different_p to zero does not mean the files definitely
599  * have the same size, it merely means that the sizes are not
600  * definitely different. That is, if the size of one or both files
601  * cannot be determined, then the sizes are not known to be different,
602  * so @a *different_p is set to 0.
603  */
604 svn_error_t *
606  const char *file1,
607  const char *file2,
608  apr_pool_t *pool);
609 
610 
611 /** Return in @a *checksum the checksum of type @a kind of @a file
612  * Use @a pool for temporary allocations and to allocate @a *checksum.
613  *
614  * @since New in 1.6.
615  */
616 svn_error_t *
618  const char *file,
619  svn_checksum_kind_t kind,
620  apr_pool_t *pool);
621 
622 
623 /** Put the md5 checksum of @a file into @a digest.
624  * @a digest points to @c APR_MD5_DIGESTSIZE bytes of storage.
625  * Use @a pool only for temporary allocations.
626  *
627  * @deprecated Provided for backward compatibility with the 1.5 API.
628  */
630 svn_error_t *
631 svn_io_file_checksum(unsigned char digest[],
632  const char *file,
633  apr_pool_t *pool);
634 
635 
636 /** Set @a *same to TRUE if @a file1 and @a file2 have the same
637  * contents, else set it to FALSE. Use @a pool for temporary allocations.
638  */
639 svn_error_t *
641  const char *file1,
642  const char *file2,
643  apr_pool_t *pool);
644 
645 /** Create file at utf8-encoded @a file with contents @a contents.
646  * @a file must not already exist.
647  * Use @a pool for memory allocations.
648  */
649 svn_error_t *
650 svn_io_file_create(const char *file,
651  const char *contents,
652  apr_pool_t *pool);
653 
654 /**
655  * Lock file at @a lock_file. If @a exclusive is TRUE,
656  * obtain exclusive lock, otherwise obtain shared lock.
657  * Lock will be automatically released when @a pool is cleared or destroyed.
658  * Use @a pool for memory allocations.
659  *
660  * @deprecated Provided for backward compatibility with the 1.0 API.
661  */
663 svn_error_t *
664 svn_io_file_lock(const char *lock_file,
665  svn_boolean_t exclusive,
666  apr_pool_t *pool);
667 
668 /**
669  * Lock file at @a lock_file. If @a exclusive is TRUE,
670  * obtain exclusive lock, otherwise obtain shared lock.
671  *
672  * If @a nonblocking is TRUE, do not wait for the lock if it
673  * is not available: throw an error instead.
674  *
675  * Lock will be automatically released when @a pool is cleared or destroyed.
676  * Use @a pool for memory allocations.
677  *
678  * @since New in 1.1.
679  */
680 svn_error_t *
681 svn_io_file_lock2(const char *lock_file,
682  svn_boolean_t exclusive,
683  svn_boolean_t nonblocking,
684  apr_pool_t *pool);
685 /**
686  * Flush any unwritten data from @a file to disk. Use @a pool for
687  * memory allocations.
688  *
689  * @since New in 1.1.
690  */
691 svn_error_t *
692 svn_io_file_flush_to_disk(apr_file_t *file,
693  apr_pool_t *pool);
694 
695 /** Copy the file whose basename (or relative path) is @a file within
696  * directory @a src_path to the same basename (or relative path) within
697  * directory @a dest_path. Overwrite the destination file if it already
698  * exists. The destination directory (including any directory
699  * components in @a name) must already exist. Set the destination
700  * file's permissions to match those of the source. Use @a pool for
701  * memory allocations.
702  */
703 svn_error_t *
704 svn_io_dir_file_copy(const char *src_path,
705  const char *dest_path,
706  const char *file,
707  apr_pool_t *pool);
708 
709 
710 /** Generic byte-streams
711  *
712  * @defgroup svn_io_byte_streams Generic byte streams
713  * @{
714  */
715 
716 /** An abstract stream of bytes--either incoming or outgoing or both.
717  *
718  * The creator of a stream sets functions to handle read and write.
719  * Both of these handlers accept a baton whose value is determined at
720  * stream creation time; this baton can point to a structure
721  * containing data associated with the stream. If a caller attempts
722  * to invoke a handler which has not been set, it will generate a
723  * runtime assertion failure. The creator can also set a handler for
724  * close requests so that it can flush buffered data or whatever;
725  * if a close handler is not specified, a close request on the stream
726  * will simply be ignored. Note that svn_stream_close() does not
727  * deallocate the memory used to allocate the stream structure; free
728  * the pool you created the stream in to free that memory.
729  *
730  * The read and write handlers accept length arguments via pointer.
731  * On entry to the handler, the pointed-to value should be the amount
732  * of data which can be read or the amount of data to write. When the
733  * handler returns, the value is reset to the amount of data actually
734  * read or written. Handlers are obliged to complete a read or write
735  * to the maximum extent possible; thus, a short read with no
736  * associated error implies the end of the input stream, and a short
737  * write should never occur without an associated error.
738  *
739  * In Subversion 1.7 reset support was added as an optional feature of
740  * streams. If a stream implements resetting it allows reading the data
741  * again after a successful call to svn_stream_reset().
742  */
743 typedef struct svn_stream_t svn_stream_t;
744 
745 
746 
747 /** Read handler function for a generic stream. @see svn_stream_t. */
748 typedef svn_error_t *(*svn_read_fn_t)(void *baton,
749  char *buffer,
750  apr_size_t *len);
751 
752 /** Skip data handler function for a generic stream. @see svn_stream_t
753  * and svn_stream_skip().
754  * @since New in 1.7.
755  */
756 typedef svn_error_t *(*svn_stream_skip_fn_t)(void *baton,
757  apr_size_t len);
758 
759 /** Write handler function for a generic stream. @see svn_stream_t. */
760 typedef svn_error_t *(*svn_write_fn_t)(void *baton,
761  const char *data,
762  apr_size_t *len);
763 
764 /** Close handler function for a generic stream. @see svn_stream_t. */
765 typedef svn_error_t *(*svn_close_fn_t)(void *baton);
766 
767 /** An opaque type which represents a mark on a stream. There is no
768  * concrete definition of this type, it is a named type for stream
769  * implementation specific baton pointers.
770  *
771  * @see svn_stream_mark().
772  * @since New in 1.7.
773  */
775 
776 /** Mark handler function for a generic stream. @see svn_stream_t and
777  * svn_stream_mark().
778  *
779  * @since New in 1.7.
780  */
781 typedef svn_error_t *(*svn_stream_mark_fn_t)(void *baton,
782  svn_stream_mark_t **mark,
783  apr_pool_t *pool);
784 
785 /** Seek handler function for a generic stream. @see svn_stream_t and
786  * svn_stream_seek().
787  *
788  * @since New in 1.7.
789  */
790 typedef svn_error_t *(*svn_stream_seek_fn_t)(void *baton,
791  const svn_stream_mark_t *mark);
792 
793 /** Create a generic stream. @see svn_stream_t. */
794 svn_stream_t *
795 svn_stream_create(void *baton,
796  apr_pool_t *pool);
797 
798 /** Set @a stream's baton to @a baton */
799 void
801  void *baton);
802 
803 /** Set @a stream's read function to @a read_fn */
804 void
806  svn_read_fn_t read_fn);
807 
808 /** Set @a stream's skip function to @a skip_fn
809  *
810  * @since New in 1.7
811  */
812 void
814  svn_stream_skip_fn_t skip_fn);
815 
816 /** Set @a stream's write function to @a write_fn */
817 void
819  svn_write_fn_t write_fn);
820 
821 /** Set @a stream's close function to @a close_fn */
822 void
824  svn_close_fn_t close_fn);
825 
826 /** Set @a stream's mark function to @a mark_fn
827  *
828  * @since New in 1.7.
829  */
830 void
832  svn_stream_mark_fn_t mark_fn);
833 
834 /** Set @a stream's seek function to @a seek_fn
835  *
836  * @since New in 1.7.
837  */
838 void
840  svn_stream_seek_fn_t seek_fn);
841 
842 /** Create a stream that is empty for reading and infinite for writing. */
843 svn_stream_t *
844 svn_stream_empty(apr_pool_t *pool);
845 
846 /** Return a stream allocated in @a pool which forwards all requests
847  * to @a stream. Destruction is explicitly excluded from forwarding.
848  *
849  * @see notes/destruction-of-stacked-resources
850  *
851  * @since New in 1.4.
852  */
853 svn_stream_t *
855  apr_pool_t *pool);
856 
857 
858 /** Create a stream to read the file at @a path. It will be opened using
859  * the APR_BUFFERED and APR_BINARY flag, and APR_OS_DEFAULT for the perms.
860  * If you'd like to use different values, then open the file yourself, and
861  * use the svn_stream_from_aprfile2() interface.
862  *
863  * The stream will be returned in @a stream, and allocated from @a result_pool.
864  * Temporary allocations will be performed in @a scratch_pool.
865  *
866  * @since New in 1.6
867  */
868 svn_error_t *
870  const char *path,
871  apr_pool_t *result_pool,
872  apr_pool_t *scratch_pool);
873 
874 
875 /** Create a stream to write a file at @a path. The file will be *created*
876  * using the APR_BUFFERED and APR_BINARY flag, and APR_OS_DEFAULT for the
877  * perms. The file will be created "exclusively", so if it already exists,
878  * then an error will be thrown. If you'd like to use different values, or
879  * open an existing file, then open the file yourself, and use the
880  * svn_stream_from_aprfile2() interface.
881  *
882  * The stream will be returned in @a stream, and allocated from @a result_pool.
883  * Temporary allocations will be performed in @a scratch_pool.
884  *
885  * @since New in 1.6
886  */
887 svn_error_t *
889  const char *path,
890  apr_pool_t *result_pool,
891  apr_pool_t *scratch_pool);
892 
893 
894 /** Create a writable stream to a file in the directory @a dirpath.
895  * The file will have an arbitrary and unique name, and the full path
896  * will be returned in @a temp_path. The stream will be returned in
897  * @a stream. Both will be allocated from @a result_pool.
898  *
899  * If @a dirpath is @c NULL, use the path returned from svn_io_temp_dir().
900  * (Note that when using the system-provided temp directory, it may not
901  * be possible to atomically rename the resulting file due to cross-device
902  * issues.)
903  *
904  * The file will be deleted according to @a delete_when.
905  *
906  * Temporary allocations will be performed in @a scratch_pool.
907  *
908  * @since New in 1.6
909  * @see svn_io_open_unique_file3()
910  */
911 svn_error_t *
913  const char **temp_path,
914  const char *dirpath,
915  svn_io_file_del_t delete_when,
916  apr_pool_t *result_pool,
917  apr_pool_t *scratch_pool);
918 
919 
920 /** Create a stream from an APR file. For convenience, if @a file is
921  * @c NULL, an empty stream created by svn_stream_empty() is returned.
922  *
923  * This function should normally be called with @a disown set to FALSE,
924  * in which case closing the stream will also close the underlying file.
925  *
926  * If @a disown is TRUE, the stream will disown the underlying file,
927  * meaning that svn_stream_close() will not close the file.
928  *
929  * @since New in 1.4.
930  */
931 svn_stream_t *
932 svn_stream_from_aprfile2(apr_file_t *file,
933  svn_boolean_t disown,
934  apr_pool_t *pool);
935 
936 /** Similar to svn_stream_from_aprfile2(), except that the file will
937  * always be disowned.
938  *
939  * @note The stream returned is not considered to "own" the underlying
940  * file, meaning that svn_stream_close() on the stream will not
941  * close the file.
942  *
943  * @deprecated Provided for backward compatibility with the 1.3 API.
944  */
946 svn_stream_t *
947 svn_stream_from_aprfile(apr_file_t *file,
948  apr_pool_t *pool);
949 
950 /** Set @a *in to a generic stream connected to stdin, allocated in
951  * @a pool. The stream and its underlying APR handle will be closed
952  * when @a pool is cleared or destroyed.
953  *
954  * @since New in 1.7.
955  */
956 svn_error_t *
958  apr_pool_t *pool);
959 
960 /** Set @a *err to a generic stream connected to stderr, allocated in
961  * @a pool. The stream and its underlying APR handle will be closed
962  * when @a pool is cleared or destroyed.
963  *
964  * @since New in 1.7.
965  */
966 svn_error_t *
968  apr_pool_t *pool);
969 
970 /** Set @a *out to a generic stream connected to stdout, allocated in
971  * @a pool. The stream and its underlying APR handle will be closed
972  * when @a pool is cleared or destroyed.
973  */
974 svn_error_t *
976  apr_pool_t *pool);
977 
978 /** Return a generic stream connected to stringbuf @a str. Allocate the
979  * stream in @a pool.
980  */
981 svn_stream_t *
983  apr_pool_t *pool);
984 
985 /** Return a generic read-only stream connected to string @a str.
986  * Allocate the stream in @a pool.
987  */
988 svn_stream_t *
990  apr_pool_t *pool);
991 
992 /** Return a stream that decompresses all data read and compresses all
993  * data written. The stream @a stream is used to read and write all
994  * compressed data. All compression data structures are allocated on
995  * @a pool. If compression support is not compiled in then
996  * svn_stream_compressed() returns @a stream unmodified. Make sure you
997  * call svn_stream_close() on the stream returned by this function,
998  * so that all data are flushed and cleaned up.
999  *
1000  * @note From 1.4, compression support is always compiled in.
1001  */
1002 svn_stream_t *
1004  apr_pool_t *pool);
1005 
1006 /** Return a stream that calculates checksums for all data read
1007  * and written. The stream @a stream is used to read and write all data.
1008  * The stream and the resulting digests are allocated in @a pool.
1009  *
1010  * When the stream is closed, @a *read_checksum and @a *write_checksum
1011  * are set to point to the resulting checksums, of type @a read_checksum_kind
1012  * and @a write_checksum_kind, respectively.
1013  *
1014  * Both @a read_checksum and @a write_checksum can be @c NULL, in which case
1015  * the respective checksum isn't calculated.
1016  *
1017  * If @a read_all is TRUE, make sure that all data available on @a
1018  * stream is read (and checksummed) when the stream is closed.
1019  *
1020  * Read and write operations can be mixed without interfering.
1021  *
1022  * The @a stream passed into this function is closed when the created
1023  * stream is closed.
1024  *
1025  * @since New in 1.6.
1026  */
1027 svn_stream_t *
1029  svn_checksum_t **read_checksum,
1030  svn_checksum_t **write_checksum,
1031  svn_checksum_kind_t checksum_kind,
1032  svn_boolean_t read_all,
1033  apr_pool_t *pool);
1034 
1035 /**
1036  * Similar to svn_stream_checksummed2(), but always returning the MD5
1037  * checksum in @a read_digest and @a write_digest.
1038  *
1039  * @since New in 1.4.
1040  * @deprecated Provided for backward compatibility with the 1.5 API.
1041  */
1043 svn_stream_t *
1045  const unsigned char **read_digest,
1046  const unsigned char **write_digest,
1047  svn_boolean_t read_all,
1048  apr_pool_t *pool);
1049 
1050 /** Read from a generic stream. @see svn_stream_t. */
1051 svn_error_t *
1053  char *buffer,
1054  apr_size_t *len);
1055 
1056 /**
1057  * Skip @a len bytes from a generic @a stream. If the stream is exhausted
1058  * before @a len bytes have been read, return an error.
1059  *
1060  * @note No assumption can be made on the semantics of this function
1061  * other than that the stream read pointer will be advanced by *len
1062  * bytes. Depending on the capabilities of the underlying stream
1063  * implementation, this may for instance be translated into a sequence
1064  * of reads or a simple seek operation. If the stream implementation has
1065  * not provided a skip function, this will read from the stream and
1066  * discard the data.
1067  *
1068  * @since New in 1.7.
1069  */
1070 svn_error_t *
1072  apr_size_t len);
1073 
1074 /** Write to a generic stream. @see svn_stream_t. */
1075 svn_error_t *
1077  const char *data,
1078  apr_size_t *len);
1079 
1080 /** Close a generic stream. @see svn_stream_t. */
1081 svn_error_t *
1083 
1084 /** Reset a generic stream back to its origin. E.g. On a file this would be
1085  * implemented as a seek to position 0). This function returns a
1086  * #SVN_ERR_STREAM_RESET_NOT_SUPPORTED error when the stream doesn't
1087  * implement resetting.
1088  *
1089  * @since New in 1.7.
1090  */
1091 svn_error_t *
1093 
1094 /** Returns @c TRUE if the generic @a stream supports svn_stream_mark().
1095  *
1096  * @see svn_stream_mark()
1097  * @since New in 1.7.
1098  */
1101 
1102 /** Set a @a mark at the current position of a generic @a stream,
1103  * which can later be sought back to using svn_stream_seek().
1104  * The @a mark is allocated in @a pool.
1105  *
1106  * This function returns the #SVN_ERR_STREAM_SEEK_NOT_SUPPORTED error
1107  * if the stream doesn't implement seeking.
1108  *
1109  * @see svn_stream_seek()
1110  * @since New in 1.7.
1111  */
1112 svn_error_t *
1114  svn_stream_mark_t **mark,
1115  apr_pool_t *pool);
1116 
1117 /** Seek to a @a mark in a generic @a stream.
1118  * This function returns the #SVN_ERR_STREAM_SEEK_NOT_SUPPORTED error
1119  * if the stream doesn't implement seeking. Passing NULL as @a mark,
1120  * seeks to the start of the stream.
1121  *
1122  * @see svn_stream_mark()
1123  * @since New in 1.7.
1124  */
1125 svn_error_t *
1126 svn_stream_seek(svn_stream_t *stream, const svn_stream_mark_t *mark);
1127 
1128 /** Return a writable stream which, when written to, writes to both of the
1129  * underlying streams. Both of these streams will be closed upon closure of
1130  * the returned stream; use svn_stream_disown() if this is not the desired
1131  * behavior. One or both of @a out1 and @a out2 may be @c NULL. If both are
1132  * @c NULL, @c NULL is returned.
1133  *
1134  * @since New in 1.7.
1135  */
1136 svn_stream_t *
1138  svn_stream_t *out2,
1139  apr_pool_t *pool);
1140 
1141 
1142 /** Write to @a stream using a printf-style @a fmt specifier, passed through
1143  * apr_psprintf() using memory from @a pool.
1144  */
1145 svn_error_t *
1147  apr_pool_t *pool,
1148  const char *fmt,
1149  ...)
1150  __attribute__((format(printf, 3, 4)));
1151 
1152 /** Write to @a stream using a printf-style @a fmt specifier, passed through
1153  * apr_psprintf() using memory from @a pool. The resulting string
1154  * will be translated to @a encoding before it is sent to @a stream.
1155  *
1156  * @note Use @c APR_LOCALE_CHARSET to translate to the encoding of the
1157  * current locale.
1158  *
1159  * @since New in 1.3.
1160  */
1161 svn_error_t *
1163  const char *encoding,
1164  apr_pool_t *pool,
1165  const char *fmt,
1166  ...)
1167  __attribute__((format(printf, 4, 5)));
1168 
1169 /** Allocate @a *stringbuf in @a pool, and read into it one line (terminated
1170  * by @a eol) from @a stream. The line-terminator is read from the stream,
1171  * but is not added to the end of the stringbuf. Instead, the stringbuf
1172  * ends with a usual '\\0'.
1173  *
1174  * If @a stream runs out of bytes before encountering a line-terminator,
1175  * then set @a *eof to @c TRUE, otherwise set @a *eof to FALSE.
1176  */
1177 svn_error_t *
1179  svn_stringbuf_t **stringbuf,
1180  const char *eol,
1181  svn_boolean_t *eof,
1182  apr_pool_t *pool);
1183 
1184 /**
1185  * Read the contents of the readable stream @a from and write them to the
1186  * writable stream @a to calling @a cancel_func before copying each chunk.
1187  *
1188  * @a cancel_func may be @c NULL.
1189  *
1190  * @note both @a from and @a to will be closed upon successful completion of
1191  * the copy (but an error may still be returned, based on trying to close
1192  * the two streams). If the closure is not desired, then you can use
1193  * svn_stream_disown() to protect either or both of the streams from
1194  * being closed.
1195  *
1196  * @since New in 1.6.
1197  */
1198 svn_error_t *
1200  svn_stream_t *to,
1201  svn_cancel_func_t cancel_func,
1202  void *cancel_baton,
1203  apr_pool_t *pool);
1204 
1205 /**
1206  * Same as svn_stream_copy3() but the streams are not closed.
1207  *
1208  * @since New in 1.5.
1209  * @deprecated Provided for backward compatibility with the 1.5 API.
1210  */
1212 svn_error_t *
1214  svn_stream_t *to,
1215  svn_cancel_func_t cancel_func,
1216  void *cancel_baton,
1217  apr_pool_t *pool);
1218 
1219 /**
1220  * Same as svn_stream_copy3(), but without the cancellation function
1221  * or stream closing.
1222  *
1223  * @since New in 1.1.
1224  * @deprecated Provided for backward compatibility with the 1.4 API.
1225  */
1227 svn_error_t *
1229  svn_stream_t *to,
1230  apr_pool_t *pool);
1231 
1232 
1233 /** Set @a *same to TRUE if @a stream1 and @a stream2 have the same
1234  * contents, else set it to FALSE.
1235  *
1236  * Both streams will be closed before this function returns (regardless of
1237  * the result, or any possible error).
1238  *
1239  * Use @a scratch_pool for temporary allocations.
1240  *
1241  * @since New in 1.7.
1242  */
1243 svn_error_t *
1245  svn_stream_t *stream1,
1246  svn_stream_t *stream2,
1247  apr_pool_t *pool);
1248 
1249 
1250 /**
1251  * Same as svn_stream_contents_same2(), but the streams will not be closed.
1252  *
1253  * @since New in 1.4.
1254  * @deprecated Provided for backward compatibility with the 1.6 API.
1255  */
1257 svn_error_t *
1259  svn_stream_t *stream1,
1260  svn_stream_t *stream2,
1261  apr_pool_t *pool);
1262 
1263 
1264 /** Read the contents of @a stream into memory, returning the data in
1265  * @a result. The stream will be closed when it has been successfully and
1266  * completely read.
1267  *
1268  * The returned memory is allocated in @a result_pool, and any temporary
1269  * allocations are performed in @a scratch_pool.
1270  *
1271  * @note due to memory pseudo-reallocation behavior (due to pools), this
1272  * can be a memory-intensive operation for large files.
1273  *
1274  * @since New in 1.6
1275  */
1276 svn_error_t *
1278  svn_stream_t *stream,
1279  apr_pool_t *result_pool,
1280  apr_pool_t *scratch_pool);
1281 
1282 
1283 /** @} */
1284 
1285 /** Set @a *result to a string containing the contents of @a
1286  * filename, which is either "-" (indicating that stdin should be
1287  * read) or the utf8-encoded path of a real file.
1288  *
1289  * @warning Callers should be aware of possible unexpected results
1290  * when using this function to read from stdin where additional
1291  * stdin-reading processes abound. For example, if a program tries
1292  * both to invoke an external editor and to read from stdin, stdin
1293  * could be trashed and the editor might act funky or die outright.
1294  *
1295  * @note due to memory pseudo-reallocation behavior (due to pools), this
1296  * can be a memory-intensive operation for large files.
1297  *
1298  * @since New in 1.5.
1299  */
1300 svn_error_t *
1302  const char *filename,
1303  apr_pool_t *pool);
1304 
1305 /** Similar to svn_stringbuf_from_file2(), except that if @a filename
1306  * is "-", return the error #SVN_ERR_UNSUPPORTED_FEATURE and don't
1307  * touch @a *result.
1308  *
1309  * @deprecated Provided for backwards compatibility with the 1.4 API.
1310  */
1312 svn_error_t *
1314  const char *filename,
1315  apr_pool_t *pool);
1316 
1317 /** Sets @a *result to a string containing the contents of the already opened
1318  * @a file. Reads from the current position in file to the end. Does not
1319  * close the file or reset the cursor position.
1320  *
1321  * @note due to memory pseudo-reallocation behavior (due to pools), this
1322  * can be a memory-intensive operation for large files.
1323  */
1324 svn_error_t *
1326  apr_file_t *file,
1327  apr_pool_t *pool);
1328 
1329 /** Remove file @a path, a utf8-encoded path. This wraps apr_file_remove(),
1330  * converting any error to a Subversion error. If @a ignore_enoent is TRUE, and
1331  * the file is not present (APR_STATUS_IS_ENOENT returns TRUE), then no
1332  * error will be returned.
1333  *
1334  * The file will be removed even if it is not writable. (On Windows and
1335  * OS/2, this function first clears the file's read-only bit.)
1336  *
1337  * @since New in 1.7.
1338  */
1339 svn_error_t *
1340 svn_io_remove_file2(const char *path,
1341  svn_boolean_t ignore_enoent,
1342  apr_pool_t *scratch_pool);
1343 
1344 /** Similar to svn_io_remove_file2(), except with @a ignore_enoent set to FALSE.
1345  *
1346  * @deprecated Provided for backwards compatibility with the 1.6 API.
1347  */
1349 svn_error_t *
1350 svn_io_remove_file(const char *path,
1351  apr_pool_t *pool);
1352 
1353 /** Recursively remove directory @a path. @a path is utf8-encoded.
1354  * If @a ignore_enoent is @c TRUE, don't fail if the target directory
1355  * doesn't exist. Use @a pool for temporary allocations.
1356  *
1357  * Because recursive delete of a directory tree can be a lengthy operation,
1358  * provide @a cancel_func and @a cancel_baton for interruptibility.
1359  *
1360  * @since New in 1.5.
1361  */
1362 svn_error_t *
1363 svn_io_remove_dir2(const char *path,
1364  svn_boolean_t ignore_enoent,
1365  svn_cancel_func_t cancel_func,
1366  void *cancel_baton,
1367  apr_pool_t *pool);
1368 
1369 /** Similar to svn_io_remove_dir2(), but with @a ignore_enoent set to
1370  * @c FALSE and @a cancel_func and @a cancel_baton set to @c NULL.
1371  *
1372  * @deprecated Provided for backward compatibility with the 1.4 API
1373  */
1375 svn_error_t *
1376 svn_io_remove_dir(const char *path,
1377  apr_pool_t *pool);
1378 
1379 /** Read all of the disk entries in directory @a path, a utf8-encoded
1380  * path. Set @a *dirents to a hash mapping dirent names (<tt>char *</tt>) to
1381  * undefined non-NULL values, allocated in @a pool.
1382  *
1383  * @note The `.' and `..' directories normally returned by
1384  * apr_dir_read() are NOT returned in the hash.
1385  *
1386  * @since New in 1.4.
1387  * @deprecated Provided for backward compatibility with the 1.6 API.
1388  */
1390 svn_error_t *
1391 svn_io_get_dir_filenames(apr_hash_t **dirents,
1392  const char *path,
1393  apr_pool_t *pool);
1394 
1395 /** Read all of the disk entries in directory @a path, a utf8-encoded
1396  * path. Set @a *dirents to a hash mapping dirent names (<tt>char *</tt>) to
1397  * #svn_io_dirent2_t structures, allocated in @a pool.
1398  *
1399  * If @a only_check_type is set to @c TRUE, only the kind and special
1400  * fields of the svn_io_dirent2_t are filled.
1401  *
1402  * @note The `.' and `..' directories normally returned by
1403  * apr_dir_read() are NOT returned in the hash.
1404  *
1405  * @note The kind field in the @a dirents is set according to the mapping
1406  * as documented for svn_io_check_path().
1407  *
1408  * @since New in 1.7.
1409  */
1410 svn_error_t *
1411 svn_io_get_dirents3(apr_hash_t **dirents,
1412  const char *path,
1413  svn_boolean_t only_check_type,
1414  apr_pool_t *result_pool,
1415  apr_pool_t *scratch_pool);
1416 
1417 
1418 /** Similar to svn_io_get_dirents3, but returns a mapping to svn_io_dirent_t
1419  * structures instead of svn_io_dirent2_t and with only a single pool.
1420  *
1421  * @since New in 1.3.
1422  * @deprecated Provided for backward compatibility with the 1.6 API.
1423  */
1425 svn_error_t *
1426 svn_io_get_dirents2(apr_hash_t **dirents,
1427  const char *path,
1428  apr_pool_t *pool);
1429 
1430 /** Similar to svn_io_get_dirents2(), but @a *dirents is a hash table
1431  * with #svn_node_kind_t values.
1432  *
1433  * @deprecated Provided for backwards compatibility with the 1.2 API.
1434  */
1436 svn_error_t *
1437 svn_io_get_dirents(apr_hash_t **dirents,
1438  const char *path,
1439  apr_pool_t *pool);
1440 
1441 /** Create a svn_io_dirent2_t instance for path. Specialized variant of
1442  * svn_io_stat() that directly translates node_kind and special.
1443  *
1444  * If @a ignore_enoent is set to @c TRUE, set *dirent_p->kind to
1445  * svn_node_none instead of returning an error.
1446  *
1447  * @since New in 1.7.
1448  */
1449 svn_error_t *
1450 svn_io_stat_dirent(const svn_io_dirent2_t **dirent_p,
1451  const char *path,
1452  svn_boolean_t ignore_enoent,
1453  apr_pool_t *result_pool,
1454  apr_pool_t *scratch_pool);
1455 
1456 
1457 /** Callback function type for svn_io_dir_walk() */
1458 typedef svn_error_t * (*svn_io_walk_func_t)(void *baton,
1459  const char *path,
1460  const apr_finfo_t *finfo,
1461  apr_pool_t *pool);
1462 
1463 /** Recursively walk the directory rooted at @a dirname, a
1464  * utf8-encoded path, invoking @a walk_func (with @a walk_baton) for
1465  * each item in the tree. For a given directory, invoke @a walk_func
1466  * on the directory itself before invoking it on any children thereof.
1467  *
1468  * Deliver to @a walk_func the information specified by @a wanted,
1469  * which is a combination of @c APR_FINFO_* flags, plus the
1470  * information specified by @c APR_FINFO_TYPE and @c APR_FINFO_NAME.
1471  *
1472  * Use @a pool for all allocations.
1473  *
1474  * @note This function does not currently pass all file types to @a
1475  * walk_func -- only APR_DIR, APR_REG, and APR_LNK. We reserve the
1476  * right to pass additional file types through this interface in the
1477  * future, though, so implementations of this callback should
1478  * explicitly test FINFO->filetype. See the APR library's
1479  * apr_filetype_e enum for the various filetypes and their meanings.
1480  *
1481  * @since New in 1.7.
1482  */
1483 svn_error_t *
1484 svn_io_dir_walk2(const char *dirname,
1485  apr_int32_t wanted,
1486  svn_io_walk_func_t walk_func,
1487  void *walk_baton,
1488  apr_pool_t *pool);
1489 
1490 /** Similar to svn_io_dir_walk(), but only calls @a walk_func for
1491  * files of type APR_DIR (directory) and APR_REG (regular file).
1492  *
1493  * @deprecated Provided for backwards compatibility with the 1.6 API.
1494  */
1496 svn_error_t *
1497 svn_io_dir_walk(const char *dirname,
1498  apr_int32_t wanted,
1499  svn_io_walk_func_t walk_func,
1500  void *walk_baton,
1501  apr_pool_t *pool);
1502 
1503 /**
1504  * Start @a cmd with @a args, using utf8-encoded @a path as working
1505  * directory. Return the process handle for the invoked program in @a
1506  * *cmd_proc.
1507  *
1508  * If @a infile_pipe is TRUE, connect @a cmd's stdin to a pipe;
1509  * otherwise, connect it to @a infile (which may be NULL). If
1510  * @a outfile_pipe is TRUE, connect @a cmd's stdout to a pipe; otherwise,
1511  * connect it to @a outfile (which may be NULL). If @a errfile_pipe
1512  * is TRUE, connect @a cmd's stderr to a pipe; otherwise, connect it
1513  * to @a errfile (which may be NULL). (Callers must pass FALSE for
1514  * each of these boolean values for which the corresponding file
1515  * handle is non-NULL.)
1516  *
1517  * @a args is a list of utf8-encoded <tt>const char *</tt> arguments,
1518  * terminated by @c NULL. @a args[0] is the name of the program, though it
1519  * need not be the same as @a cmd.
1520  *
1521  * If @a inherit is TRUE, the invoked program inherits its environment from
1522  * the caller and @a cmd, if not absolute, is searched for in PATH.
1523  * Otherwise, the invoked program runs with an empty environment and @a cmd
1524  * must be an absolute path.
1525  *
1526  * @note On some platforms, failure to execute @a cmd in the child process
1527  * will result in error output being written to @a errfile, if non-NULL, and
1528  * a non-zero exit status being returned to the parent process.
1529  *
1530  * @since New in 1.7.
1531  */
1532 svn_error_t *svn_io_start_cmd2(apr_proc_t *cmd_proc,
1533  const char *path,
1534  const char *cmd,
1535  const char *const *args,
1536  svn_boolean_t inherit,
1537  svn_boolean_t infile_pipe,
1538  apr_file_t *infile,
1539  svn_boolean_t outfile_pipe,
1540  apr_file_t *outfile,
1541  svn_boolean_t errfile_pipe,
1542  apr_file_t *errfile,
1543  apr_pool_t *pool);
1544 
1545 /**
1546  * Similar to svn_io_start_cmd2() but with @a infile_pipe, @a
1547  * outfile_pipe, and @a errfile_pipe always FALSE.
1548  *
1549  * @deprecated Provided for backward compatibility with the 1.6 API
1550  * @since New in 1.3.
1551  */
1553 svn_error_t *
1554 svn_io_start_cmd(apr_proc_t *cmd_proc,
1555  const char *path,
1556  const char *cmd,
1557  const char *const *args,
1558  svn_boolean_t inherit,
1559  apr_file_t *infile,
1560  apr_file_t *outfile,
1561  apr_file_t *errfile,
1562  apr_pool_t *pool);
1563 
1564 /**
1565  * Wait for the process @a *cmd_proc to complete and optionally retrieve
1566  * its exit code. @a cmd is used only in error messages.
1567  *
1568  * If @a exitcode is not NULL, set @a *exitcode to the exit code of the
1569  * process and do not consider any exit code to be an error. If @a exitcode
1570  * is NULL, then if the exit code of the process is non-zero then return an
1571  * #SVN_ERR_EXTERNAL_PROGRAM error.
1572  *
1573  * If @a exitwhy is not NULL, set @a *exitwhy to indicate why the process
1574  * terminated and do not consider any reason to be an error. If @a exitwhy
1575  * is NULL, then if the termination reason is not @c APR_PROC_CHECK_EXIT()
1576  * then return an #SVN_ERR_EXTERNAL_PROGRAM error.
1577  *
1578  * @since New in 1.3.
1579  */
1580 svn_error_t *
1581 svn_io_wait_for_cmd(apr_proc_t *cmd_proc,
1582  const char *cmd,
1583  int *exitcode,
1584  apr_exit_why_e *exitwhy,
1585  apr_pool_t *pool);
1586 
1587 /** Run a command to completion, by first calling svn_io_start_cmd() and
1588  * then calling svn_io_wait_for_cmd(). The parameters correspond to
1589  * the same-named parameters of those two functions.
1590  */
1591 svn_error_t *
1592 svn_io_run_cmd(const char *path,
1593  const char *cmd,
1594  const char *const *args,
1595  int *exitcode,
1596  apr_exit_why_e *exitwhy,
1597  svn_boolean_t inherit,
1598  apr_file_t *infile,
1599  apr_file_t *outfile,
1600  apr_file_t *errfile,
1601  apr_pool_t *pool);
1602 
1603 /** Invoke the configured @c diff program, with @a user_args (an array
1604  * of utf8-encoded @a num_user_args arguments) if they are specified
1605  * (that is, if @a user_args is non-NULL), or "-u" if they are not.
1606  * If @a user_args is NULL, the value of @a num_user_args is ignored.
1607  *
1608  * Diff runs in utf8-encoded @a dir, and its exit status is stored in
1609  * @a exitcode, if it is not @c NULL.
1610  *
1611  * If @a label1 and/or @a label2 are not NULL they will be passed to the diff
1612  * process as the arguments of "-L" options. @a label1 and @a label2 are also
1613  * in utf8, and will be converted to native charset along with the other args.
1614  *
1615  * @a from is the first file passed to diff, and @a to is the second. The
1616  * stdout of diff will be sent to @a outfile, and the stderr to @a errfile.
1617  *
1618  * @a diff_cmd must be non-NULL.
1619  *
1620  * Do all allocation in @a pool.
1621  * @since New in 1.6.0.
1622  */
1623 svn_error_t *
1624 svn_io_run_diff2(const char *dir,
1625  const char *const *user_args,
1626  int num_user_args,
1627  const char *label1,
1628  const char *label2,
1629  const char *from,
1630  const char *to,
1631  int *exitcode,
1632  apr_file_t *outfile,
1633  apr_file_t *errfile,
1634  const char *diff_cmd,
1635  apr_pool_t *pool);
1636 
1637 /** Similar to svn_io_run_diff2() but with @a diff_cmd encoded in internal
1638  * encoding used by APR.
1639  *
1640  * @deprecated Provided for backwards compatibility with the 1.5 API. */
1642 svn_error_t *
1643 svn_io_run_diff(const char *dir,
1644  const char *const *user_args,
1645  int num_user_args,
1646  const char *label1,
1647  const char *label2,
1648  const char *from,
1649  const char *to,
1650  int *exitcode,
1651  apr_file_t *outfile,
1652  apr_file_t *errfile,
1653  const char *diff_cmd,
1654  apr_pool_t *pool);
1655 
1656 
1657 
1658 /** Invoke the configured @c diff3 program, in utf8-encoded @a dir
1659  * like this:
1660  *
1661  * diff3 -E -m @a mine @a older @a yours > @a merged
1662  *
1663  * (See the diff3 documentation for details.)
1664  *
1665  * If @a user_args is non-NULL, replace "-E" with the <tt>const char*</tt>
1666  * elements that @a user_args contains.
1667  *
1668  * @a mine, @a older and @a yours are utf8-encoded paths (relative to
1669  * @a dir or absolute) to three files that already exist.
1670  *
1671  * @a merged is an open file handle, and is left open after the merge
1672  * result is written to it. (@a merged should *not* be the same file
1673  * as @a mine, or nondeterministic things may happen!)
1674  *
1675  * @a mine_label, @a older_label, @a yours_label are utf8-encoded label
1676  * parameters for diff3's -L option. Any of them may be @c NULL, in
1677  * which case the corresponding @a mine, @a older, or @a yours parameter is
1678  * used instead.
1679  *
1680  * Set @a *exitcode to diff3's exit status. If @a *exitcode is anything
1681  * other than 0 or 1, then return #SVN_ERR_EXTERNAL_PROGRAM. (Note the
1682  * following from the diff3 info pages: "An exit status of 0 means
1683  * `diff3' was successful, 1 means some conflicts were found, and 2
1684  * means trouble.")
1685  *
1686  * @a diff3_cmd must be non-NULL.
1687  *
1688  * Do all allocation in @a pool.
1689  *
1690  * @since New in 1.4.
1691  */
1692 svn_error_t *
1693 svn_io_run_diff3_3(int *exitcode,
1694  const char *dir,
1695  const char *mine,
1696  const char *older,
1697  const char *yours,
1698  const char *mine_label,
1699  const char *older_label,
1700  const char *yours_label,
1701  apr_file_t *merged,
1702  const char *diff3_cmd,
1703  const apr_array_header_t *user_args,
1704  apr_pool_t *pool);
1705 
1706 /** Similar to svn_io_run_diff3_3(), but with @a diff3_cmd encoded in
1707  * internal encoding used by APR.
1708  *
1709  * @deprecated Provided for backwards compatibility with the 1.5 API.
1710  * @since New in 1.4.
1711  */
1713 svn_error_t *
1714 svn_io_run_diff3_2(int *exitcode,
1715  const char *dir,
1716  const char *mine,
1717  const char *older,
1718  const char *yours,
1719  const char *mine_label,
1720  const char *older_label,
1721  const char *yours_label,
1722  apr_file_t *merged,
1723  const char *diff3_cmd,
1724  const apr_array_header_t *user_args,
1725  apr_pool_t *pool);
1726 
1727 /** Similar to svn_io_run_diff3_2(), but with @a user_args set to @c NULL.
1728  *
1729  * @deprecated Provided for backwards compatibility with the 1.3 API.
1730  */
1732 svn_error_t *
1733 svn_io_run_diff3(const char *dir,
1734  const char *mine,
1735  const char *older,
1736  const char *yours,
1737  const char *mine_label,
1738  const char *older_label,
1739  const char *yours_label,
1740  apr_file_t *merged,
1741  int *exitcode,
1742  const char *diff3_cmd,
1743  apr_pool_t *pool);
1744 
1745 
1746 /** Parse utf8-encoded @a mimetypes_file as a MIME types file (such as
1747  * is provided with Apache HTTP Server), and set @a *type_map to a
1748  * hash mapping <tt>const char *</tt> filename extensions to
1749  * <tt>const char *</tt> MIME types.
1750  *
1751  * @since New in 1.5.
1752  */
1753 svn_error_t *
1754 svn_io_parse_mimetypes_file(apr_hash_t **type_map,
1755  const char *mimetypes_file,
1756  apr_pool_t *pool);
1757 
1758 
1759 /** Examine utf8-encoded @a file to determine if it can be described by a
1760  * known (as in, known by this function) Multipurpose Internet Mail
1761  * Extension (MIME) type. If so, set @a *mimetype to a character string
1762  * describing the MIME type, else set it to @c NULL.
1763  *
1764  * If not @c NULL, @a mimetype_map is a hash mapping <tt>const char *</tt>
1765  * filename extensions to <tt>const char *</tt> MIME types, and is the
1766  * first source consulted regarding @a file's MIME type.
1767  *
1768  * Use @a pool for any necessary allocations.
1769  *
1770  * @since New in 1.5.
1771  */
1772 svn_error_t *
1773 svn_io_detect_mimetype2(const char **mimetype,
1774  const char *file,
1775  apr_hash_t *mimetype_map,
1776  apr_pool_t *pool);
1777 
1778 
1779 /** Like svn_io_detect_mimetype2, but with @a mimetypes_map set to
1780  * @c NULL.
1781  *
1782  * @deprecated Provided for backward compatibility with the 1.4 API
1783  */
1785 svn_error_t *
1786 svn_io_detect_mimetype(const char **mimetype,
1787  const char *file,
1788  apr_pool_t *pool);
1789 
1790 
1791 /** Examine up to @a len bytes of data in @a buf to determine if the
1792  * can be considered binary data, in which case return TRUE.
1793  * If the data can be considered plain-text data, return FALSE.
1794  *
1795  * @since New in 1.7.
1796  */
1798 svn_io_is_binary_data(const void *buf, apr_size_t len);
1799 
1800 
1801 /** Wrapper for apr_file_open(). @a fname is utf8-encoded. */
1802 svn_error_t *
1803 svn_io_file_open(apr_file_t **new_file,
1804  const char *fname,
1805  apr_int32_t flag,
1806  apr_fileperms_t perm,
1807  apr_pool_t *pool);
1808 
1809 
1810 /** Wrapper for apr_file_close(). */
1811 svn_error_t *
1812 svn_io_file_close(apr_file_t *file,
1813  apr_pool_t *pool);
1814 
1815 
1816 /** Wrapper for apr_file_getc(). */
1817 svn_error_t *
1818 svn_io_file_getc(char *ch,
1819  apr_file_t *file,
1820  apr_pool_t *pool);
1821 
1822 
1823 /** Wrapper for apr_file_putc().
1824  * @since New in 1.7
1825  */
1826 svn_error_t *
1827 svn_io_file_putc(char ch,
1828  apr_file_t *file,
1829  apr_pool_t *pool);
1830 
1831 
1832 /** Wrapper for apr_file_info_get(). */
1833 svn_error_t *
1834 svn_io_file_info_get(apr_finfo_t *finfo,
1835  apr_int32_t wanted,
1836  apr_file_t *file,
1837  apr_pool_t *pool);
1838 
1839 
1840 /** Wrapper for apr_file_read(). */
1841 svn_error_t *
1842 svn_io_file_read(apr_file_t *file,
1843  void *buf,
1844  apr_size_t *nbytes,
1845  apr_pool_t *pool);
1846 
1847 
1848 /** Wrapper for apr_file_read_full().
1849  *
1850  * If @a hit_eof is not NULL, EOF will be indicated there and no
1851  * svn_error_t error object will be created upon EOF.
1852  *
1853  * @since New in 1.7
1854  */
1855 svn_error_t *
1856 svn_io_file_read_full2(apr_file_t *file,
1857  void *buf,
1858  apr_size_t nbytes,
1859  apr_size_t *bytes_read,
1860  svn_boolean_t *hit_eof,
1861  apr_pool_t *pool);
1862 
1863 
1864 /** Similar to svn_io_file_read_full2 with hit_eof being set
1865  * to @c NULL.
1866  *
1867  * @deprecated Provided for backward compatibility with the 1.6 API
1868  */
1870 svn_error_t *
1871 svn_io_file_read_full(apr_file_t *file,
1872  void *buf,
1873  apr_size_t nbytes,
1874  apr_size_t *bytes_read,
1875  apr_pool_t *pool);
1876 
1877 
1878 /** Wrapper for apr_file_seek(). */
1879 svn_error_t *
1880 svn_io_file_seek(apr_file_t *file,
1881  apr_seek_where_t where,
1882  apr_off_t *offset,
1883  apr_pool_t *pool);
1884 
1885 
1886 /** Wrapper for apr_file_write(). */
1887 svn_error_t *
1888 svn_io_file_write(apr_file_t *file,
1889  const void *buf,
1890  apr_size_t *nbytes,
1891  apr_pool_t *pool);
1892 
1893 
1894 /** Wrapper for apr_file_write_full(). */
1895 svn_error_t *
1896 svn_io_file_write_full(apr_file_t *file,
1897  const void *buf,
1898  apr_size_t nbytes,
1899  apr_size_t *bytes_written,
1900  apr_pool_t *pool);
1901 
1902 /**
1903  * Open a unique file in @a dirpath, and write @a nbytes from @a buf to
1904  * the file before flushing it to disk and closing it. Return the name
1905  * of the newly created file in @a *tmp_path, allocated in @a pool.
1906  *
1907  * If @a dirpath is @c NULL, use the path returned from svn_io_temp_dir().
1908  * (Note that when using the system-provided temp directory, it may not
1909  * be possible to atomically rename the resulting file due to cross-device
1910  * issues.)
1911  *
1912  * The file will be deleted according to @a delete_when.
1913  *
1914  * @since New in 1.6.
1915  */
1916 svn_error_t *
1917 svn_io_write_unique(const char **tmp_path,
1918  const char *dirpath,
1919  const void *buf,
1920  apr_size_t nbytes,
1921  svn_io_file_del_t delete_when,
1922  apr_pool_t *pool);
1923 
1924 /** Wrapper for apr_file_trunc().
1925  * @since New in 1.6. */
1926 svn_error_t *
1927 svn_io_file_trunc(apr_file_t *file,
1928  apr_off_t offset,
1929  apr_pool_t *pool);
1930 
1931 
1932 /** Wrapper for apr_stat(). @a fname is utf8-encoded. */
1933 svn_error_t *
1934 svn_io_stat(apr_finfo_t *finfo,
1935  const char *fname,
1936  apr_int32_t wanted,
1937  apr_pool_t *pool);
1938 
1939 
1940 /** Rename and/or move the node (not necessarily a regular file) at
1941  * @a from_path to a new path @a to_path within the same filesystem.
1942  * In some cases, an existing node at @a to_path will be overwritten.
1943  *
1944  * A wrapper for apr_file_rename(). @a from_path and @a to_path are
1945  * utf8-encoded.
1946  */
1947 svn_error_t *
1948 svn_io_file_rename(const char *from_path,
1949  const char *to_path,
1950  apr_pool_t *pool);
1951 
1952 
1953 /** Move the file from @a from_path to @a to_path, even across device
1954  * boundaries. Overwrite @a to_path if it exists.
1955  *
1956  * @note This function is different from svn_io_file_rename in that the
1957  * latter fails in the 'across device boundaries' case.
1958  *
1959  * @since New in 1.3.
1960  */
1961 svn_error_t *
1962 svn_io_file_move(const char *from_path,
1963  const char *to_path,
1964  apr_pool_t *pool);
1965 
1966 
1967 /** Wrapper for apr_dir_make(). @a path is utf8-encoded. */
1968 svn_error_t *
1969 svn_io_dir_make(const char *path,
1970  apr_fileperms_t perm,
1971  apr_pool_t *pool);
1972 
1973 /** Same as svn_io_dir_make(), but sets the hidden attribute on the
1974  directory on systems that support it. */
1975 svn_error_t *
1976 svn_io_dir_make_hidden(const char *path,
1977  apr_fileperms_t perm,
1978  apr_pool_t *pool);
1979 
1980 /**
1981  * Same as svn_io_dir_make(), but attempts to set the sgid on the
1982  * directory on systems that support it. Does not return an error if
1983  * the attempt to set the sgid bit fails. On Unix filesystems,
1984  * setting the sgid bit on a directory ensures that files and
1985  * subdirectories created within inherit group ownership from the
1986  * parent instead of from the primary gid.
1987  *
1988  * @since New in 1.1.
1989  */
1990 svn_error_t *
1991 svn_io_dir_make_sgid(const char *path,
1992  apr_fileperms_t perm,
1993  apr_pool_t *pool);
1994 
1995 /** Wrapper for apr_dir_open(). @a dirname is utf8-encoded. */
1996 svn_error_t *
1997 svn_io_dir_open(apr_dir_t **new_dir,
1998  const char *dirname,
1999  apr_pool_t *pool);
2000 
2001 /** Wrapper for apr_dir_close().
2002  *
2003  * @since New in 1.7.
2004  */
2005 svn_error_t *
2006 svn_io_dir_close(apr_dir_t *thedir);
2007 
2008 /** Wrapper for apr_dir_remove(). @a dirname is utf8-encoded.
2009  * @note This function has this name to avoid confusion with
2010  * svn_io_remove_dir2(), which is recursive.
2011  */
2012 svn_error_t *
2013 svn_io_dir_remove_nonrecursive(const char *dirname,
2014  apr_pool_t *pool);
2015 
2016 
2017 /** Wrapper for apr_dir_read(). Ensures that @a finfo->name is
2018  * utf8-encoded, which means allocating @a finfo->name in @a pool,
2019  * which may or may not be the same as @a finfo's pool. Use @a pool
2020  * for error allocation as well.
2021  */
2022 svn_error_t *
2023 svn_io_dir_read(apr_finfo_t *finfo,
2024  apr_int32_t wanted,
2025  apr_dir_t *thedir,
2026  apr_pool_t *pool);
2027 
2028 /** Wrapper for apr_file_name_get(). @a *filename is utf8-encoded.
2029  *
2030  * @note The file name may be NULL.
2031  *
2032  * @since New in 1.7. */
2033 svn_error_t *
2034 svn_io_file_name_get(const char **filename,
2035  apr_file_t *file,
2036  apr_pool_t *pool);
2037 
2038 
2039 
2040 /** Version/format files.
2041  *
2042  * @defgroup svn_io_format_files Version/format files
2043  * @{
2044  */
2045 
2046 /** Set @a *version to the integer that starts the file at @a path. If the
2047  * file does not begin with a series of digits followed by a newline,
2048  * return the error #SVN_ERR_BAD_VERSION_FILE_FORMAT. Use @a pool for
2049  * all allocations.
2050  */
2051 svn_error_t *
2052 svn_io_read_version_file(int *version,
2053  const char *path,
2054  apr_pool_t *pool);
2055 
2056 /** Create (or overwrite) the file at @a path with new contents,
2057  * formatted as a non-negative integer @a version followed by a single
2058  * newline. On successful completion the file will be read-only. Use
2059  * @a pool for all allocations.
2060  */
2061 svn_error_t *
2062 svn_io_write_version_file(const char *path,
2063  int version,
2064  apr_pool_t *pool);
2065 
2066 /** @} */
2067 
2068 #ifdef __cplusplus
2069 }
2070 #endif /* __cplusplus */
2071 
2072 #endif /* SVN_IO_H */
Counted-length strings for Subversion, plus some C string goodies.
svn_error_t * svn_io_file_seek(apr_file_t *file, apr_seek_where_t where, apr_off_t *offset, apr_pool_t *pool)
Wrapper for apr_file_seek().
svn_error_t * svn_io_check_special_path(const char *path, svn_node_kind_t *kind, svn_boolean_t *is_special, apr_pool_t *pool)
Like svn_io_check_path(), but also set *is_special to TRUE if the path is not a normal file...
svn_error_t * svn_io_file_trunc(apr_file_t *file, apr_off_t offset, apr_pool_t *pool)
Wrapper for apr_file_trunc().
svn_error_t * svn_io_file_read_full2(apr_file_t *file, void *buf, apr_size_t nbytes, apr_size_t *bytes_read, svn_boolean_t *hit_eof, apr_pool_t *pool)
Wrapper for apr_file_read_full().
svn_error_t * svn_io_file_open(apr_file_t **new_file, const char *fname, apr_int32_t flag, apr_fileperms_t perm, apr_pool_t *pool)
Wrapper for apr_file_open().
svn_error_t * svn_io_set_file_read_only(const char *path, svn_boolean_t ignore_enoent, apr_pool_t *pool)
Make a file as read-only as the operating system allows.
struct svn_io_dirent_t svn_io_dirent_t
Represents the kind and special status of a directory entry.
svn_checksum_kind_t
Various types of checksums.
Definition: svn_checksum.h:45
svn_error_t * svn_stream_mark(svn_stream_t *stream, svn_stream_mark_t **mark, apr_pool_t *pool)
Set a mark at the current position of a generic stream, which can later be sought back to using svn_s...
svn_error_t * svn_io_file_close(apr_file_t *file, apr_pool_t *pool)
Wrapper for apr_file_close().
svn_error_t * svn_io_remove_file(const char *path, apr_pool_t *pool)
Similar to svn_io_remove_file2(), except with ignore_enoent set to FALSE.
svn_error_t * svn_io_run_diff2(const char *dir, const char *const *user_args, int num_user_args, const char *label1, const char *label2, const char *from, const char *to, int *exitcode, apr_file_t *outfile, apr_file_t *errfile, const char *diff_cmd, apr_pool_t *pool)
Invoke the configured diff program, with user_args (an array of utf8-encoded num_user_args arguments)...
svn_error_t * svn_stream_read(svn_stream_t *stream, char *buffer, apr_size_t *len)
Read from a generic stream.
svn_error_t * svn_stream_copy(svn_stream_t *from, svn_stream_t *to, apr_pool_t *pool)
Same as svn_stream_copy3(), but without the cancellation function or stream closing.
void svn_stream_set_seek(svn_stream_t *stream, svn_stream_seek_fn_t seek_fn)
Set stream's seek function to seek_fn.
svn_error_t * svn_io_copy_perms(const char *src, const char *dst, apr_pool_t *pool)
Copy permission flags from src onto the file at dst.
svn_error_t * svn_io_check_path(const char *path, svn_node_kind_t *kind, apr_pool_t *pool)
Determine the kind of path.
svn_error_t * svn_io_file_flush_to_disk(apr_file_t *file, apr_pool_t *pool)
Flush any unwritten data from file to disk.
Subversion checksum routines.
svn_boolean_t special
If kind is svn_node_file, whether this entry is a special file; else FALSE.
Definition: svn_io.h:89
svn_error_t * svn_io_set_file_read_write(const char *path, svn_boolean_t ignore_enoent, apr_pool_t *pool)
Make a file as writable as the operating system allows.
svn_error_t * svn_io_file_putc(char ch, apr_file_t *file, apr_pool_t *pool)
Wrapper for apr_file_putc().
svn_error_t * svn_io_filesizes_different_p(svn_boolean_t *different_p, const char *file1, const char *file2, apr_pool_t *pool)
Set *different_p to non-zero if file1 and file2 have different sizes, else set to zero...
svn_io_file_del_t
Used as an argument when creating temporary files to indicate when a file should be removed...
Definition: svn_io.h:58
svn_error_t * svn_stream_printf(svn_stream_t *stream, apr_pool_t *pool, const char *fmt,...)
Write to stream using a printf-style fmt specifier, passed through apr_psprintf() using memory from p...
void svn_stream_set_mark(svn_stream_t *stream, svn_stream_mark_fn_t mark_fn)
Set stream's mark function to mark_fn.
Represents the kind and special status of a directory entry.
Definition: svn_io.h:123
svn_stream_t * svn_stream_checksummed2(svn_stream_t *stream, svn_checksum_t **read_checksum, svn_checksum_t **write_checksum, svn_checksum_kind_t checksum_kind, svn_boolean_t read_all, apr_pool_t *pool)
Return a stream that calculates checksums for all data read and written.
svn_error_t * svn_io_file_checksum2(svn_checksum_t **checksum, const char *file, svn_checksum_kind_t kind, apr_pool_t *pool)
Return in *checksum the checksum of type kind of file Use pool for temporary allocations and to alloc...
svn_error_t * svn_io_file_lock(const char *lock_file, svn_boolean_t exclusive, apr_pool_t *pool)
Lock file at lock_file.
svn_error_t * svn_io_dir_remove_nonrecursive(const char *dirname, apr_pool_t *pool)
Wrapper for apr_dir_remove().
svn_stream_t * svn_stream_disown(svn_stream_t *stream, apr_pool_t *pool)
Return a stream allocated in pool which forwards all requests to stream.
svn_error_t * svn_stream_printf_from_utf8(svn_stream_t *stream, const char *encoding, apr_pool_t *pool, const char *fmt,...)
Write to stream using a printf-style fmt specifier, passed through apr_psprintf() using memory from p...
svn_error_t * svn_io_get_dirents3(apr_hash_t **dirents, const char *path, svn_boolean_t only_check_type, apr_pool_t *result_pool, apr_pool_t *scratch_pool)
Read all of the disk entries in directory path, a utf8-encoded path.
svn_error_t * svn_io_detect_mimetype2(const char **mimetype, const char *file, apr_hash_t *mimetype_map, apr_pool_t *pool)
Examine utf8-encoded file to determine if it can be described by a known (as in, known by this functi...
svn_error_t * svn_io_remove_dir2(const char *path, svn_boolean_t ignore_enoent, svn_cancel_func_t cancel_func, void *cancel_baton, apr_pool_t *pool)
Recursively remove directory path.
svn_error_t * svn_io_get_dirents2(apr_hash_t **dirents, const char *path, apr_pool_t *pool)
Similar to svn_io_get_dirents3, but returns a mapping to svn_io_dirent_t structures instead of svn_io...
svn_error_t * svn_io_open_unique_file3(apr_file_t **file, const char **temp_path, const char *dirpath, svn_io_file_del_t delete_when, apr_pool_t *result_pool, apr_pool_t *scratch_pool)
Create a writable file, with an arbitrary and unique name, in the directory dirpath.
svn_error_t * svn_io_dir_make_hidden(const char *path, apr_fileperms_t perm, apr_pool_t *pool)
Same as svn_io_dir_make(), but sets the hidden attribute on the directory on systems that support it...
svn_error_t * svn_stream_close(svn_stream_t *stream)
Close a generic stream.
A simple counted string.
Definition: svn_string.h:96
svn_error_t * svn_stream_for_stderr(svn_stream_t **err, apr_pool_t *pool)
Set *err to a generic stream connected to stderr, allocated in pool.
void svn_stream_set_close(svn_stream_t *stream, svn_close_fn_t close_fn)
Set stream's close function to close_fn.
svn_stream_t * svn_stream_checksummed(svn_stream_t *stream, const unsigned char **read_digest, const unsigned char **write_digest, svn_boolean_t read_all, apr_pool_t *pool)
Similar to svn_stream_checksummed2(), but always returning the MD5 checksum in read_digest and write_...
void svn_stream_set_write(svn_stream_t *stream, svn_write_fn_t write_fn)
Set stream's write function to write_fn.
void svn_stream_set_read(svn_stream_t *stream, svn_read_fn_t read_fn)
Set stream's read function to read_fn.
svn_node_kind_t
The various types of nodes in the Subversion filesystem.
Definition: svn_types.h:202
svn_error_t * svn_stream_copy3(svn_stream_t *from, svn_stream_t *to, svn_cancel_func_t cancel_func, void *cancel_baton, apr_pool_t *pool)
Read the contents of the readable stream from and write them to the writable stream to calling cancel...
Remove when the file is closed.
Definition: svn_io.h:63
svn_error_t * svn_io_read_length_line(apr_file_t *file, char *buf, apr_size_t *limit, apr_pool_t *pool)
Read a line from file into buf, but not exceeding *limit bytes.
svn_error_t * svn_io_file_affected_time(apr_time_t *apr_time, const char *path, apr_pool_t *pool)
Set *apr_time to the time of last modification of the contents of the file path.
svn_stream_t * svn_stream_from_string(const svn_string_t *str, apr_pool_t *pool)
Return a generic read-only stream connected to string str.
svn_error_t * svn_io_start_cmd2(apr_proc_t *cmd_proc, const char *path, const char *cmd, const char *const *args, svn_boolean_t inherit, svn_boolean_t infile_pipe, apr_file_t *infile, svn_boolean_t outfile_pipe, apr_file_t *outfile, svn_boolean_t errfile_pipe, apr_file_t *errfile, apr_pool_t *pool)
Start cmd with args, using utf8-encoded path as working directory.
svn_error_t * svn_io_file_move(const char *from_path, const char *to_path, apr_pool_t *pool)
Move the file from from_path to to_path, even across device boundaries.
svn_error_t * svn_io_set_file_affected_time(apr_time_t apr_time, const char *path, apr_pool_t *pool)
Set the timestamp of file path to apr_time.
svn_error_t * svn_io_open_unique_file(apr_file_t **f, const char **unique_name_p, const char *path, const char *suffix, svn_boolean_t delete_on_close, apr_pool_t *pool)
Like svn_io_open_unique_file2, but can't delete on pool cleanup.
svn_error_t * svn_io_run_diff3(const char *dir, const char *mine, const char *older, const char *yours, const char *mine_label, const char *older_label, const char *yours_label, apr_file_t *merged, int *exitcode, const char *diff3_cmd, apr_pool_t *pool)
Similar to svn_io_run_diff3_2(), but with user_args set to NULL.
svn_io_dirent2_t * svn_io_dirent2_create(apr_pool_t *result_pool)
Creates a new svn_io_dirent2_t structure.
svn_error_t * svn_io_set_file_read_write_carefully(const char *path, svn_boolean_t enable_write, svn_boolean_t ignore_enoent, apr_pool_t *pool)
Similar to svn_io_set_file_read_* functions.
svn_error_t *(* svn_io_walk_func_t)(void *baton, const char *path, const apr_finfo_t *finfo, apr_pool_t *pool)
Callback function type for svn_io_dir_walk()
Definition: svn_io.h:1458
Subversion error object.
Definition: svn_types.h:90
svn_error_t * svn_io_start_cmd(apr_proc_t *cmd_proc, const char *path, const char *cmd, const char *const *args, svn_boolean_t inherit, apr_file_t *infile, apr_file_t *outfile, apr_file_t *errfile, apr_pool_t *pool)
Similar to svn_io_start_cmd2() but with infile_pipe, outfile_pipe, and errfile_pipe always FALSE...
svn_error_t * svn_io_temp_dir(const char **dir, apr_pool_t *pool)
Set *dir to a directory path (allocated in pool) deemed usable for the creation of temporary files an...
svn_error_t * svn_io_stat(apr_finfo_t *finfo, const char *fname, apr_int32_t wanted, apr_pool_t *pool)
Wrapper for apr_stat().
svn_error_t * svn_io_run_diff3_3(int *exitcode, const char *dir, const char *mine, const char *older, const char *yours, const char *mine_label, const char *older_label, const char *yours_label, apr_file_t *merged, const char *diff3_cmd, const apr_array_header_t *user_args, apr_pool_t *pool)
Invoke the configured diff3 program, in utf8-encoded dir like this:
svn_error_t * svn_stream_open_unique(svn_stream_t **stream, const char **temp_path, const char *dirpath, svn_io_file_del_t delete_when, apr_pool_t *result_pool, apr_pool_t *scratch_pool)
Create a writable stream to a file in the directory dirpath.
svn_error_t * svn_stream_reset(svn_stream_t *stream)
Reset a generic stream back to its origin.
void svn_io_sleep_for_timestamps(const char *path, apr_pool_t *pool)
Sleep to ensure that any files modified after we exit have a different timestamp than the one we reco...
No deletion ever.
Definition: svn_io.h:61
svn_error_t * svn_stringbuf_from_file2(svn_stringbuf_t **result, const char *filename, apr_pool_t *pool)
Set *result to a string containing the contents of filename, which is either "-" (indicating that std...
svn_error_t * svn_stringbuf_from_aprfile(svn_stringbuf_t **result, apr_file_t *file, apr_pool_t *pool)
Sets *result to a string containing the contents of the already opened file.
svn_error_t * svn_io_file_write(apr_file_t *file, const void *buf, apr_size_t *nbytes, apr_pool_t *pool)
Wrapper for apr_file_write().
apr_int64_t svn_filesize_t
The size of a file in the Subversion FS.
Definition: svn_types.h:353
svn_boolean_t svn_stream_supports_mark(svn_stream_t *stream)
Returns TRUE if the generic stream supports svn_stream_mark().
svn_error_t * svn_stream_skip(svn_stream_t *stream, apr_size_t len)
Skip len bytes from a generic stream.
svn_error_t * svn_stream_readline(svn_stream_t *stream, svn_stringbuf_t **stringbuf, const char *eol, svn_boolean_t *eof, apr_pool_t *pool)
Allocate *stringbuf in pool, and read into it one line (terminated by eol) from stream.
svn_error_t * svn_io_file_checksum(unsigned char digest[], const char *file, apr_pool_t *pool)
Put the md5 checksum of file into digest.
svn_error_t * svn_stream_copy2(svn_stream_t *from, svn_stream_t *to, svn_cancel_func_t cancel_func, void *cancel_baton, apr_pool_t *pool)
Same as svn_stream_copy3() but the streams are not closed.
svn_error_t * svn_io_dir_make(const char *path, apr_fileperms_t perm, apr_pool_t *pool)
Wrapper for apr_dir_make().
svn_error_t * svn_stream_seek(svn_stream_t *stream, const svn_stream_mark_t *mark)
Seek to a mark in a generic stream.
Remove when the associated pool is cleared.
Definition: svn_io.h:65
svn_error_t * svn_stream_open_readonly(svn_stream_t **stream, const char *path, apr_pool_t *result_pool, apr_pool_t *scratch_pool)
Create a stream to read the file at path.
svn_error_t * svn_io_dir_open(apr_dir_t **new_dir, const char *dirname, apr_pool_t *pool)
Wrapper for apr_dir_open().
svn_error_t * svn_io_open_uniquely_named(apr_file_t **file, const char **unique_name, const char *dirpath, const char *filename, const char *suffix, svn_io_file_del_t delete_when, apr_pool_t *result_pool, apr_pool_t *scratch_pool)
Open a new file (for reading and writing) with a unique name based on utf-8 encoded filename...
svn_error_t * svn_io_copy_file(const char *src, const char *dst, svn_boolean_t copy_perms, apr_pool_t *pool)
Copy src to dst atomically, in a "byte-for-byte" manner.
svn_error_t * svn_io_read_link(svn_string_t **dest, const char *path, apr_pool_t *pool)
Set *dest to the path that the symlink at path references.
apr_time_t mtime
The time the file was last modified.
Definition: svn_io.h:95
svn_error_t * svn_io_file_read_full(apr_file_t *file, void *buf, apr_size_t nbytes, apr_size_t *bytes_read, apr_pool_t *pool)
Similar to svn_io_file_read_full2 with hit_eof being set to NULL.
svn_error_t * svn_io_file_read(apr_file_t *file, void *buf, apr_size_t *nbytes, apr_pool_t *pool)
Wrapper for apr_file_read().
svn_error_t * svn_io_is_file_executable(svn_boolean_t *executable, const char *path, apr_pool_t *pool)
Determine whether a file is executable by the current user.
svn_stream_t * svn_stream_from_aprfile2(apr_file_t *file, svn_boolean_t disown, apr_pool_t *pool)
Create a stream from an APR file.
svn_error_t * svn_io_read_version_file(int *version, const char *path, apr_pool_t *pool)
Set *version to the integer that starts the file at path.
svn_error_t * svn_io_dir_walk(const char *dirname, apr_int32_t wanted, svn_io_walk_func_t walk_func, void *walk_baton, apr_pool_t *pool)
Similar to svn_io_dir_walk(), but only calls walk_func for files of type APR_DIR (directory) and APR_...
svn_error_t * svn_stream_contents_same2(svn_boolean_t *same, svn_stream_t *stream1, svn_stream_t *stream2, apr_pool_t *pool)
Set *same to TRUE if stream1 and stream2 have the same contents, else set it to FALSE.
struct svn_io_dirent2_t svn_io_dirent2_t
A set of directory entry data elements as returned by svn_io_get_dirents.
svn_error_t * svn_io_run_diff(const char *dir, const char *const *user_args, int num_user_args, const char *label1, const char *label2, const char *from, const char *to, int *exitcode, apr_file_t *outfile, apr_file_t *errfile, const char *diff_cmd, apr_pool_t *pool)
Similar to svn_io_run_diff2() but with diff_cmd encoded in internal encoding used by APR...
svn_error_t *(* svn_write_fn_t)(void *baton, const char *data, apr_size_t *len)
Write handler function for a generic stream.
Definition: svn_io.h:760
svn_error_t *(* svn_stream_seek_fn_t)(void *baton, const svn_stream_mark_t *mark)
Seek handler function for a generic stream.
Definition: svn_io.h:790
svn_error_t * svn_io_wait_for_cmd(apr_proc_t *cmd_proc, const char *cmd, int *exitcode, apr_exit_why_e *exitwhy, apr_pool_t *pool)
Wait for the process *cmd_proc to complete and optionally retrieve its exit code. ...
svn_error_t * svn_io_dir_file_copy(const char *src_path, const char *dest_path, const char *file, apr_pool_t *pool)
Copy the file whose basename (or relative path) is file within directory src_path to the same basenam...
svn_error_t * svn_io_dir_make_sgid(const char *path, apr_fileperms_t perm, apr_pool_t *pool)
Same as svn_io_dir_make(), but attempts to set the sgid on the directory on systems that support it...
struct svn_stream_t svn_stream_t
An abstract stream of bytes–either incoming or outgoing or both.
Definition: svn_io.h:743
svn_filesize_t filesize
The filesize of this entry or undefined for a directory.
Definition: svn_io.h:92
Subversion's data types.
svn_error_t * svn_io_file_name_get(const char **filename, apr_file_t *file, apr_pool_t *pool)
Wrapper for apr_file_name_get().
svn_error_t * svn_io_copy_link(const char *src, const char *dst, apr_pool_t *pool)
Copy symbolic link src to dst atomically.
svn_error_t * svn_io_write_unique(const char **tmp_path, const char *dirpath, const void *buf, apr_size_t nbytes, svn_io_file_del_t delete_when, apr_pool_t *pool)
Open a unique file in dirpath, and write nbytes from buf to the file before flushing it to disk and c...
svn_error_t * svn_stream_contents_same(svn_boolean_t *same, svn_stream_t *stream1, svn_stream_t *stream2, apr_pool_t *pool)
Same as svn_stream_contents_same2(), but the streams will not be closed.
A generic checksum representation.
Definition: svn_checksum.h:59
svn_error_t * svn_io_check_resolved_path(const char *path, svn_node_kind_t *kind, apr_pool_t *pool)
Like svn_io_check_path(), but resolve symlinks.
svn_error_t * svn_io_parse_mimetypes_file(apr_hash_t **type_map, const char *mimetypes_file, apr_pool_t *pool)
Parse utf8-encoded mimetypes_file as a MIME types file (such as is provided with Apache HTTP Server)...
svn_stream_t * svn_stream_empty(apr_pool_t *pool)
Create a stream that is empty for reading and infinite for writing.
svn_error_t *(* svn_close_fn_t)(void *baton)
Close handler function for a generic stream.
Definition: svn_io.h:765
svn_error_t * svn_stringbuf_from_file(svn_stringbuf_t **result, const char *filename, apr_pool_t *pool)
Similar to svn_stringbuf_from_file2(), except that if filename is "-", return the error SVN_ERR_UNS...
#define SVN_DEPRECATED
Macro used to mark deprecated functions.
Definition: svn_types.h:58
svn_error_t * svn_io_dir_read(apr_finfo_t *finfo, apr_int32_t wanted, apr_dir_t *thedir, apr_pool_t *pool)
Wrapper for apr_dir_read().
svn_stream_t * svn_stream_create(void *baton, apr_pool_t *pool)
Create a generic stream.
svn_node_kind_t kind
The kind of this entry.
Definition: svn_io.h:125
void svn_stream_set_skip(svn_stream_t *stream, svn_stream_skip_fn_t skip_fn)
Set stream's skip function to skip_fn.
svn_error_t * svn_io_file_getc(char *ch, apr_file_t *file, apr_pool_t *pool)
Wrapper for apr_file_getc().
struct svn_stream_mark_t svn_stream_mark_t
An opaque type which represents a mark on a stream.
Definition: svn_io.h:774
svn_error_t * svn_io_run_diff3_2(int *exitcode, const char *dir, const char *mine, const char *older, const char *yours, const char *mine_label, const char *older_label, const char *yours_label, apr_file_t *merged, const char *diff3_cmd, const apr_array_header_t *user_args, apr_pool_t *pool)
Similar to svn_io_run_diff3_3(), but with diff3_cmd encoded in internal encoding used by APR...
svn_error_t * svn_io_dir_walk2(const char *dirname, apr_int32_t wanted, svn_io_walk_func_t walk_func, void *walk_baton, apr_pool_t *pool)
Recursively walk the directory rooted at dirname, a utf8-encoded path, invoking walk_func (with walk_...
svn_boolean_t svn_io_is_binary_data(const void *buf, apr_size_t len)
Examine up to len bytes of data in buf to determine if the can be considered binary data...
svn_error_t * svn_io_detect_mimetype(const char **mimetype, const char *file, apr_pool_t *pool)
Like svn_io_detect_mimetype2, but with mimetypes_map set to NULL.
svn_error_t * svn_io_file_lock2(const char *lock_file, svn_boolean_t exclusive, svn_boolean_t nonblocking, apr_pool_t *pool)
Lock file at lock_file.
svn_error_t *(* svn_cancel_func_t)(void *cancel_baton)
A user defined callback that subversion will call with a user defined baton to see if the current ope...
Definition: svn_types.h:1050
A set of directory entry data elements as returned by svn_io_get_dirents.
Definition: svn_io.h:78
svn_error_t * svn_io_dir_close(apr_dir_t *thedir)
Wrapper for apr_dir_close().
svn_error_t * svn_io_dir_empty(svn_boolean_t *is_empty_p, const char *path, apr_pool_t *pool)
Set *is_empty_p to TRUE if directory path is empty, else to FALSE if it is not empty.
svn_error_t * svn_io_file_info_get(apr_finfo_t *finfo, apr_int32_t wanted, apr_file_t *file, apr_pool_t *pool)
Wrapper for apr_file_info_get().
svn_error_t * svn_io_open_unique_file2(apr_file_t **f, const char **unique_name_p, const char *path, const char *suffix, svn_io_file_del_t delete_when, apr_pool_t *pool)
Like svn_io_open_uniquely_named(), but takes a joined dirpath and filename, and a single pool...
svn_error_t * svn_io_get_dirents(apr_hash_t **dirents, const char *path, apr_pool_t *pool)
Similar to svn_io_get_dirents2(), but *dirents is a hash table with svn_node_kind_t values...
svn_error_t * svn_io_append_file(const char *src, const char *dst, apr_pool_t *pool)
Append src to dst.
svn_error_t * svn_io_files_contents_same_p(svn_boolean_t *same, const char *file1, const char *file2, apr_pool_t *pool)
Set *same to TRUE if file1 and file2 have the same contents, else set it to FALSE.
svn_error_t * svn_io_make_dir_recursively(const char *path, apr_pool_t *pool)
Create directory path on the file system, creating intermediate directories as required, like mkdir -p.
svn_error_t * svn_stream_for_stdin(svn_stream_t **in, apr_pool_t *pool)
Set *in to a generic stream connected to stdin, allocated in pool.
svn_boolean_t special
If kind is svn_node_file, whether this entry is a special file; else FALSE.
Definition: svn_io.h:131
svn_error_t *(* svn_stream_mark_fn_t)(void *baton, svn_stream_mark_t **mark, apr_pool_t *pool)
Mark handler function for a generic stream.
Definition: svn_io.h:781
svn_error_t * svn_io_copy_dir_recursively(const char *src, const char *dst_parent, const char *dst_basename, svn_boolean_t copy_perms, svn_cancel_func_t cancel_func, void *cancel_baton, apr_pool_t *pool)
Recursively copy directory src into dst_parent, as a new entry named dst_basename.
svn_stream_t * svn_stream_from_aprfile(apr_file_t *file, apr_pool_t *pool)
Similar to svn_stream_from_aprfile2(), except that the file will always be disowned.
svn_error_t * svn_io_file_write_full(apr_file_t *file, const void *buf, apr_size_t nbytes, apr_size_t *bytes_written, apr_pool_t *pool)
Wrapper for apr_file_write_full().
svn_error_t * svn_stream_open_writable(svn_stream_t **stream, const char *path, apr_pool_t *result_pool, apr_pool_t *scratch_pool)
Create a stream to write a file at path.
svn_io_dirent2_t * svn_io_dirent2_dup(const svn_io_dirent2_t *item, apr_pool_t *result_pool)
Duplicates a svn_io_dirent2_t structure into result_pool.
svn_stream_t * svn_stream_from_stringbuf(svn_stringbuf_t *str, apr_pool_t *pool)
Return a generic stream connected to stringbuf str.
svn_error_t * svn_io_write_version_file(const char *path, int version, apr_pool_t *pool)
Create (or overwrite) the file at path with new contents, formatted as a non-negative integer version...
svn_error_t * svn_io_get_dir_filenames(apr_hash_t **dirents, const char *path, apr_pool_t *pool)
Read all of the disk entries in directory path, a utf8-encoded path.
svn_error_t * svn_io_remove_file2(const char *path, svn_boolean_t ignore_enoent, apr_pool_t *scratch_pool)
Remove file path, a utf8-encoded path.
svn_error_t * svn_io_set_file_executable(const char *path, svn_boolean_t executable, svn_boolean_t ignore_enoent, apr_pool_t *pool)
Set path's "executability" (but do nothing if it is a symlink).
int svn_boolean_t
YABT: Yet Another Boolean Type.
Definition: svn_types.h:370
svn_stream_t * svn_stream_tee(svn_stream_t *out1, svn_stream_t *out2, apr_pool_t *pool)
Return a writable stream which, when written to, writes to both of the underlying streams...
svn_error_t * svn_stream_write(svn_stream_t *stream, const char *data, apr_size_t *len)
Write to a generic stream.
svn_node_kind_t kind
The kind of this entry.
Definition: svn_io.h:82
void svn_stream_set_baton(svn_stream_t *stream, void *baton)
Set stream's baton to baton.
svn_stream_t * svn_stream_compressed(svn_stream_t *stream, apr_pool_t *pool)
Return a stream that decompresses all data read and compresses all data written.
svn_error_t * svn_io_file_rename(const char *from_path, const char *to_path, apr_pool_t *pool)
Rename and/or move the node (not necessarily a regular file) at from_path to a new path to_path withi...
svn_error_t * svn_io_stat_dirent(const svn_io_dirent2_t **dirent_p, const char *path, svn_boolean_t ignore_enoent, apr_pool_t *result_pool, apr_pool_t *scratch_pool)
Create a svn_io_dirent2_t instance for path.
svn_error_t * svn_io_create_unique_link(const char **unique_name_p, const char *path, const char *dest, const char *suffix, apr_pool_t *pool)
Like svn_io_open_unique_file(), except that instead of creating a file, a symlink is generated that r...
svn_error_t * svn_stream_for_stdout(svn_stream_t **out, apr_pool_t *pool)
Set *out to a generic stream connected to stdout, allocated in pool.
svn_error_t *(* svn_stream_skip_fn_t)(void *baton, apr_size_t len)
Skip data handler function for a generic stream.
Definition: svn_io.h:756
A buffered string, capable of appending without an allocation and copy for each append.
Definition: svn_string.h:104
svn_error_t *(* svn_read_fn_t)(void *baton, char *buffer, apr_size_t *len)
Read handler function for a generic stream.
Definition: svn_io.h:748
svn_error_t * svn_io_file_create(const char *file, const char *contents, apr_pool_t *pool)
Create file at utf8-encoded file with contents contents.
svn_error_t * svn_io_remove_dir(const char *path, apr_pool_t *pool)
Similar to svn_io_remove_dir2(), but with ignore_enoent set to FALSE and cancel_func and cancel_baton...
svn_error_t * svn_string_from_stream(svn_string_t **result, svn_stream_t *stream, apr_pool_t *result_pool, apr_pool_t *scratch_pool)
Read the contents of stream into memory, returning the data in result.
svn_error_t * svn_io_run_cmd(const char *path, const char *cmd, const char *const *args, int *exitcode, apr_exit_why_e *exitwhy, svn_boolean_t inherit, apr_file_t *infile, apr_file_t *outfile, apr_file_t *errfile, apr_pool_t *pool)
Run a command to completion, by first calling svn_io_start_cmd() and then calling svn_io_wait_for_cmd...