blob: 51c7b3e47778df30831038275d14f68efd6a2ea0 [file] [log] [blame]
Dmitry V. Levin6da7ca32014-12-03 21:12:07 +00001#include "defs.h"
2
Dmitry V. Levincf7ee302015-06-16 00:31:45 +00003#define MS_MGC_VAL 0xc0ed0000 /* old magic mount flag number */
4#define MS_MGC_MSK 0xffff0000 /* old magic mount flag mask */
Dmitry V. Levin6da7ca32014-12-03 21:12:07 +00005
6#include "xlat/mount_flags.h"
7
Dmitry V. Levina0bd3742015-04-07 01:36:50 +00008SYS_FUNC(mount)
Dmitry V. Levin6da7ca32014-12-03 21:12:07 +00009{
Dmitry V. Levinef08ed12015-07-19 23:00:35 +000010 bool ignore_type = false;
11 bool ignore_data = false;
12 bool old_magic = false;
13 unsigned long flags = tcp->u_arg[3];
Dmitry V. Levin6da7ca32014-12-03 21:12:07 +000014
Dmitry V. Levinef08ed12015-07-19 23:00:35 +000015 /* Discard magic */
16 if ((flags & MS_MGC_MSK) == MS_MGC_VAL) {
17 flags &= ~MS_MGC_MSK;
18 old_magic = true;
Dmitry V. Levin6da7ca32014-12-03 21:12:07 +000019 }
Dmitry V. Levinef08ed12015-07-19 23:00:35 +000020
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;
Dmitry V. Levin6da7ca32014-12-03 21:12:07 +000054}