author | mickeyl <mickeyl> | 2005-05-02 18:00:45 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2005-05-02 18:00:45 (UTC) |
commit | fc1d18b34bacf2429cdf8738bd68af6bb99d0a2e (patch) (unidiff) | |
tree | 8cd7c369f13bed33bf1e82365db85260a31b00fc | |
parent | 3b2f09e11af04bc295a5bbc6e0b312873bb0d32f (diff) | |
download | opie-fc1d18b34bacf2429cdf8738bd68af6bb99d0a2e.zip opie-fc1d18b34bacf2429cdf8738bd68af6bb99d0a2e.tar.gz opie-fc1d18b34bacf2429cdf8738bd68af6bb99d0a2e.tar.bz2 |
ship sanitized userland header equivalent of linux/inotify.h
-rw-r--r-- | libopie2/opiecore/linux_inotify.h | 114 | ||||
-rw-r--r-- | libopie2/opiecore/ofilenotify.h | 5 |
2 files changed, 116 insertions, 3 deletions
diff --git a/libopie2/opiecore/linux_inotify.h b/libopie2/opiecore/linux_inotify.h new file mode 100644 index 0000000..7e19bb4 --- a/dev/null +++ b/libopie2/opiecore/linux_inotify.h | |||
@@ -0,0 +1,114 @@ | |||
1 | /* | ||
2 | * Inode based directory notification for Linux | ||
3 | * | ||
4 | * Copyright (C) 2005 John McCutchan | ||
5 | */ | ||
6 | |||
7 | #ifndef _LINUX_INOTIFY_H | ||
8 | #define _LINUX_INOTIFY_H | ||
9 | |||
10 | #include <sys/types.h> | ||
11 | #include <linux/limits.h> | ||
12 | #include <linux/types.h> | ||
13 | |||
14 | /* | ||
15 | * struct inotify_event - structure read from the inotify device for each event | ||
16 | * | ||
17 | * When you are watching a directory, you will receive the filename for events | ||
18 | * such as IN_CREATE, IN_DELETE, IN_OPEN, IN_CLOSE, ..., relative to the wd. | ||
19 | */ | ||
20 | struct inotify_event { | ||
21 | __s32 wd; /* watch descriptor */ | ||
22 | __u32 mask; /* watch mask */ | ||
23 | __u32 cookie; /* cookie to synchronize two events */ | ||
24 | __u32 len; /* length (including nulls) of name */ | ||
25 | char name[0];/* stub for possible name */ | ||
26 | }; | ||
27 | |||
28 | /* | ||
29 | * struct inotify_watch_request - represents a watch request | ||
30 | * | ||
31 | * Pass to the inotify device via the INOTIFY_WATCH ioctl | ||
32 | */ | ||
33 | struct inotify_watch_request { | ||
34 | char *name; /* filename name */ | ||
35 | __u32 mask; /* event mask */ | ||
36 | }; | ||
37 | |||
38 | /* the following are legal, implemented events */ | ||
39 | #define IN_ACCESS 0x00000001/* File was accessed */ | ||
40 | #define IN_MODIFY 0x00000002/* File was modified */ | ||
41 | #define IN_ATTRIB 0x00000004/* File changed attributes */ | ||
42 | #define IN_CLOSE_WRITE 0x00000008/* Writtable file was closed */ | ||
43 | #define IN_CLOSE_NOWRITE 0x00000010/* Unwrittable file closed */ | ||
44 | #define IN_OPEN 0x00000020/* File was opened */ | ||
45 | #define IN_MOVED_FROM 0x00000040/* File was moved from X */ | ||
46 | #define IN_MOVED_TO 0x00000080/* File was moved to Y */ | ||
47 | #define IN_DELETE_SUBDIR 0x00000100/* Subdir was deleted */ | ||
48 | #define IN_DELETE_FILE 0x00000200/* Subfile was deleted */ | ||
49 | #define IN_CREATE_SUBDIR 0x00000400/* Subdir was created */ | ||
50 | #define IN_CREATE_FILE 0x00000800/* Subfile was created */ | ||
51 | #define IN_DELETE_SELF 0x00001000/* Self was deleted */ | ||
52 | #define IN_UNMOUNT 0x00002000/* Backing fs was unmounted */ | ||
53 | #define IN_Q_OVERFLOW 0x00004000/* Event queued overflowed */ | ||
54 | #define IN_IGNORED 0x00008000/* File was ignored */ | ||
55 | |||
56 | /* special flags */ | ||
57 | #define IN_ALL_EVENTS 0xffffffff/* All the events */ | ||
58 | #define IN_CLOSE (IN_CLOSE_WRITE | IN_CLOSE_NOWRITE) | ||
59 | |||
60 | #define INOTIFY_IOCTL_MAGIC'Q' | ||
61 | #define INOTIFY_IOCTL_MAXNR2 | ||
62 | |||
63 | #define INOTIFY_WATCH _IOR(INOTIFY_IOCTL_MAGIC, 1, struct inotify_watch_request) | ||
64 | #define INOTIFY_IGNORE _IOR(INOTIFY_IOCTL_MAGIC, 2, int) | ||
65 | |||
66 | #ifdef __KERNEL__ | ||
67 | |||
68 | #include <linux/dcache.h> | ||
69 | #include <linux/fs.h> | ||
70 | #include <linux/config.h> | ||
71 | #include <asm/atomic.h> | ||
72 | |||
73 | #ifdef CONFIG_INOTIFY | ||
74 | |||
75 | extern void inotify_inode_queue_event(struct inode *, __u32, __u32, | ||
76 | const char *); | ||
77 | extern void inotify_dentry_parent_queue_event(struct dentry *, __u32, __u32, | ||
78 | const char *); | ||
79 | extern void inotify_super_block_umount(struct super_block *); | ||
80 | extern void inotify_inode_is_dead(struct inode *); | ||
81 | extern u32 inotify_get_cookie(void); | ||
82 | |||
83 | #else | ||
84 | |||
85 | static inline void inotify_inode_queue_event(struct inode *inode, | ||
86 | __u32 mask, __u32 cookie, | ||
87 | const char *filename) | ||
88 | { | ||
89 | } | ||
90 | |||
91 | static inline void inotify_dentry_parent_queue_event(struct dentry *dentry, | ||
92 | __u32 mask, __u32 cookie, | ||
93 | const char *filename) | ||
94 | { | ||
95 | } | ||
96 | |||
97 | static inline void inotify_super_block_umount(struct super_block *sb) | ||
98 | { | ||
99 | } | ||
100 | |||
101 | static inline void inotify_inode_is_dead(struct inode *inode) | ||
102 | { | ||
103 | } | ||
104 | |||
105 | static inline u32 inotify_get_cookie(void) | ||
106 | { | ||
107 | return 0; | ||
108 | } | ||
109 | |||
110 | #endif/* CONFIG_INOTIFY */ | ||
111 | |||
112 | #endif/* __KERNEL __ */ | ||
113 | |||
114 | #endif/* _LINUX_INOTIFY_H */ | ||
diff --git a/libopie2/opiecore/ofilenotify.h b/libopie2/opiecore/ofilenotify.h index e3621cf..ea525e9 100644 --- a/libopie2/opiecore/ofilenotify.h +++ b/libopie2/opiecore/ofilenotify.h | |||
@@ -29,20 +29,19 @@ _;:, .> :=|. This program is free software; you can | |||
29 | #ifndef OFILENOTIFY_H | 29 | #ifndef OFILENOTIFY_H |
30 | #define OFILENOTIFY_H | 30 | #define OFILENOTIFY_H |
31 | #if defined (__GNUC__) && (__GNUC__ < 3) | 31 | #if defined (__GNUC__) && (__GNUC__ < 3) |
32 | #define _GNU_SOURCE | 32 | #define _GNU_SOURCE |
33 | #endif | 33 | #endif |
34 | 34 | ||
35 | #include "linux_inotify.h" | ||
36 | |||
35 | /* QT */ | 37 | /* QT */ |
36 | #include <qsocketnotifier.h> | 38 | #include <qsocketnotifier.h> |
37 | #include <qsignal.h> | 39 | #include <qsignal.h> |
38 | #include <qstring.h> | 40 | #include <qstring.h> |
39 | 41 | ||
40 | /* STD */ | ||
41 | #include "inotify.h" | ||
42 | |||
43 | namespace Opie { | 42 | namespace Opie { |
44 | namespace Core { | 43 | namespace Core { |
45 | 44 | ||
46 | /*====================================================================================== | 45 | /*====================================================================================== |
47 | * OFileNotificationType | 46 | * OFileNotificationType |
48 | *======================================================================================*/ | 47 | *======================================================================================*/ |