summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2005-05-02 18:00:45 (UTC)
committer mickeyl <mickeyl>2005-05-02 18:00:45 (UTC)
commitfc1d18b34bacf2429cdf8738bd68af6bb99d0a2e (patch) (unidiff)
tree8cd7c369f13bed33bf1e82365db85260a31b00fc
parent3b2f09e11af04bc295a5bbc6e0b312873bb0d32f (diff)
downloadopie-fc1d18b34bacf2429cdf8738bd68af6bb99d0a2e.zip
opie-fc1d18b34bacf2429cdf8738bd68af6bb99d0a2e.tar.gz
opie-fc1d18b34bacf2429cdf8738bd68af6bb99d0a2e.tar.bz2
ship sanitized userland header equivalent of linux/inotify.h
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/linux_inotify.h114
-rw-r--r--libopie2/opiecore/ofilenotify.h5
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 */
20struct 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 */
33struct 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
75extern void inotify_inode_queue_event(struct inode *, __u32, __u32,
76 const char *);
77extern void inotify_dentry_parent_queue_event(struct dentry *, __u32, __u32,
78 const char *);
79extern void inotify_super_block_umount(struct super_block *);
80extern void inotify_inode_is_dead(struct inode *);
81extern u32 inotify_get_cookie(void);
82
83#else
84
85static inline void inotify_inode_queue_event(struct inode *inode,
86 __u32 mask, __u32 cookie,
87 const char *filename)
88{
89}
90
91static inline void inotify_dentry_parent_queue_event(struct dentry *dentry,
92 __u32 mask, __u32 cookie,
93 const char *filename)
94{
95}
96
97static inline void inotify_super_block_umount(struct super_block *sb)
98{
99}
100
101static inline void inotify_inode_is_dead(struct inode *inode)
102{
103}
104
105static 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
@@ -32,14 +32,13 @@ _;:,     .>    :=|. This program is free software; you can
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
43namespace Opie { 42namespace Opie {
44namespace Core { 43namespace Core {
45 44