blob: 74b1d927ad3a6fbc8456ac70735324f04531f884 [file] [log] [blame]
Dmitry V. Levin99db95d2014-02-05 04:13:18 +00001#include "defs.h"
Dmitry V. Levin99db95d2014-02-05 04:13:18 +00002
Dmitry V. Levin0ed617b2014-04-25 23:30:54 +00003#include "xlat/fan_classes.h"
Dmitry V. Levin0ed617b2014-04-25 23:30:54 +00004#include "xlat/fan_init_flags.h"
Dmitry V. Levin99db95d2014-02-05 04:13:18 +00005
Dmitry V. Levin34bbcc62015-02-19 21:55:09 +00006#ifndef FAN_ALL_CLASS_BITS
7# define FAN_ALL_CLASS_BITS (FAN_CLASS_NOTIF | FAN_CLASS_CONTENT | FAN_CLASS_PRE_CONTENT)
8#endif
9#ifndef FAN_NOFD
10# define FAN_NOFD -1
11#endif
12
Dmitry V. Levina0bd3742015-04-07 01:36:50 +000013SYS_FUNC(fanotify_init)
Dmitry V. Levin99db95d2014-02-05 04:13:18 +000014{
15 unsigned flags;
16
Dmitry V. Levin99db95d2014-02-05 04:13:18 +000017 flags = tcp->u_arg[0];
18 printxval(fan_classes, flags & FAN_ALL_CLASS_BITS, "FAN_CLASS_???");
19 flags &= ~FAN_ALL_CLASS_BITS;
20 if (flags) {
21 tprints("|");
22 printflags(fan_init_flags, flags, "FAN_???");
23 }
24 tprints(", ");
25 tprint_open_modes((unsigned) tcp->u_arg[1]);
26
Dmitry V. Levin5d22f072015-08-02 01:31:40 +000027 return RVAL_DECODED | RVAL_FD;
Dmitry V. Levin99db95d2014-02-05 04:13:18 +000028}
29
Dmitry V. Levin0ed617b2014-04-25 23:30:54 +000030#include "xlat/fan_mark_flags.h"
Dmitry V. Levin0ed617b2014-04-25 23:30:54 +000031#include "xlat/fan_event_flags.h"
Dmitry V. Levin99db95d2014-02-05 04:13:18 +000032
Dmitry V. Levina0bd3742015-04-07 01:36:50 +000033SYS_FUNC(fanotify_mark)
Dmitry V. Levin99db95d2014-02-05 04:13:18 +000034{
Dmitry V. Levin1ea64732015-01-10 00:08:58 +000035 unsigned long long mask = 0;
36 int argn;
37
Dmitry V. Levin99db95d2014-02-05 04:13:18 +000038 printfd(tcp, tcp->u_arg[0]);
39 tprints(", ");
40 printflags(fan_mark_flags, (unsigned) tcp->u_arg[1], "FAN_MARK_???");
41 tprints(", ");
Dmitry V. Levin1ea64732015-01-10 00:08:58 +000042 /*
43 * the mask argument is defined as 64-bit,
44 * but kernel uses the lower 32 bits only.
45 */
46 argn = getllval(tcp, &mask, 2);
Mike Frysinger28e3d6f2015-02-26 14:16:13 -050047#ifdef HPPA
48 /* Parsic is weird. See arch/parisc/kernel/sys_parisc32.c. */
49 mask = (mask << 32) | (mask >> 32);
50#endif
Dmitry V. Levin1ea64732015-01-10 00:08:58 +000051 printflags(fan_event_flags, mask, "FAN_???");
Dmitry V. Levin99db95d2014-02-05 04:13:18 +000052 tprints(", ");
Dmitry V. Levin1ea64732015-01-10 00:08:58 +000053 if ((int) tcp->u_arg[argn] == FAN_NOFD)
Dmitry V. Levin99db95d2014-02-05 04:13:18 +000054 tprints("FAN_NOFD, ");
55 else
Dmitry V. Levin1ea64732015-01-10 00:08:58 +000056 print_dirfd(tcp, tcp->u_arg[argn]);
57 printpath(tcp, tcp->u_arg[argn + 1]);
Dmitry V. Levin99db95d2014-02-05 04:13:18 +000058
Dmitry V. Levina3a7ffe2015-07-20 13:58:09 +000059 return RVAL_DECODED;
Dmitry V. Levin99db95d2014-02-05 04:13:18 +000060}