mount.c revision cf7ee30c6b0ca145260fa88ba7284c165ece6694
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
8SYS_FUNC(mount)
9{
10	if (entering(tcp)) {
11		bool ignore_type = false;
12		bool ignore_data = false;
13		bool old_magic = false;
14		unsigned long flags = tcp->u_arg[3];
15
16		/* Discard magic */
17		if ((flags & MS_MGC_MSK) == MS_MGC_VAL) {
18			flags &= ~MS_MGC_MSK;
19			old_magic = true;
20		}
21
22		if (flags & MS_REMOUNT)
23			ignore_type = true;
24		else if (flags & (MS_BIND | MS_MOVE | MS_SHARED
25				  | MS_PRIVATE | MS_SLAVE | MS_UNBINDABLE))
26			ignore_type = ignore_data = true;
27
28		printpath(tcp, tcp->u_arg[0]);
29		tprints(", ");
30
31		printpath(tcp, tcp->u_arg[1]);
32		tprints(", ");
33
34		if (ignore_type && tcp->u_arg[2])
35			tprintf("%#lx", tcp->u_arg[2]);
36		else
37			printstr(tcp, tcp->u_arg[2], -1);
38		tprints(", ");
39
40		if (old_magic) {
41			tprints("MS_MGC_VAL");
42			if (flags)
43				tprints("|");
44		}
45		if (flags || !old_magic)
46			printflags(mount_flags, flags, "MS_???");
47		tprints(", ");
48
49		if (ignore_data && tcp->u_arg[4])
50			tprintf("%#lx", tcp->u_arg[4]);
51		else
52			printstr(tcp, tcp->u_arg[4], -1);
53	}
54	return 0;
55}
56