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