]> git.saurik.com Git - apple/xnu.git/blame - bsd/sys/fsevents.h
xnu-792.10.96.tar.gz
[apple/xnu.git] / bsd / sys / fsevents.h
CommitLineData
91447636
A
1#ifndef FSEVENT_H
2#define FSEVENT_H 1
3
4// Event types that you can ask to listen for
5#define FSE_INVALID -1
6#define FSE_CREATE_FILE 0
7#define FSE_DELETE 1
8#define FSE_STAT_CHANGED 2
9#define FSE_RENAME 3
10#define FSE_CONTENT_MODIFIED 4
11#define FSE_EXCHANGE 5
12#define FSE_FINDER_INFO_CHANGED 6
13#define FSE_CREATE_DIR 7
14#define FSE_CHOWN 8
15
16#define FSE_MAX_EVENTS 9
17#define FSE_ALL_EVENTS 998
18
19#define FSE_EVENTS_DROPPED 999
20
21// Actions for each event type
22#define FSE_IGNORE 0
23#define FSE_REPORT 1
24#define FSE_ASK 2 // Not implemented yet
25
26// The types of each of the arguments for an event
27// Each type is followed by the size and then the
28// data. FSE_ARG_VNODE is just a path string
29#define FSE_ARG_VNODE 0x0001 // next arg is a vnode pointer
30#define FSE_ARG_STRING 0x0002 // next arg is length followed by string ptr
31#define FSE_ARG_PATH 0x0003 // next arg is a full path
32#define FSE_ARG_INT32 0x0004 // next arg is a 32-bit int
33#define FSE_ARG_INT64 0x0005 // next arg is a 64-bit int
34#define FSE_ARG_RAW 0x0006 // next arg is a length followed by a void ptr
35#define FSE_ARG_INO 0x0007 // next arg is the inode number (ino_t)
36#define FSE_ARG_UID 0x0008 // next arg is the file's uid (uid_t)
37#define FSE_ARG_DEV 0x0009 // next arg is the file's dev_t
38#define FSE_ARG_MODE 0x000a // next arg is the file's mode (as an int32, file type only)
39#define FSE_ARG_GID 0x000b // next arg is the file's gid (gid_t)
40#define FSE_ARG_FINFO 0x000c // kernel internal only
41#define FSE_ARG_DONE 0xb33f // no more arguments
42
43#define FSE_MAX_ARGS 12
44
45
46// ioctl's on /dev/fsevents
47typedef struct fsevent_clone_args {
48 int8_t *event_list;
49 int32_t num_events;
50 int32_t event_queue_depth;
51 int32_t *fd;
52} fsevent_clone_args;
53
54#define FSEVENTS_CLONE _IOW('s', 1, fsevent_clone_args)
55
56
57// ioctl's on the cloned fd
58typedef struct fsevent_dev_filter_args {
59 uint32_t num_devices;
60 dev_t *devices;
61} fsevent_dev_filter_args;
62
63#define FSEVENTS_DEVICE_FILTER _IOW('s', 100, fsevent_dev_filter_args)
64
65
66#ifdef KERNEL
67
68int need_fsevent(int type, vnode_t vp);
69int add_fsevent(int type, vfs_context_t, ...);
70void fsevent_unmount(struct mount *mp);
71
72// misc utility functions for fsevent info and pathbuffers...
73typedef struct fse_info {
74 dev_t dev;
75 ino_t ino;
76 int32_t mode; // note: this is not a mode_t (it's 32-bits, not 16)
77 uid_t uid;
78 gid_t gid;
79} fse_info;
80
81int get_fse_info(struct vnode *vp, fse_info *fse, vfs_context_t ctx);
82
83char *get_pathbuff(void);
84void release_pathbuff(char *path);
85
86#endif /* KERNEL */
87
88#endif /* FSEVENT_H */