From patchwork Sun May 19 20:37:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 164558 Delivered-To: patch@linaro.org Received: by 2002:a92:9e1a:0:0:0:0:0 with SMTP id q26csp4813736ili; Sun, 19 May 2019 14:30:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqyu50WiptaOgWgdXlM69XMTSJygBQwdl6yvISic+ll1KyV8hrxNRHqUhcZZ9bO8bd3OVYH0 X-Received: by 2002:a17:906:4e87:: with SMTP id v7mr49666231eju.150.1558301436580; Sun, 19 May 2019 14:30:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558301436; cv=none; d=google.com; s=arc-20160816; b=zcDAWAbfuJCFF0iBF9ORrlpgxdxjjTWDB7f0bJd/f4EkHSbDHrQEgP29eQpl9g/y3M 0RxXvUjnKDse5zhPS+5UchbTekN5+NaHk3ercBM3FqDOl53UG3hg5mMYU5bhTTQrSgjL HTypQgl0plYupvsZ55kqgKyFJpr08+0OeeAyODYcPzNIjJbTbrsX5/VuWx9W/KELY8L4 7HUADIceprA6DAq/wLqVPytFs0VS4fIi5eKPzSXiytwEY88uvXMAqteKZj+igFThUl9v HUkotH46qKk9kDNYw9OJcRiFJPYIa+81WyqSjVxLsG1i2QcDR3SGP6cfaJ2ZUKjcPnPY jnMw== 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=AwkKxT6hgxGUbnCawP7ML0rY671AUDoxnoeEokerBT8=; b=cPDHa3QRaMcF8ar/lhFD1pQ3UpeIvfCUSh01is//V77VI53z30jiZ7s8fnC/PeTkPA gVsAFGp4s8Tva9j7QlT5T59qSqew4GoSSuQ2dcvyXAUiuG675+Ux7iLq28aCN4RlXI7H gx5PO3V/DT/QxScL6O4Hcnz3IMnPsoli1riBakYpjrz8cPnW5a3heXERX3Zbbr1p/3oj N0yI4iaPEc7EnKmNCriU9rwFb6EJhcBDzmva0wMbhInd75kdUIaS1hhSSWskmrk15YTI P8eZNMpfTsU4JMFQhe5oDAyNe/6478eKSfPb6HJ0wdVAWT/gVh+s+P9gMUBjqWIGE6P/ pQJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=geyLX6mR; 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 c44si10929627ede.137.2019.05.19.14.30.36 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sun, 19 May 2019 14:30:36 -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=geyLX6mR; 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]:53929 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hSTO7-0007Po-GW for patch@linaro.org; Sun, 19 May 2019 17:30:35 -0400 Received: from eggs.gnu.org ([209.51.188.92]:51209) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hSSaB-000483-5N for qemu-devel@nongnu.org; Sun, 19 May 2019 16:39:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hSSaA-00056K-42 for qemu-devel@nongnu.org; Sun, 19 May 2019 16:38:59 -0400 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]:44494) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hSSa9-00055d-Tl for qemu-devel@nongnu.org; Sun, 19 May 2019 16:38:58 -0400 Received: by mail-pf1-x443.google.com with SMTP id g9so6149356pfo.11 for ; Sun, 19 May 2019 13:38:57 -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=AwkKxT6hgxGUbnCawP7ML0rY671AUDoxnoeEokerBT8=; b=geyLX6mRxlcwdztvehOJoVihDXVuFrvzPKzOHjfE52+WR6W5LXbZRhSZovgXDjj/s5 Rpv+56ZNUtlwmLfAdrPaEm5bdgDCVZlGvkJ7JRGMm5oi7Ooo/SEG2AmC6vbTtrSWU2U1 KHY83aLr+EU0NC/utnT2IFq204cIyERYQ6zXj6X6G6seqxqccTZ5mEPbmR1n8fvQ+eDj J/41cojmPZvLot3lmXnjgEBe7eVoj74cioFSiaD3RRQlWwE+Riqr3ZFzv6GCt+U5VupW 7s0elB2xOG6RvI0p/YlV04Z2Y8hT1yJBL9lKTfElXE8v3237rFFMXSOYO+CcdOPM0uFr wfKQ== 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=AwkKxT6hgxGUbnCawP7ML0rY671AUDoxnoeEokerBT8=; b=Z7eFkQUVLutE06d2qjGsb3fQTHebo05mu9Ef6Y4xAdCjp2wRGi03iCZQFrDjv0quup O3zG97xhEdRU3kZYgUO46KFEUmPJFB40vrsJLR8KHbG1YKU/Ta/hXVeO0R4UlxdjVe5O LzRM0tMjryoLDObY8x7v6PS9/gnLx74YFkOtFHwdCa8qxxnjH1XgwNt7VVgmYX+LbAvI hIBrU1/hPYWa3PjxbUsCPTL+M5IqrnL8BQXXQCt6jaDw1URB0FPC7MuHHTNsBoduby9l 3z8j/pKvZlgfAzIqLemcK+AKaCw3L3wmbii9IiV6ji+7J5sR+/JlmYYuDn7nJXYsYWFB eCfw== X-Gm-Message-State: APjAAAWQ2vqkhNVPTvKrC5MscUvIeGQlvJS0/YISzCMyA6NPMqBfrnUz sw8om7sRw49MN2eI8g4p1eewhVIDkMU= X-Received: by 2002:a65:5cca:: with SMTP id b10mr71649844pgt.444.1558298336768; Sun, 19 May 2019 13:38:56 -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.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 19 May 2019 13:38:56 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sun, 19 May 2019 13:37:23 -0700 Message-Id: <20190519203726.20729-72-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::443 Subject: [Qemu-devel] [PATCH v7 71/74] linux-user: Split out swapon, swapoff 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" Signed-off-by: Richard Henderson --- linux-user/syscall-defs.h | 2 ++ linux-user/syscall-file.inc.c | 26 ++++++++++++++++++++++++++ linux-user/syscall.c | 16 ---------------- linux-user/strace.list | 6 ------ 4 files changed, 28 insertions(+), 22 deletions(-) -- 2.17.1 diff --git a/linux-user/syscall-defs.h b/linux-user/syscall-defs.h index 5625c268c3..34e799d206 100644 --- a/linux-user/syscall-defs.h +++ b/linux-user/syscall-defs.h @@ -279,6 +279,8 @@ SYSCALL_DEF(ssetmask, ARG_HEX); #ifdef TARGET_NR_stime SYSCALL_DEF(stime, ARG_PTR); #endif +SYSCALL_DEF(swapoff, ARG_STR); +SYSCALL_DEF(swapon, ARG_STR, ARG_HEX); #ifdef TARGET_NR_symlink SYSCALL_DEF(symlink, ARG_STR, ARG_STR); #endif diff --git a/linux-user/syscall-file.inc.c b/linux-user/syscall-file.inc.c index e3749f0fb4..bdf42ad437 100644 --- a/linux-user/syscall-file.inc.c +++ b/linux-user/syscall-file.inc.c @@ -1254,6 +1254,32 @@ SYSCALL_IMPL(select) } #endif +SYSCALL_IMPL(swapoff) +{ + char *p = lock_user_string(arg1); + abi_long ret; + + if (!p) { + return -TARGET_EFAULT; + } + ret = get_errno(swapoff(p)); + unlock_user(p, arg1, 0); + return ret; +} + +SYSCALL_IMPL(swapon) +{ + char *p = lock_user_string(arg1); + abi_long ret; + + if (!p) { + return -TARGET_EFAULT; + } + ret = get_errno(swapon(p, arg2)); + unlock_user(p, arg1, 0); + return ret; +} + static abi_long do_symlinkat(abi_ulong guest_target, int dirfd, abi_ulong guest_path) { diff --git a/linux-user/syscall.c b/linux-user/syscall.c index fccf9ee184..ead2e5c2b8 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -4158,14 +4158,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, void *p; switch(num) { -#ifdef TARGET_NR_swapon - case TARGET_NR_swapon: - if (!(p = lock_user_string(arg1))) - return -TARGET_EFAULT; - ret = get_errno(swapon(p, arg2)); - unlock_user(p, arg1, 0); - return ret; -#endif case TARGET_NR_reboot: if (arg3 == LINUX_REBOOT_CMD_RESTART2) { /* arg4 must be ignored in all other cases */ @@ -4503,14 +4495,6 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1, case TARGET_NR_syscall: return do_syscall(cpu_env, arg1 & 0xffff, arg2, arg3, arg4, arg5, arg6, arg7, arg8, 0); -#endif -#ifdef TARGET_NR_swapoff - case TARGET_NR_swapoff: - if (!(p = lock_user_string(arg1))) - return -TARGET_EFAULT; - ret = get_errno(swapoff(p)); - unlock_user(p, arg1, 0); - return ret; #endif case TARGET_NR_sysinfo: { diff --git a/linux-user/strace.list b/linux-user/strace.list index d9db80335d..3d2e398439 100644 --- a/linux-user/strace.list +++ b/linux-user/strace.list @@ -1116,12 +1116,6 @@ #ifdef TARGET_NR_swapcontext { TARGET_NR_swapcontext, "swapcontext" , NULL, NULL, NULL }, #endif -#ifdef TARGET_NR_swapoff -{ TARGET_NR_swapoff, "swapoff" , NULL, NULL, NULL }, -#endif -#ifdef TARGET_NR_swapon -{ TARGET_NR_swapon, "swapon" , NULL, NULL, NULL }, -#endif #ifdef TARGET_NR_syscall { TARGET_NR_syscall, "syscall" , NULL, NULL, NULL }, #endif