From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Cc: laurent@vivier.eu
Subject: [Qemu-devel] [PATCH v7 32/74] linux-user: Split out umount, umount2
Date: Sun, 19 May 2019 13:36:44 -0700 [thread overview]
Message-ID: <20190519203726.20729-33-richard.henderson@linaro.org> (raw)
In-Reply-To: <20190519203726.20729-1-richard.henderson@linaro.org>
Note that umount2 is unconditionally available.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
linux-user/syscall-defs.h | 4 ++++
linux-user/syscall.h | 1 +
linux-user/strace.c | 30 ++++--------------------------
linux-user/syscall-file.inc.c | 25 +++++++++++++++++++++++++
linux-user/syscall.c | 16 ----------------
linux-user/strace.list | 6 ------
6 files changed, 34 insertions(+), 48 deletions(-)
diff --git a/linux-user/syscall-defs.h b/linux-user/syscall-defs.h
index 2b331c6a6d..0d8da0c6d6 100644
--- a/linux-user/syscall-defs.h
+++ b/linux-user/syscall-defs.h
@@ -155,6 +155,10 @@ SYSCALL_DEF(shmget, ARG_DEC, ARG_DEC, ARG_HEX);
#ifdef TARGET_NR_time
SYSCALL_DEF(time, ARG_PTR);
#endif
+#ifdef TARGET_NR_umount
+SYSCALL_DEF(umount, ARG_STR);
+#endif
+SYSCALL_DEF(umount2, ARG_STR, ARG_UMOUNTFLAG);
#ifdef TARGET_NR_unlink
SYSCALL_DEF(unlink, ARG_STR);
#endif
diff --git a/linux-user/syscall.h b/linux-user/syscall.h
index 35dd3e5fa3..3c936b648a 100644
--- a/linux-user/syscall.h
+++ b/linux-user/syscall.h
@@ -64,6 +64,7 @@ typedef enum {
ARG_MODEFLAG,
ARG_MOUNTFLAG,
ARG_OPENFLAG,
+ ARG_UMOUNTFLAG,
ARG_UNLINKATFLAG,
ARG_LSEEKWHENCE,
diff --git a/linux-user/strace.c b/linux-user/strace.c
index a99ab46b97..278d235ae6 100644
--- a/linux-user/strace.c
+++ b/linux-user/strace.c
@@ -733,7 +733,7 @@ static struct flags const mount_flags[] = {
FLAG_END,
};
-UNUSED static struct flags umount2_flags[] = {
+static struct flags const umount2_flags[] = {
#ifdef MNT_FORCE
FLAG_GENERIC(MNT_FORCE),
#endif
@@ -2015,31 +2015,6 @@ print_symlinkat(const struct syscallname *name,
}
#endif
-#ifdef TARGET_NR_umount
-static void
-print_umount(const struct syscallname *name,
- abi_long arg0, abi_long arg1, abi_long arg2,
- abi_long arg3, abi_long arg4, abi_long arg5)
-{
- print_syscall_prologue(name);
- print_string(arg0, 1);
- print_syscall_epilogue(name);
-}
-#endif
-
-#ifdef TARGET_NR_umount2
-static void
-print_umount2(const struct syscallname *name,
- abi_long arg0, abi_long arg1, abi_long arg2,
- abi_long arg3, abi_long arg4, abi_long arg5)
-{
- print_syscall_prologue(name);
- print_string(arg0, 0);
- print_flags(umount2_flags, arg1, 1);
- print_syscall_epilogue(name);
-}
-#endif
-
#ifdef TARGET_NR_utime
static void
print_utime(const struct syscallname *name,
@@ -2305,6 +2280,9 @@ static void print_syscall_def1(const SyscallDef *def, int64_t args[6])
case ARG_OPENFLAG:
len = add_open_flags(b, rest, arg);
break;
+ case ARG_UMOUNTFLAG:
+ len = add_flags(b, rest, umount2_flags, arg, false);
+ break;
case ARG_UNLINKATFLAG:
len = add_flags(b, rest, unlinkat_flags, arg, true);
break;
diff --git a/linux-user/syscall-file.inc.c b/linux-user/syscall-file.inc.c
index 4fc12512c2..345b4cb421 100644
--- a/linux-user/syscall-file.inc.c
+++ b/linux-user/syscall-file.inc.c
@@ -816,6 +816,31 @@ SYSCALL_IMPL(readlinkat)
}
#endif
+static abi_long do_umount2(abi_ulong target_path, int flags)
+{
+ char *p = lock_user_string(target_path);
+ abi_long ret;
+
+ if (!p) {
+ return -TARGET_EFAULT;
+ }
+ ret = get_errno(umount2(p, flags));
+ unlock_user(p, target_path, 0);
+ return ret;
+}
+
+#ifdef TARGET_NR_umount
+SYSCALL_IMPL(umount)
+{
+ return do_umount2(arg1, 0);
+}
+#endif
+
+SYSCALL_IMPL(umount2)
+{
+ return do_umount2(arg1, arg2);
+}
+
static abi_long do_unlinkat(int dirfd, abi_ulong target_path, int flags)
{
char *p = lock_user_string(target_path);
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index c826c65317..f3e03f535d 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -5380,14 +5380,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
void *p;
switch(num) {
-#ifdef TARGET_NR_umount
- case TARGET_NR_umount:
- if (!(p = lock_user_string(arg1)))
- return -TARGET_EFAULT;
- ret = get_errno(umount(p));
- unlock_user(p, arg1, 0);
- return ret;
-#endif
#ifdef TARGET_NR_stime /* not on alpha */
case TARGET_NR_stime:
{
@@ -5608,14 +5600,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
unlock_user(p, arg1, 0);
}
return ret;
-#ifdef TARGET_NR_umount2
- case TARGET_NR_umount2:
- if (!(p = lock_user_string(arg1)))
- return -TARGET_EFAULT;
- ret = get_errno(umount2(p, arg2));
- unlock_user(p, arg1, 0);
- return ret;
-#endif
case TARGET_NR_ioctl:
return do_ioctl(arg1, arg2, arg3);
#ifdef TARGET_NR_fcntl
diff --git a/linux-user/strace.list b/linux-user/strace.list
index 9b4024d94f..973a4c9209 100644
--- a/linux-user/strace.list
+++ b/linux-user/strace.list
@@ -1368,12 +1368,6 @@
#ifdef TARGET_NR_umask
{ TARGET_NR_umask, "umask" , "%s(%#o)", NULL, NULL },
#endif
-#ifdef TARGET_NR_umount
-{ TARGET_NR_umount, "umount" , NULL, print_umount, NULL },
-#endif
-#ifdef TARGET_NR_umount2
-{ TARGET_NR_umount2, "umount2" , NULL, print_umount2, NULL },
-#endif
#ifdef TARGET_NR_uname
{ TARGET_NR_uname, "uname" , "%s(%p)", NULL, NULL },
#endif
--
2.17.1
next prev parent reply other threads:[~2019-05-19 21:04 UTC|newest]
Thread overview: 81+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-19 20:36 [Qemu-devel] [PATCH v7 00/74] linux-user: Split do_syscall Richard Henderson
2019-05-19 20:36 ` [Qemu-devel] [PATCH v7 01/74] linux-user: Setup split syscall infrastructure Richard Henderson
2019-05-19 20:36 ` [Qemu-devel] [PATCH v7 02/74] linux-user: Split out open, open_at Richard Henderson
2019-05-19 20:36 ` [Qemu-devel] [PATCH v7 03/74] linux-user: Share more code for open and openat Richard Henderson
2019-05-19 20:36 ` [Qemu-devel] [PATCH v7 04/74] linux-user: Tidy do_openat loop over fakes Richard Henderson
2019-05-19 20:36 ` [Qemu-devel] [PATCH v7 05/74] linux-user: Split out readlink, readlinkat Richard Henderson
2019-05-19 20:36 ` [Qemu-devel] [PATCH v7 06/74] linux-user: Split out close Richard Henderson
2019-05-19 20:36 ` [Qemu-devel] [PATCH v7 07/74] linux-user: Split out read, write Richard Henderson
2019-05-19 20:36 ` [Qemu-devel] [PATCH v7 08/74] linux-user: Reduce regpairs_aligned & target_offset64 ifdefs Richard Henderson
2019-05-19 20:36 ` [Qemu-devel] [PATCH v7 09/74] linux-user: Split out readv, writev Richard Henderson
2019-05-19 20:36 ` [Qemu-devel] [PATCH v7 10/74] linux-user: Split out pread64, pwrite64 Richard Henderson
2019-05-19 20:36 ` [Qemu-devel] [PATCH v7 11/74] linux-user: Split out preadv, pwritev Richard Henderson
2019-05-19 20:36 ` [Qemu-devel] [PATCH v7 12/74] linux-user: Split out name_to_handle_at, open_by_handle_at Richard Henderson
2019-05-19 20:36 ` [Qemu-devel] [PATCH v7 13/74] linux-user: Split out ipc syscalls Richard Henderson
2019-05-19 20:36 ` [Qemu-devel] [PATCH v7 14/74] linux-user: Split out memory syscalls Richard Henderson
2019-05-19 20:36 ` [Qemu-devel] [PATCH v7 15/74] linux-user: Split out exit Richard Henderson
2019-05-19 20:36 ` [Qemu-devel] [PATCH v7 16/74] linux-user: Split out brk Richard Henderson
2019-05-19 20:36 ` [Qemu-devel] [PATCH v7 17/74] linux-user: Split out clone, fork, vfork Richard Henderson
2019-05-19 20:36 ` [Qemu-devel] [PATCH v7 18/74] linux-user: Split out wait4, waitid, waitpid Richard Henderson
2019-05-19 20:36 ` [Qemu-devel] [PATCH v7 19/74] linux-user: Implement rusage argument to waitid Richard Henderson
2019-05-19 20:36 ` [Qemu-devel] [PATCH v7 20/74] linux-user: Split out creat Richard Henderson
2019-05-19 20:36 ` [Qemu-devel] [PATCH v7 21/74] linux-user: Split out link, linkat Richard Henderson
2019-05-19 20:36 ` [Qemu-devel] [PATCH v7 22/74] linux-user: Split out unlink, unlinkat, rmdir Richard Henderson
2019-05-19 20:36 ` [Qemu-devel] [PATCH v7 23/74] linux-user: Split out execve Richard Henderson
2019-05-19 20:36 ` [Qemu-devel] [PATCH v7 24/74] linux-user: Implement execveat Richard Henderson
2019-05-19 20:36 ` [Qemu-devel] [PATCH v7 25/74] linux-user: Split out chdir Richard Henderson
2019-05-19 20:36 ` [Qemu-devel] [PATCH v7 26/74] linux-user: Split out time Richard Henderson
2019-05-19 20:36 ` [Qemu-devel] [PATCH v7 27/74] linux-user: Split out mknod, mknodat Richard Henderson
2019-05-19 20:36 ` [Qemu-devel] [PATCH v7 28/74] linux-user: Split out chmod, fchmod, fchmodat Richard Henderson
2019-05-19 20:36 ` [Qemu-devel] [PATCH v7 29/74] linux-user: Split out lseek, llseek Richard Henderson
2019-05-19 20:36 ` [Qemu-devel] [PATCH v7 30/74] linux-user: Split out getpid, getppid, getxpid Richard Henderson
2019-05-19 20:36 ` [Qemu-devel] [PATCH v7 31/74] linux-user: Split out mount Richard Henderson
2019-05-19 20:36 ` Richard Henderson [this message]
2019-05-19 20:36 ` [Qemu-devel] [PATCH v7 33/74] linux-user: Split out stime Richard Henderson
2019-05-19 20:36 ` [Qemu-devel] [PATCH v7 34/74] linux-user: Split out alarm, pause Richard Henderson
2019-05-19 20:36 ` [Qemu-devel] [PATCH v7 35/74] linux-user: Split out utime, utimes, futimesat Richard Henderson
2019-05-19 20:36 ` [Qemu-devel] [PATCH v7 36/74] linux-user: Split out access, faccessat Richard Henderson
2019-05-19 20:36 ` [Qemu-devel] [PATCH v7 37/74] linux-user: Split out nice Richard Henderson
2019-05-19 20:36 ` [Qemu-devel] [PATCH v7 38/74] linux-user: Split out sync, syncfs Richard Henderson
2019-05-19 20:36 ` [Qemu-devel] [PATCH v7 39/74] linux-user: Split out kill Richard Henderson
2019-05-19 20:36 ` [Qemu-devel] [PATCH v7 40/74] linux-user: Split out rename, renameat, renameat2 Richard Henderson
2019-05-19 20:36 ` [Qemu-devel] [PATCH v7 41/74] linux-user: Split out mkdir, mkdirat Richard Henderson
2019-05-19 20:36 ` [Qemu-devel] [PATCH v7 42/74] linux-user: Split out dup, dup2, dup3 Richard Henderson
2019-05-19 20:36 ` [Qemu-devel] [PATCH v7 43/74] linux-user: Split out pipe, pipe2 Richard Henderson
2019-05-19 20:36 ` [Qemu-devel] [PATCH v7 44/74] linux-user: Split out times Richard Henderson
2019-05-19 20:36 ` [Qemu-devel] [PATCH v7 45/74] linux-user: Split out acct Richard Henderson
2019-05-19 20:36 ` [Qemu-devel] [PATCH v7 46/74] linux-user: Move syscall_init to the end Richard Henderson
2019-05-19 20:36 ` [Qemu-devel] [PATCH v7 47/74] linux-user: Split out ioctl Richard Henderson
2019-05-19 20:37 ` [Qemu-devel] [PATCH v7 48/74] linux-user: Fix types in ioctl logging Richard Henderson
2019-05-19 20:37 ` [Qemu-devel] [PATCH v7 49/74] linux-user: Remove sentinel from ioctl_entries Richard Henderson
2019-05-19 20:37 ` [Qemu-devel] [PATCH v7 50/74] linux-user: Split out fcntl, fcntl64 Richard Henderson
2019-05-19 20:37 ` [Qemu-devel] [PATCH v7 51/74] linux-user: Split out setpgid Richard Henderson
2019-05-19 20:37 ` [Qemu-devel] [PATCH v7 52/74] linux-user: Split out umask Richard Henderson
2019-05-19 20:37 ` [Qemu-devel] [PATCH v7 53/74] linux-user: Split out chroot Richard Henderson
2019-05-19 20:37 ` [Qemu-devel] [PATCH v7 54/74] linux-user: Split out getpgid, getpgrp Richard Henderson
2019-05-19 20:37 ` [Qemu-devel] [PATCH v7 55/74] linux-user: Split out getsid, setsid Richard Henderson
2019-05-19 20:37 ` [Qemu-devel] [PATCH v7 56/74] linux-user: Split out sigaction, rt_sigaction Richard Henderson
2019-05-19 20:37 ` [Qemu-devel] [PATCH v7 57/74] linux-user: Split out sgetmask, ssetmask Richard Henderson
2019-05-19 20:37 ` [Qemu-devel] [PATCH v7 58/74] linux-user: Split out sigprocmask, rt_sigprocmask Richard Henderson
2019-05-19 20:37 ` [Qemu-devel] [PATCH v7 59/74] linux-user: Split out sigpending, rt_sigpending Richard Henderson
2019-05-19 20:37 ` [Qemu-devel] [PATCH v7 60/74] linux-user: Split out sigsuspend, rt_sigsuspend Richard Henderson
2019-05-19 20:37 ` [Qemu-devel] [PATCH v7 61/74] linux-user: Split out rt_sigtimedwait Richard Henderson
2019-05-19 20:37 ` [Qemu-devel] [PATCH v7 62/74] linux-user: Split out rt_sigqueueinfo, rt_tgsigqueueinfo Richard Henderson
2019-05-20 6:04 ` Aleksandar Markovic
2019-05-19 20:37 ` [Qemu-devel] [PATCH v7 63/74] linux-user: Split out sigreturn, rt_sigreturn Richard Henderson
2019-05-19 20:37 ` [Qemu-devel] [PATCH v7 64/74] linux-user: Split out gethostname, sethostname Richard Henderson
2019-05-19 20:37 ` [Qemu-devel] [PATCH v7 65/74] linux-user: Split out getrlimit, setrlimit Richard Henderson
2019-05-19 20:37 ` [Qemu-devel] [PATCH v7 66/74] linux-user: Split out getrusage Richard Henderson
2019-05-19 20:37 ` [Qemu-devel] [PATCH v7 67/74] linux-user: Split out gettimeofday, settimeofday Richard Henderson
2019-05-19 20:37 ` [Qemu-devel] [PATCH v7 68/74] linux-user: Split out select, _newselect Richard Henderson
2019-05-19 20:37 ` [Qemu-devel] [PATCH v7 69/74] linux-user: Split out pselect6 Richard Henderson
2019-05-19 20:37 ` [Qemu-devel] [PATCH v7 70/74] linux-user: Split out symlink, symlinkat Richard Henderson
2019-05-19 20:37 ` [Qemu-devel] [PATCH v7 71/74] linux-user: Split out swapon, swapoff Richard Henderson
2019-05-19 20:37 ` [Qemu-devel] [PATCH v7 72/74] linux-user: Split out reboot Richard Henderson
2019-05-19 20:37 ` [Qemu-devel] [PATCH v7 73/74] linux-user: Split out truncate, truncate64, ftruncate, ftruncate64 Richard Henderson
2019-05-19 20:37 ` [Qemu-devel] [PATCH v7 74/74] linux-user: Split out getpriority, setpriority Richard Henderson
2019-05-20 6:21 ` [Qemu-devel] [PATCH v7 00/74] linux-user: Split do_syscall Laurent Vivier
2019-05-20 9:42 ` Peter Maydell
2019-05-20 10:13 ` Aleksandar Markovic
2019-05-22 6:11 ` Aleksandar Markovic
[not found] ` <CAL1e-=i_=EQ02A1DGmVgqNi1ik=h39FZTOsxkGWfMa4ZoM6rjg@mail.gmail.com>
2019-05-22 11:29 ` Richard Henderson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190519203726.20729-33-richard.henderson@linaro.org \
--to=richard.henderson@linaro.org \
--cc=laurent@vivier.eu \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).