revert code that did not affect memory
[gitlive] / fanotify / fanotify.vapi
1 /*
2  *
3  * Whats needed?
4  *
5  *
6  * fan_open() // returns file handle..
7  * fan_mark(... foler)
8  * fan_close(fh)
9  *
10  * // and a callback..
11  
12  * ?/ jsu tdo it as a vapi?
13  * 
14   * vapi example
15  * https://github.com/apmasell/vapis/blob/master/transmission-2.0.vapi
16  * https://wiki.gnome.org/Projects/Vala/ManualBindings
17  */
18
19 [CCode (cheader_filename = "sys/fanotify.h", lower_case_cprefix = "fanotify_", cprefix = "FAN_")]
20 namespace Fanotify {
21
22  
23     [CCode (cname = "int", cprefix = "FAN_", has_type_id = false)]
24     [Flags]
25     public enum  EventType {
26                 ACCESS,
27                 MODIFY,
28                 ATTRIB,
29                 CLOSE_WRITE,
30                 CLOSE_NOWRITE,
31                 OPEN,
32                 MOVED_FROM,
33                 MOVED_TO,
34                 CREATE,
35                 DELETE,
36                 DELETE_SELF,
37                 MOVE_SELF,
38                 OPEN_EXEC,
39                 Q_OVERFLOW,
40                 FS_ERROR,
41                 OPEN_PERM,
42                 ACCESS_PERM,
43                 OPEN_EXEC_PERM,
44                 EVENT_ON_CHILD,
45                 RENAME,
46                 ONDIR,
47                 CLOSE,
48                 MOVE
49
50
51     }
52     [CCode (cname = "int", cprefix = "FAN_", has_type_id = false)]
53     [Flags]
54     public enum  InitFlag {
55         CLOEXEC,
56         NONBLOCK,
57         CLASS_NOTIF,
58         CLASS_CONTENT,
59         CLASS_PRE_CONTENT,
60                 REPORT_FID,
61         REPORT_DIR_FID,
62         REPORT_NAME,
63         REPORT_TARGET_FID
64     }
65         
66     [CCode (cname = "int", cprefix = "FAN_MARK_", has_type_id = false)]
67     [Flags]
68     public enum  Mark {
69            ADD,
70            REMOVE,
71            DONT_FOLLOW,
72            ONLYDIR,
73            IGNORED_MASK,
74            IGNORED_SURV_MODIFY,
75            FLUSH,
76            EVICTABLE,
77            IGNORE,
78            
79            INODE,
80            MOUNT,
81            FILESYSTEM
82    }
83  
84      
85         [CCode (cname = "struct fanotify_event_metadata", has_destroy_function = false, has_copy_function = false, has_type_id = false)]
86         public struct EventMetadata   {
87                 [CCode (cname = "event_len")]
88         public uint32 event_len;
89         
90         [CCode (cname = "vers")]
91         public uint8 vers;    
92
93         [CCode (cname = "reserved")]
94         public uint8 reserved;
95             
96         [CCode (cname = "metadata_len")]
97         public uint16 metadata_len;
98         
99         [CCode (cname = "mask")]
100         public uint64 mask;    
101         
102         [CCode (cname = "fd")]
103         public uint32 fd;
104         
105         [CCode (cname = "pid")]
106         public uint32 pid;    
107         
108     }
109         [CCode (cname = "struct kernel_fsid_t", has_destroy_function = false, has_copy_function = false, has_type_id = false)]
110         public struct KernelFsid   {
111             [CCode (cname = "val")]
112         public int val[2];
113     }
114     
115     [CCode (cname = "struct fanotify_event_info_header", has_destroy_function = false, has_copy_function = false, has_type_id = false)]
116     public struct EventInfoHeader {
117         [CCode (cname = "info_type")]
118         public uint8 info_type;
119         
120        [CCode (cname = "pad")]
121         public uint8 pad;
122         
123        [CCode (cname = "len")]
124         public uint16  len;
125     }
126
127     [CCode (cname = "struct fanotify_event_info_fid", has_destroy_function = false, has_copy_function = false, has_type_id = false)]
128     public struct EventInfoFid  {
129         [CCode (cname = "hdr")]
130         public EventInfoHeader hdr;
131         [CCode (cname = "fsid")]
132         public  KernelFsid fsid;
133     
134         [CCode (cname = "handle")]
135         public uchar[] handle;
136     }
137
138           
139   
140         [CCode (cname = "fanotify_init")]
141         public int init (uint __flags, uint __event_f_flags);
142     
143     [CCode (cname = "fanotify_mark")]
144     public int  mark (int __fanotify_fd, uint __flags, uint64 __mask, int __dfd, string __pathname);        
145
146 }