]> granicus.if.org Git - strace/blob - mount.c
mount.c: make use of RVAL_DECODED
[strace] / mount.c
1 #include "defs.h"
2
3 #define MS_MGC_VAL      0xc0ed0000      /* old magic mount flag number */
4 #define MS_MGC_MSK      0xffff0000      /* old magic mount flag mask */
5
6 #include "xlat/mount_flags.h"
7
8 SYS_FUNC(mount)
9 {
10         bool ignore_type = false;
11         bool ignore_data = false;
12         bool old_magic = false;
13         unsigned long flags = tcp->u_arg[3];
14
15         /* Discard magic */
16         if ((flags & MS_MGC_MSK) == MS_MGC_VAL) {
17                 flags &= ~MS_MGC_MSK;
18                 old_magic = true;
19         }
20
21         if (flags & MS_REMOUNT)
22                 ignore_type = true;
23         else if (flags & (MS_BIND | MS_MOVE | MS_SHARED
24                           | MS_PRIVATE | MS_SLAVE | MS_UNBINDABLE))
25                 ignore_type = ignore_data = true;
26
27         printpath(tcp, tcp->u_arg[0]);
28         tprints(", ");
29
30         printpath(tcp, tcp->u_arg[1]);
31         tprints(", ");
32
33         if (ignore_type)
34                 printaddr(tcp->u_arg[2]);
35         else
36                 printstr(tcp, tcp->u_arg[2], -1);
37         tprints(", ");
38
39         if (old_magic) {
40                 tprints("MS_MGC_VAL");
41                 if (flags)
42                         tprints("|");
43         }
44         if (flags || !old_magic)
45                 printflags(mount_flags, flags, "MS_???");
46         tprints(", ");
47
48         if (ignore_data)
49                 printaddr(tcp->u_arg[4]);
50         else
51                 printstr(tcp, tcp->u_arg[4], -1);
52
53         return RVAL_DECODED;
54 }