20#ifndef __CLSYNC_INDEXES_H
21#define __CLSYNC_INDEXES_H
45 GHashTable *nodenames_ht;
53static inline int indexes_remove_bywd (
indexes_t *indexes_p,
int wd )
56 char *fpath = g_hash_table_lookup ( indexes_p->
wd2fpath_ht, GINT_TO_POINTER ( wd ) );
57 ret |= g_hash_table_remove ( indexes_p->
wd2fpath_ht, GINT_TO_POINTER ( wd ) );
59 if ( fpath == NULL ) {
60 error (
"Cannot remove from index \"fpath2wd\" by wd %i.", wd );
64 ret |= g_hash_table_remove ( indexes_p->
fpath2wd_ht, fpath );
71static inline char *indexes_wd2fpath (
indexes_t *indexes_p,
int wd )
73 return g_hash_table_lookup ( indexes_p->
wd2fpath_ht, GINT_TO_POINTER ( wd ) );
79static inline int indexes_fpath2wd (
indexes_t *indexes_p,
const char *fpath )
81 gpointer gint_p = g_hash_table_lookup ( indexes_p->
fpath2wd_ht, fpath );
86 return GPOINTER_TO_INT ( gint_p );
92static inline int indexes_add_wd (
indexes_t *indexes_p,
int wd,
const char *fpath_const,
size_t fpathlen )
94 debug ( 4,
"indexes_add_wd(indexes_p, %i, \"%s\", %i)", wd, fpath_const, fpathlen );
95 char *fpath = xmalloc ( fpathlen + 1 );
96 memcpy ( fpath, fpath_const, fpathlen + 1 );
97 g_hash_table_insert ( indexes_p->
wd2fpath_ht, GINT_TO_POINTER ( wd ), fpath );
98 g_hash_table_insert ( indexes_p->
fpath2wd_ht, fpath, GINT_TO_POINTER ( wd ) );
107static inline int indexes_fpath2ei_add (
indexes_t *indexes_p,
char *fpath,
eventinfo_t *evinfo )
109 debug ( 5,
"\"%s\"", fpath );
110 g_hash_table_replace ( indexes_p->
fpath2ei_ht, fpath, evinfo );
148 debug ( 3,
"indexes_addexclude_aggr(indexes_p, \"%s\", %u).", fpath, flags );
149 gpointer flags_gp = g_hash_table_lookup ( indexes_p->
exc_fpath_ht, fpath );
151 if ( flags_gp != NULL )
152 flags |= GPOINTER_TO_INT ( flags_gp );
156 flags &= ~EVIF_CONTENTRECURSIVELY;
158 g_hash_table_replace ( indexes_p->
exc_fpath_ht, fpath, GINT_TO_POINTER ( flags ) );
159 debug ( 3,
"indexes_addexclude_aggr(indexes_p, \"%s\", flags): %u.", fpath, flags );
165 gpointer flags_gp = g_hash_table_lookup ( indexes_p->
out_lines_aggr_ht, outline );
167 if ( flags_gp != NULL )
168 flags |= GPOINTER_TO_INT ( flags_gp );
172 flags &= ~EVIF_CONTENTRECURSIVELY;
174 g_hash_table_replace ( indexes_p->
out_lines_aggr_ht, outline, GINT_TO_POINTER ( flags ) );
175 debug ( 3,
"indexes_outaggr_aggr(indexes_p, \"%s\").", outline );
184static inline int indexes_fileinfo_add (
indexes_t *indexes_p,
const char *fpath_const,
fileinfo_t *fi )
186 size_t fpathlen = strlen ( fpath_const );
187 debug ( 4,
"indexes_add_wd(indexes_p, \"%s\", %p)", fpath_const, fpathlen );
188 char *fpath = xmalloc ( fpathlen + 1 );
189 memcpy ( fpath, fpath_const, fpathlen + 1 );
190 g_hash_table_insert ( indexes_p->
fileinfo_ht, fpath, fi );
@ EVIF_CONTENTRECURSIVELY
enum eventinfo_flags eventinfo_flags_t
#define debug(debug_level,...)
GHashTable * fpath2ei_coll_ht[QUEUE_MAX]
GHashTable * exc_fpath_ht
GHashTable * out_lines_aggr_ht
GHashTable * nonthreaded_syncing_fpath2ei_ht
GHashTable * exc_fpath_coll_ht[QUEUE_MAX]