Home | History | Annotate | Download | only in fanotify
      1 /*
      2  * fanotify testcase common definitions.
      3  *
      4  * Copyright (c) 2012 Linux Test Project.  All Rights Reserved.
      5  *
      6  * This program is free software; you can redistribute it and/or modify it
      7  * under the terms of version 2 of the GNU General Public License as
      8  * published by the Free Software Foundation.
      9  *
     10  * This program is distributed in the hope that it would be useful, but
     11  * WITHOUT ANY WARRANTY; without even the implied warranty of
     12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     13  *
     14  * Further, this software is distributed without any warranty that it is
     15  * free of the rightful claim of any third person regarding infringement
     16  * or the like.  Any license provided herein, whether implied or
     17  * otherwise, applies only to this software file.  Patent licenses, if
     18  * any, provided herein do not apply to combinations of this program with
     19  * other software, or any other product whatsoever.
     20  *
     21  * You should have received a copy of the GNU General Public License along
     22  * with this program; if not, write the Free Software Foundation, Inc.,
     23  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
     24  *
     25  * Jan Kara, November 2013
     26  */
     27 
     28 #ifndef	__FANOTIFY_H__
     29 #define	__FANOTIFY_H__
     30 
     31 #include "config.h"
     32 
     33 #if defined(HAVE_SYS_FANOTIFY_H)
     34 
     35 #include <sys/fanotify.h>
     36 
     37 #else /* HAVE_SYS_FANOTIFY_H */
     38 
     39 /* fanotify(7) wrappers */
     40 
     41 #include <stdint.h>
     42 #include "lapi/syscalls.h"
     43 
     44 static int fanotify_init(unsigned int flags, unsigned int event_f_flags)
     45 {
     46 	return syscall(__NR_fanotify_init, flags, event_f_flags);
     47 }
     48 
     49 static long fanotify_mark(int fd, unsigned int flags, uint64_t mask,
     50                      int dfd, const char *pathname)
     51 {
     52 	return syscall(__NR_fanotify_mark, fd, flags, mask, dfd, pathname);
     53 }
     54 
     55 #endif /* HAVE_SYS_FANOTIFY_H */
     56 
     57 #ifndef FAN_REPORT_TID
     58 #define FAN_REPORT_TID		0x00000100
     59 #endif
     60 
     61 #ifndef FAN_MARK_INODE
     62 #define FAN_MARK_INODE		0
     63 #endif
     64 #ifndef FAN_MARK_FILESYSTEM
     65 #define FAN_MARK_FILESYSTEM	0x00000100
     66 #endif
     67 
     68 struct fanotify_mark_type {
     69 	unsigned int flag;
     70 	const char * name;
     71 };
     72 
     73 #define INIT_FANOTIFY_MARK_TYPE(t) \
     74 	{ FAN_MARK_ ## t, "FAN_MARK_" #t }
     75 
     76 #endif /* __FANOTIFY_H__ */
     77