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 | |||
@@ -1,90 +1,89 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | =. Copyright (C) 2004-2005 Michael 'Mickey' Lauer <mickey@Vanille.de> | 3 | =. Copyright (C) 2004-2005 Michael 'Mickey' Lauer <mickey@Vanille.de> |
4 | .=l. Copyright (C) The Opie Team <opie-devel@handhelds.org> | 4 | .=l. Copyright (C) The Opie Team <opie-devel@handhelds.org> |
5 | .>+-= | 5 | .>+-= |
6 | _;:, .> :=|. This program is free software; you can | 6 | _;:, .> :=|. This program is free software; you can |
7 | .> <`_, > . <= redistribute it and/or modify it under | 7 | .> <`_, > . <= redistribute it and/or modify it under |
8 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 8 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
9 | .="- .-=="i, .._ License as published by the Free Software | 9 | .="- .-=="i, .._ License as published by the Free Software |
10 | - . .-<_> .<> Foundation; version 2 of the License. | 10 | - . .-<_> .<> Foundation; version 2 of the License. |
11 | ._= =} : | 11 | ._= =} : |
12 | .%`+i> _;_. | 12 | .%`+i> _;_. |
13 | .i_,=:_. -<s. This program is distributed in the hope that | 13 | .i_,=:_. -<s. This program is distributed in the hope that |
14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 14 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
15 | : .. .:, . . . without even the implied warranty of | 15 | : .. .:, . . . without even the implied warranty of |
16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 16 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 17 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
18 | ..}^=.= = ; Library General Public License for more | 18 | ..}^=.= = ; Library General Public License for more |
19 | ++= -. .` .: details. | 19 | ++= -. .` .: details. |
20 | : = ...= . :.=- | 20 | : = ...= . :.=- |
21 | -. .:....=;==+<; You should have received a copy of the GNU | 21 | -. .:....=;==+<; You should have received a copy of the GNU |
22 | -_. . . )=. = Library General Public License along with | 22 | -_. . . )=. = Library General Public License along with |
23 | -- :-=` this library; see the file COPYING.LIB. | 23 | -- :-=` this library; see the file COPYING.LIB. |
24 | If not, write to the Free Software Foundation, | 24 | If not, write to the Free Software Foundation, |
25 | Inc., 59 Temple Place - Suite 330, | 25 | Inc., 59 Temple Place - Suite 330, |
26 | Boston, MA 02111-1307, USA. | 26 | Boston, MA 02111-1307, USA. |
27 | */ | 27 | */ |
28 | 28 | ||
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 | *======================================================================================*/ |
49 | 48 | ||
50 | /** | 49 | /** |
51 | * @brief An enumerate for the different types of file notifications | 50 | * @brief An enumerate for the different types of file notifications |
52 | * | 51 | * |
53 | * This enumerate provides a means to specify the type of events that you are interest in. | 52 | * This enumerate provides a means to specify the type of events that you are interest in. |
54 | * Valid values are: | 53 | * Valid values are: |
55 | * <ul> | 54 | * <ul> |
56 | * <li>Access: The file was accessed (read) | 55 | * <li>Access: The file was accessed (read) |
57 | * <li>Modify The file was modified (write,truncate) | 56 | * <li>Modify The file was modified (write,truncate) |
58 | * <li>Attrib = The file had its attributes changed (chmod,chown,chgrp) | 57 | * <li>Attrib = The file had its attributes changed (chmod,chown,chgrp) |
59 | * <li>CloseWrite = Writable file was closed | 58 | * <li>CloseWrite = Writable file was closed |
60 | * <li>CloseNoWrite = Unwritable file was closed | 59 | * <li>CloseNoWrite = Unwritable file was closed |
61 | * <li>Open = File was opened | 60 | * <li>Open = File was opened |
62 | * <li>MovedFrom = File was moved from X | 61 | * <li>MovedFrom = File was moved from X |
63 | * <li>MovedTo = File was moved to Y | 62 | * <li>MovedTo = File was moved to Y |
64 | * <li>DeleteSubdir = Subdir was deleted | 63 | * <li>DeleteSubdir = Subdir was deleted |
65 | * <li>DeleteFile = Subfile was deleted | 64 | * <li>DeleteFile = Subfile was deleted |
66 | * <li>CreateSubdir = Subdir was created | 65 | * <li>CreateSubdir = Subdir was created |
67 | * <li>CreateFile = Subfile was created | 66 | * <li>CreateFile = Subfile was created |
68 | * <li>DeleteSelf = Self was deleted | 67 | * <li>DeleteSelf = Self was deleted |
69 | * <li>Unmount = The backing filesystem was unmounted | 68 | * <li>Unmount = The backing filesystem was unmounted |
70 | * </ul> | 69 | * </ul> |
71 | * | 70 | * |
72 | **/ | 71 | **/ |
73 | 72 | ||
74 | enum OFileNotificationType | 73 | enum OFileNotificationType |
75 | { | 74 | { |
76 | Access = IN_ACCESS, | 75 | Access = IN_ACCESS, |
77 | Modify = IN_MODIFY, | 76 | Modify = IN_MODIFY, |
78 | Attrib = IN_ATTRIB, | 77 | Attrib = IN_ATTRIB, |
79 | CloseWrite = IN_CLOSE_WRITE, | 78 | CloseWrite = IN_CLOSE_WRITE, |
80 | CloseNoWrite = IN_CLOSE_NOWRITE, | 79 | CloseNoWrite = IN_CLOSE_NOWRITE, |
81 | Open = IN_OPEN, | 80 | Open = IN_OPEN, |
82 | MovedFrom = IN_MOVED_FROM, | 81 | MovedFrom = IN_MOVED_FROM, |
83 | MovedTo = IN_MOVED_TO, | 82 | MovedTo = IN_MOVED_TO, |
84 | DeleteSubdir = IN_DELETE_SUBDIR, | 83 | DeleteSubdir = IN_DELETE_SUBDIR, |
85 | DeleteFile = IN_DELETE_FILE, | 84 | DeleteFile = IN_DELETE_FILE, |
86 | CreateSubdir = IN_CREATE_SUBDIR, | 85 | CreateSubdir = IN_CREATE_SUBDIR, |
87 | CreateFile = IN_CREATE_FILE, | 86 | CreateFile = IN_CREATE_FILE, |
88 | DeleteSelf = IN_DELETE_SELF, | 87 | DeleteSelf = IN_DELETE_SELF, |
89 | Unmount = IN_UNMOUNT, | 88 | Unmount = IN_UNMOUNT, |
90 | _QueueOverflow = IN_Q_OVERFLOW, /* Internal, don't use this in client code */ | 89 | _QueueOverflow = IN_Q_OVERFLOW, /* Internal, don't use this in client code */ |