/* * 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: * INODE_NUMBER [unsigned long] * INODE_DEVICE_NUMBER [unsigned long] * 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 */ /* Fill this and pass it to the ioctl */ struct inotify_packet { unsigned long i_no; // from stat unsigned long i_dev; // from stat unsigned long mask; // combination of above }; /* ioctl */ #define INOTIFY_IOCTL_MAGIC 'Q' #define INOTIFY_IOCTL_MAXNR 2 #define INOTIFY_WATCH _IOW(INOTIFY_IOCTL_MAGIC, 1, struct inotify_watch) #define INOTIFY_IGNORE _IOW(INOTIFY_IOCTL_MAGIC, 2, struct inotify_watch) /* 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