clsync
Toggle main menu visibility
Loading...
Searching...
No Matches
sync.h
Go to the documentation of this file.
1
/*
2
clsync - file tree sync utility based on fanotify and inotify
3
4
Copyright (C) 2013 Dmitry Yu Okunev <dyokunev@ut.mephi.ru> 0x8E30679C
5
6
This program is free software: you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation, either version 3 of the License, or
9
(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, see <http://www.gnu.org/licenses/>.
18
*/
19
20
#include <glib.h>
// GHashTable
21
22
23
struct
thread_callbackfunct_arg
{
24
char
*
excfpath
;
25
char
*
incfpath
;
26
};
27
typedef
struct
thread_callbackfunct_arg
thread_callbackfunct_arg_t
;
28
29
typedef
int ( *
thread_callbackfunct_t
) (
ctx_t
*
ctx_p
,
thread_callbackfunct_arg_t
*arg_p );
30
struct
threadinfo
{
31
int
thread_num
;
32
uint32_t
iteration
;
33
thread_callbackfunct_t
callback
;
34
thread_callbackfunct_arg_t
*
callback_arg
;
35
char
**
argv
;
36
pthread_t
pthread
;
37
int
exitcode
;
38
int
errcode
;
39
state_t
state
;
40
ctx_t
*
ctx_p
;
41
time_t
starttime
;
42
time_t
expiretime
;
43
int
child_pid
;
44
45
GHashTable *
fpath2ei_ht
;
// file path -> event information
46
47
int
try_n
;
48
49
// for so-synchandler
50
int
n
;
51
api_eventinfo_t
*
ei
;
52
};
53
typedef
struct
threadinfo
threadinfo_t
;
54
55
struct
threadsinfo
{
56
pthread_mutex_t
mutex
[
PTHREAD_MUTEX_MAX
];
57
pthread_cond_t
cond
[
PTHREAD_MUTEX_MAX
];
58
char
mutex_init
;
59
int
allocated
;
60
int
used
;
61
threadinfo_t
*
threads
;
62
threadinfo_t
**
threadsstack
;
// stack of threadinfo_t to be used on thread_new()
63
int
stacklen
;
64
};
65
typedef
struct
threadsinfo
threadsinfo_t
;
66
67
68
extern
int
sync_run
(
struct
ctx
*
ctx
);
69
extern
int
sync_dump
(
struct
ctx
*
ctx
,
const
char
*
const
dest_dir );
70
extern
int
sync_term
(
int
exitcode
);
71
extern
int
threads_foreach
(
int
( *funct ) (
threadinfo_t
*,
void
* ),
state_t
state,
void
*arg );
72
extern
threadsinfo_t
*
thread_info
();
73
extern
time_t
thread_nextexpiretime
();
74
extern
int
sync_prequeue_loadmark
75
(
76
int
fsmon_d,
77
78
struct
ctx
*
ctx_p
,
79
struct
indexes
*indexes_p,
80
81
const
char
*path_full,
82
const
char
*path_rel,
83
84
stat64_t
*lst_p,
85
86
eventobjtype_t
objtype_old,
87
eventobjtype_t
objtype_new,
88
89
uint32_t event_mask,
90
int
event_wd,
91
mode_t st_mode,
92
off_t st_size,
93
94
char
**path_buf_p,
95
size_t
*path_buf_len_p,
96
97
struct
eventinfo
*evinfo
98
);
99
extern
int
sync_prequeue_unload
(
struct
ctx
*
ctx_p
,
struct
indexes
*indexes_p );
100
extern
const
char
*
sync_parameter_get
(
const
char
*variable_name,
void
*_dosync_arg_p );
101
extern
pthread_t
pthread_sighandler
;
102
api_eventinfo_t
struct api_eventinfo api_eventinfo_t
Definition
clsync.h:47
eventobjtype_t
enum eventobjtype eventobjtype_t
Definition
clsync.h:37
PTHREAD_MUTEX_MAX
@ PTHREAD_MUTEX_MAX
Definition
common.h:156
state_t
enum state_enum state_t
Definition
ctx.h:272
ctx_t
struct ctx ctx_t
Definition
ctx.h:421
ctx_p
ctx_t * ctx_p
Definition
mon_kqueue.c:85
stat64_t
struct stat64 stat64_t
Definition
port-hacks.h:65
ctx
Definition
ctx.h:315
eventinfo
Definition
common.h:140
indexes
Definition
indexes.h:34
thread_callbackfunct_arg
Definition
sync.h:23
thread_callbackfunct_arg::excfpath
char * excfpath
Definition
sync.h:24
thread_callbackfunct_arg::incfpath
char * incfpath
Definition
sync.h:25
threadinfo
Definition
sync.h:30
threadinfo::state
state_t state
Definition
sync.h:39
threadinfo::try_n
int try_n
Definition
sync.h:47
threadinfo::fpath2ei_ht
GHashTable * fpath2ei_ht
Definition
sync.h:45
threadinfo::iteration
uint32_t iteration
Definition
sync.h:32
threadinfo::exitcode
int exitcode
Definition
sync.h:37
threadinfo::ei
api_eventinfo_t * ei
Definition
sync.h:51
threadinfo::child_pid
int child_pid
Definition
sync.h:43
threadinfo::n
int n
Definition
sync.h:50
threadinfo::pthread
pthread_t pthread
Definition
sync.h:36
threadinfo::thread_num
int thread_num
Definition
sync.h:31
threadinfo::starttime
time_t starttime
Definition
sync.h:41
threadinfo::argv
char ** argv
Definition
sync.h:35
threadinfo::expiretime
time_t expiretime
Definition
sync.h:42
threadinfo::callback_arg
thread_callbackfunct_arg_t * callback_arg
Definition
sync.h:34
threadinfo::ctx_p
ctx_t * ctx_p
Definition
sync.h:40
threadinfo::callback
thread_callbackfunct_t callback
Definition
sync.h:33
threadinfo::errcode
int errcode
Definition
sync.h:38
threadsinfo
Definition
sync.h:55
threadsinfo::threadsstack
threadinfo_t ** threadsstack
Definition
sync.h:62
threadsinfo::allocated
int allocated
Definition
sync.h:59
threadsinfo::threads
threadinfo_t * threads
Definition
sync.h:61
threadsinfo::mutex
pthread_mutex_t mutex[PTHREAD_MUTEX_MAX]
Definition
sync.h:56
threadsinfo::used
int used
Definition
sync.h:60
threadsinfo::stacklen
int stacklen
Definition
sync.h:63
threadsinfo::mutex_init
char mutex_init
Definition
sync.h:58
threadsinfo::cond
pthread_cond_t cond[PTHREAD_MUTEX_MAX]
Definition
sync.h:57
pthread_sighandler
pthread_t pthread_sighandler
Definition
sync.c:59
exitcode
volatile int exitcode
Definition
sync.c:547
sync_term
int sync_term(int exitcode)
Definition
sync.c:3991
thread_callbackfunct_t
int(* thread_callbackfunct_t)(ctx_t *ctx_p, thread_callbackfunct_arg_t *arg_p)
Definition
sync.h:29
threadsinfo_t
struct threadsinfo threadsinfo_t
Definition
sync.h:65
threads_foreach
int threads_foreach(int(*funct)(threadinfo_t *, void *), state_t state, void *arg)
thread_callbackfunct_arg_t
struct thread_callbackfunct_arg thread_callbackfunct_arg_t
Definition
sync.h:27
sync_parameter_get
const char * sync_parameter_get(const char *variable_name, void *_dosync_arg_p)
Definition
sync.c:1548
sync_prequeue_unload
int sync_prequeue_unload(struct ctx *ctx_p, struct indexes *indexes_p)
Definition
sync.c:2564
sync_dump
int sync_dump(struct ctx *ctx, const char *const dest_dir)
Definition
sync.c:3773
thread_info
threadsinfo_t * thread_info()
Definition
sync.c:190
sync_prequeue_loadmark
int sync_prequeue_loadmark(int fsmon_d, struct ctx *ctx_p, struct indexes *indexes_p, const char *path_full, const char *path_rel, stat64_t *lst_p, eventobjtype_t objtype_old, eventobjtype_t objtype_new, uint32_t event_mask, int event_wd, mode_t st_mode, off_t st_size, char **path_buf_p, size_t *path_buf_len_p, struct eventinfo *evinfo)
Definition
sync.c:2143
threadinfo_t
struct threadinfo threadinfo_t
Definition
sync.h:53
sync_run
int sync_run(struct ctx *ctx)
Definition
sync.c:3998
thread_nextexpiretime
time_t thread_nextexpiretime()
Generated on
for clsync by
1.17.0