From patchwork Sun May 19 20:36:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 164520 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4794110ili; Sun, 19 May 2019 14:02:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqzoSo+TMsWZLh2MSXNJW51GyyTU5zrzjQbM09lb7ymihPv6mSNkA9AN/S9i5BYJZfGwvRIC X-Received: by 2002:a50:8682:: with SMTP id r2mr70018607eda.106.1558299776230; Sun, 19 May 2019 14:02:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558299776; cv=none; d=google.com; s=arc-20160816; b=nxedtasrhfY5mSqCZwQgFn7cIXBw1M8ssK7kLNYhjcRut61md5k/O0xDyiVO0KStcn 1GZ0XwPysNTXqiIGFxlyE38Go/ltVK6GOiGOS10NOXyO/lp6qN9fyGrGsKDJTEhBD/Ne o2UwthTHqH39OxKYG8P9O1UTNQ66sZ3AaGkxO3yOxvkIVkSDKVyW7W9nCTubiWSeIwQv VxDfjmYKc9tqx//NX4nx7FyOAtAbRRqJJqMNo+Z+H8Ct4iZY6gVkrdSsLHmTtCjZORJ+ WjsSr7Pa9RrVYYdV4PaAZobL+dwQEBgXVHC+Mg+j48bseYJ478IYPgRvw4wzOh7D4a+c rO9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=FcVdmu4jJhr5SxGI0pZ6zduAqhixd7w4CsRDiK5ssJ4=; b=0vNOWQ3iFX2CYjjlYg9cfZQIaM4f8aBu4AycVb1gFLOFIvOREuph/U5ZFj0RMM6XQF PwY5bL0U+Dp6PnT0a7oFu7riqKPzlZIYCsnUz6CjxJjnyKihWor4g/NwbCFp2BSLjVu5 fc0joXcQ2Js7xzcLQsqbdjFMePtD7BRVEf+/ylLVv+//WRlQRVLjvSbGkeZiL8ivt4eI 2U8wha18D+hGvvvmy9aV/q8uyEaayd88qrFbC2VoFck+Fs4Vo5TkpHhC84AyBlWX8qeV Wt2eU0Cd+jrbewr8yS62usLTZHnRQLdJQ9PI/y4JnIgjheijOSolrd+PW9k24+EW0o1V Hk8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=NBW1rsds; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id r21si6955333ejn.154.2019.05.19.14.02.55 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sun, 19 May 2019 14:02:56 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=NBW1rsds; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1]:53466 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hSSxL-0007M1-48 for patch@linaro.org; Sun, 19 May 2019 17:02:55 -0400 Received: from eggs.gnu.org ([209.51.188.92]:50595) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hSSZX-0003X6-9y for qemu-devel@nongnu.org; Sun, 19 May 2019 16:38:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hSSZV-0004G0-Cp for qemu-devel@nongnu.org; Sun, 19 May 2019 16:38:19 -0400 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]:37617) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hSSZR-00048V-Ln for qemu-devel@nongnu.org; Sun, 19 May 2019 16:38:14 -0400 Received: by mail-pl1-x641.google.com with SMTP id p15so5718925pll.4 for ; Sun, 19 May 2019 13:38:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=FcVdmu4jJhr5SxGI0pZ6zduAqhixd7w4CsRDiK5ssJ4=; b=NBW1rsdsAeQKQIkAPkswlg4vV1I2Kbo3HgNVFCXApRyVXSWDtkETS0tSGyGyDszXR8 if1vF1uhZlttD332RE0c7rukzIPQWMUKRP0jg0c+qxnwJ8E3o9T57lK9aAMhPaI6YXYk 6QfWm4U1YyEMdt3Mhvom0Qqh1fcgxGHpBJkOtyIzS9wtzBrg0y4DXS8ws2yetw2z0fLZ eFBtBn+59JWJ5RYYswooOvP2qAfe1Z/EIAG3kaB7wuZy6ETBsdU0rs1QYfb591exX9vZ BXx/D22pLlA/Zffd8DdPGI4zIw+d1YgMIUSnDQe9IjUX8KY9PjPBzTAE7oy/2p/PnX/+ MI4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=FcVdmu4jJhr5SxGI0pZ6zduAqhixd7w4CsRDiK5ssJ4=; b=rG/++Ko6a9HrEGm0g7wXseI9/iBD/odUnKRMrydU6/R9tV7et9LNYxTWQwDW4MB+Ut pDQrWrBoPIBfMRuhnNRklPt2f61OGR0fYt9QI6d7fuvQ+2oHU11yhOAYXmpgv+sCfW/t +byJGo2gVpfQQOpJi8d1tyWcl6BQ71lp32za0PB2KvuTjj+8KH0Y11JNkNp71cv2ZGUM b+HwIXMnsWfaWjNrf07QzX+eHVvu1i8Zamtmjkh12tV6mnWKS7YS4OKnPmOhIwK1qd5G lAeFkftKseMU/MIptFO8lgE3vWE5Bx623nQ/aLdZhpCst+ZyLflPV3pCoyTWfzSx1wXT Hx9g== X-Gm-Message-State: APjAAAVzsCszWrY9Sk1ms56VktlVukBHMacqiJqrVLQ+CJqjvxzUfi/3 v/ZDX7XutkUnS+vw7WFh0UfzeKC/Tc8= X-Received: by 2002:a17:902:e00a:: with SMTP id ca10mr73329060plb.18.1558298290948; Sun, 19 May 2019 13:38:10 -0700 (PDT) Received: from localhost.localdomain (97-113-13-231.tukw.qwest.net. [97.113.13.231]) by smtp.gmail.com with ESMTPSA id i7sm11397448pfo.19.2019.05.19.13.38.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 19 May 2019 13:38:10 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sun, 19 May 2019 13:36:44 -0700 Message-Id: <20190519203726.20729-33-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190519203726.20729-1-richard.henderson@linaro.org> References: <20190519203726.20729-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::641 Subject: [Qemu-devel] [PATCH v7 32/74] linux-user: Split out umount, umount2 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: laurent@vivier.eu Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Note that umount2 is unconditionally available. Signed-off-by: Richard Henderson --- 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(-) -- 2.17.1 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