/* * Inode based directory notification for Linux * * Copyright (C) 2004 John McCutchan */ #ifndef _LINUX_INOTIFY_H #define _LINUX_INOTIFY_H #include #include /* When reading from the device the format is: * WATCHER_NUMBER [int] * EVENT_MASK [unsigned long] */ #define IN_ACCESS 0x00000001 /* File was accessed */ #define IN_MODIFY 0x00000002 /* File was modified */ #define IN_CREATE 0x00000004 /* File was created */ #define IN_DELETE 0x00000008 /* File was deleted */ #define IN_RENAME 0x00000010 /* File was renamed */ #define IN_ATTRIB 0x00000020 /* File changed attributes */ #define IN_MOVE 0x00000040 /* File was moved */ #define IN_UNMOUNT 0x00000080 /* Device file was on, was unmounted */ #define IN_CLOSE 0x00000100 /* File was closed */ #define IN_OPEN 0x00000200 /* File was opened */ /* ioctl */ /* Fill this and pass it to INOTIFY_WATCH ioctl */ struct inotify_watch_request { char *dirname; // directory name unsigned long mask; // event mask }; #define INOTIFY_IOCTL_MAGIC 'Q' #define INOTIFY_IOCTL_MAXNR 2 #define INOTIFY_WATCH _IOW(INOTIFY_IOCTL_MAGIC, 1, struct inotify_watch_request) #define INOTIFY_IGNORE _IOW(INOTIFY_IOCTL_MAGIC, 2, int) /* Kernel API */ void inotify_inode_queue_event (struct inode *inode, unsigned long mask); void inotify_dentry_queue_event (struct dentry *dentry, unsigned long mask); void inotify_inode_update_mask (struct inode *inode); #endif