• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2    Copyright (C) 2005 John McCutchan
3 
4    This library is free software; you can redistribute it and/or
5    modify it under the terms of the GNU Lesser General Public
6    License as published by the Free Software Foundation; either
7    version 2.1 of the License, or (at your option) any later version.
8 
9    This library is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12    Lesser General Public License for more details.
13 
14    You should have received a copy of the GNU Lesser General Public License
15    along with this library; if not, see <http://www.gnu.org/licenses/>.
16 
17    Authors:.
18 		John McCutchan <john@johnmccutchan.com>
19 */
20 
21 #ifndef __INOTIFY_KERNEL_H
22 #define __INOTIFY_KERNEL_H
23 
24 typedef struct ik_event_s {
25   gint32 wd;
26   guint32 mask;
27   guint32 original_mask;
28   guint32 cookie;
29   guint32 len;
30   char *  name;
31   /* TRUE if this event is the last element of a pair
32    * (e.g., MOVE_TO in a pair of MOVE_FROM, MOVE_TO events) */
33   gboolean is_second_in_pair;
34   /* if event1 and event2 are two paired events
35    * (e.g., MOVE_FROM and MOVE_TO events related to the same file move),
36    * then event1->pair == event2 and event2->pair == NULL.
37    * It will result also in event1->pair->is_second_in_pair == TRUE */
38   struct ik_event_s *pair;
39   gint64 timestamp; /* monotonic time that this was created */
40 } ik_event_t;
41 
42 gboolean _ik_startup (gboolean (*cb) (ik_event_t *event));
43 
44 ik_event_t *_ik_event_new_dummy (const char *name,
45 				 gint32      wd,
46 				 guint32     mask);
47 void        _ik_event_free      (ik_event_t *event);
48 
49 gint32      _ik_watch           (const char *path,
50 				 guint32     mask,
51 				 int        *err);
52 int         _ik_ignore          (const char *path,
53 				 gint32      wd);
54 
55 
56 /* The miss count will probably be enflated */
57 void        _ik_move_stats     (guint32 *matches,
58 				guint32 *misses);
59 const char *_ik_mask_to_string (guint32  mask);
60 
61 
62 #endif
63