Dmitry V. Levin | 6da7ca3 | 2014-12-03 21:12:07 +0000 | [diff] [blame] | 1 | #include "defs.h" |
| 2 | |
Dmitry V. Levin | cf7ee30 | 2015-06-16 00:31:45 +0000 | [diff] [blame] | 3 | #define MS_MGC_VAL 0xc0ed0000 /* old magic mount flag number */ |
| 4 | #define MS_MGC_MSK 0xffff0000 /* old magic mount flag mask */ |
Dmitry V. Levin | 6da7ca3 | 2014-12-03 21:12:07 +0000 | [diff] [blame] | 5 | |
| 6 | #include "xlat/mount_flags.h" |
| 7 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 8 | SYS_FUNC(mount) |
Dmitry V. Levin | 6da7ca3 | 2014-12-03 21:12:07 +0000 | [diff] [blame] | 9 | { |
Dmitry V. Levin | ef08ed1 | 2015-07-19 23:00:35 +0000 | [diff] [blame] | 10 | bool ignore_type = false; |
| 11 | bool ignore_data = false; |
| 12 | bool old_magic = false; |
| 13 | unsigned long flags = tcp->u_arg[3]; |
Dmitry V. Levin | 6da7ca3 | 2014-12-03 21:12:07 +0000 | [diff] [blame] | 14 | |
Dmitry V. Levin | ef08ed1 | 2015-07-19 23:00:35 +0000 | [diff] [blame] | 15 | /* Discard magic */ |
| 16 | if ((flags & MS_MGC_MSK) == MS_MGC_VAL) { |
| 17 | flags &= ~MS_MGC_MSK; |
| 18 | old_magic = true; |
Dmitry V. Levin | 6da7ca3 | 2014-12-03 21:12:07 +0000 | [diff] [blame] | 19 | } |
Dmitry V. Levin | ef08ed1 | 2015-07-19 23:00:35 +0000 | [diff] [blame] | 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; |
Dmitry V. Levin | 6da7ca3 | 2014-12-03 21:12:07 +0000 | [diff] [blame] | 54 | } |