doc
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
src
csync_update.h
Go to the documentation of this file.
1
/*
2
* libcsync -- a library to sync a directory with another
3
*
4
* Copyright (c) 2008 by Andreas Schneider <mail@cynapses.org>
5
*
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
10
*
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software Foundation,
18
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19
*/
20
21
#ifndef _CSYNC_UPDATE_H
22
#define _CSYNC_UPDATE_H
23
24
#include "
csync.h
"
25
#include "
vio/csync_vio_file_stat.h
"
26
27
/**
28
* @file csync_update.h
29
*
30
* @brief Update Detection
31
*
32
* TODO
33
*
34
* @defgroup csyncUpdateDetectionInternals csync update detection internals
35
* @ingroup csyncInternalAPI
36
*
37
* @{
38
*/
39
40
/**
41
* Types for files
42
*/
43
enum
csync_ftw_flags_e
{
44
CSYNC_FTW_FLAG_FILE
,
/* Regular file. */
45
CSYNC_FTW_FLAG_DIR
,
/* Directory. */
46
CSYNC_FTW_FLAG_DNR
,
/* Unreadable directory. */
47
CSYNC_FTW_FLAG_NSTAT
,
/* Unstatable file. */
48
CSYNC_FTW_FLAG_SLINK
,
/* Symbolic link. */
49
CSYNC_FTW_FLAG_SPEC
,
/* Special file (fifo, ...). */
50
/* These flags are only passed from the `nftw' function. */
51
CSYNC_FTW_FLAG_DP
,
/* Directory, all subdirs have been visited. */
52
CSYNC_FTW_FLAG_SLN
/* Symbolic link naming non-existing file. */
53
};
54
55
typedef
int (*
csync_walker_fn
) (
CSYNC
*ctx,
const
char
*file,
56
const
csync_vio_file_stat_t
*fs,
enum
csync_ftw_flags_e
flag);
57
58
/**
59
* @brief The walker function to use in the file tree walker.
60
*
61
* @param ctx The used csync context.
62
*
63
* @param file The file we are researching.
64
*
65
* @param fs The stat information we got.
66
*
67
* @param flag The flag describing the type of the file.
68
*
69
* @return 0 on success, < 0 on error.
70
*/
71
int
csync_walker
(
CSYNC
*ctx,
const
char
*file,
const
csync_vio_file_stat_t
*fs,
72
enum
csync_ftw_flags_e
flag);
73
74
/**
75
* @brief The file tree walker.
76
*
77
* This function walks through the directory tree that is located under the uri
78
* specified. It calls a walker function which is provided as a function pointer
79
* once for each entry in the tree. By default, directories are handled before
80
* the files and subdirectories they contain (pre-order traversal).
81
*
82
* @param ctx The csync context to use.
83
*
84
* @param uri The uri/path to the directory tree to walk.
85
*
86
* @param fn The walker function to call once for each entry.
87
*
88
* @param depth The max depth to walk down the tree.
89
*
90
* @return 0 on success, < 0 on error. If fn() returns non-zero, then the tree
91
* walk is terminated and the value returned by fn() is returned as the
92
* result.
93
*/
94
int
csync_ftw
(
CSYNC
*ctx,
const
char
*uri,
csync_walker_fn
fn,
95
unsigned
int
depth);
96
97
#endif
/* _CSYNC_UPDATE_H */
98
99
/* vim: set ft=c.doxygen ts=8 sw=2 et cindent: */
Generated by
1.8.1