From patchwork Sun Jun 10 03:02:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 138157 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp2607040lji; Sat, 9 Jun 2018 21:03:01 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJkxcdVeUKrE2InYpwjABtbEkz8PubmGw/Ily1p/EMIv+VyiZepiYiPa/q0/W9vSMD2osmI X-Received: by 2002:ae9:e118:: with SMTP id g24-v6mr10084643qkm.99.1528603381891; Sat, 09 Jun 2018 21:03:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528603381; cv=none; d=google.com; s=arc-20160816; b=XuvljiFMIcmsEOxHTjYxaW53NjQv/trM+mAx1MY5CJZI730OGs1TfwuJlJsw0Y4FT5 q7mfgo7JhcrOQCTh8p0hGth3tppE1zQcJyVakqOBDTM6di0DIIxCNTnJfSgWlJoOlXHd JADJRAUUcFCQA3g6oetQPfpYYt1RReD9wI772k2OdWoP0UTPqMSUloEk62vc7oVatj3w ZG+WmqeBx10qMfhExfxrWz4Cq7OksUoxhWDFO2+ncDEO3AdSYvtGZpdX641WyiQtn+lz 2aSzK5TQ79Ri1AXF+Dq+F0WlyCpm5hwwN3HQbUIEOR7XTlRTra+D8PLBn3MKBDgQ1GVC au1Q== 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:arc-authentication-results; bh=Zm91lsDlU3436di8f4ZHPG4Jj38ACT/W7U0hQR/idPk=; b=FVMAuLg4RbxzbnFc2o9JLlecTJx5Q3OrmA4f4lYVQEnbYDNX4vJHfYSBzpZRkdnjUl O9qOXbr7w1X5rsi90y8AZXHUwlhVlKbcM+iKApxJCoBQuproj0zIm5krxOyS7KvnqH2a DtZlM13w2HSsnW/GipARZq8HN7gHCtAu4D/f/CRhFYAZwjmHg2oETVBjAWvt2GCArxob 8JBE+bi4K613j+sjWXn4LPFXZsymSTk+LT+8rOVxO078Lcw9cAsAi5pSF+HiE60P5urV ct9OnZCdyfWOw3jJhUmsQX7GraGo9K3uxvBPuA6gSb50jiwU6KY7QWdqZdaGPUmDD8S1 pDFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Da3EBISb; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 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. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id y26-v6si8975894qtf.222.2018.06.09.21.03.01 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sat, 09 Jun 2018 21:03:01 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Da3EBISb; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 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 ([::1]:42513 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fRrZF-0006yx-A0 for patch@linaro.org; Sun, 10 Jun 2018 00:03:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41495) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fRqfv-0004ZV-2L for qemu-devel@nongnu.org; Sat, 09 Jun 2018 23:05:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fRqfs-0004jK-21 for qemu-devel@nongnu.org; Sat, 09 Jun 2018 23:05:51 -0400 Received: from mail-pl0-x241.google.com ([2607:f8b0:400e:c01::241]:43603) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fRqfr-0004it-ST for qemu-devel@nongnu.org; Sat, 09 Jun 2018 23:05:47 -0400 Received: by mail-pl0-x241.google.com with SMTP id c41-v6so10386204plj.10 for ; Sat, 09 Jun 2018 20:05:47 -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=Zm91lsDlU3436di8f4ZHPG4Jj38ACT/W7U0hQR/idPk=; b=Da3EBISbpzmMRlO/WxgaICOojtbJJpCI5E/2B5NAilzs9GnOOjFKSiZTiPF4Tg+clb 6q9uxA081AtkT++tT61V5KjwCwrWJnK5EXDoYINEastBwg31/7lAe+tt5VLViTXsFCvR I9rdWec2bEEgSddsOqcVJyOf+OU5lrTJvt1I4= 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=Zm91lsDlU3436di8f4ZHPG4Jj38ACT/W7U0hQR/idPk=; b=L54/4uxk19yuKbaff+q5jdESiAXlxXfS68H8eip7ibf4anT8XbKvP0sIu2Ur9E1gLf uHVyMgpZzePFD4SndT4bxMUHN96J9SevrAVuxixhViL121lqL2M0Fw9RrAO712bFgv+2 QOBl1Y484wahtJjOL2f6wG9RRJDDPFC8JxBMnczviQx0zKv7zvJThUdTgkgc9KNrlo5C eY78o7gdoMjYiuFmJOrQhjRBAZW1nIH8h8fkSmSN3jOvCr/RviuBtIq/6xiDr7UOCWS/ yKJBgaxOc28ABqVz6NrKLKUcGRWGNH0+6l10KnZ8395/C7hv3ZCGkl7YoP32DKgf++tn lKdw== X-Gm-Message-State: APt69E34Mq22wTZqbpjoRI/fZ60u2X+S9In/JioeizBL0Xpg+WA14sVe Aby4vsS4LR9ZL1rCUrHqHbv6FagwAEc= X-Received: by 2002:a17:902:784d:: with SMTP id e13-v6mr12980671pln.197.1528599946649; Sat, 09 Jun 2018 20:05:46 -0700 (PDT) Received: from cloudburst.twiddle.net (rrcs-173-198-77-219.west.biz.rr.com. [173.198.77.219]) by smtp.gmail.com with ESMTPSA id y17-v6sm31712718pfe.33.2018.06.09.20.05.45 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 09 Jun 2018 20:05:45 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sat, 9 Jun 2018 17:02:10 -1000 Message-Id: <20180610030220.3777-99-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180610030220.3777-1-richard.henderson@linaro.org> References: <20180610030220.3777-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c01::241 Subject: [Qemu-devel] [PATCH v2 098/108] linux-user: Split out fallocate, sync_file_range/2 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" All targets define fallocate; remove the ifdefs. Signed-off-by: Richard Henderson --- linux-user/syscall.c | 101 +++++++++++++++++++++++++++---------------- 1 file changed, 63 insertions(+), 38 deletions(-) -- 2.17.1 diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 1158afde27..5edcb39b73 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -8208,6 +8208,18 @@ IMPL(fadvise64) # endif #endif /* end fadvise64 handling */ +#ifdef CONFIG_FALLOCATE +IMPL(fallocate) +{ +# if TARGET_ABI_BITS == 32 + return get_errno(fallocate(arg1, arg2, target_offset64(arg3, arg4), + target_offset64(arg5, arg6))); +# else + return get_errno(fallocate(arg1, arg2, arg3, arg4)); +# endif +} +#endif + IMPL(fchdir) { return get_errno(fchdir(arg1)); @@ -12310,6 +12322,46 @@ IMPL(syncfs) } #endif +#ifdef CONFIG_SYNC_FILE_RANGE +# ifdef TARGET_NR_sync_file_range +IMPL(sync_file_range) +{ + uint64_t off, len; + unsigned flags; + +# if TARGET_ABI_BITS == 32 + if (regpairs_aligned(cpu_env, TARGET_NR_sync_file_range)) { + off = target_offset64(arg3, arg4); + len = target_offset64(arg5, arg6); + flags = arg7; + } else { + off = target_offset64(arg2, arg3); + len = target_offset64(arg4, arg5); + flags = arg6; + } +# else + off = arg2; + len = arg3; + flags = arg4; +# endif + return get_errno(sync_file_range(arg1, off, len, flags)); +} +# endif + +# ifdef TARGET_NR_sync_file_range2 +IMPL(sync_file_range2) +{ + /* This is like sync_file_range but the arguments are reordered */ +# if TARGET_ABI_BITS == 32 + return get_errno(sync_file_range(arg1, target_offset64(arg3, arg4), + target_offset64(arg5, arg6), arg2)); +# else + return get_errno(sync_file_range(arg1, arg3, arg4, arg2)); +# endif +} +# endif +#endif /* CONFIG_SYNC_FILE_RANGE */ + #ifdef TARGET_NR__sysctl IMPL(_sysctl) { @@ -12798,44 +12850,6 @@ static abi_long do_syscall1(void *cpu_env, unsigned num, abi_long arg1, abi_long ret; switch(num) { -#if defined(CONFIG_FALLOCATE) && defined(TARGET_NR_fallocate) - case TARGET_NR_fallocate: -#if TARGET_ABI_BITS == 32 - ret = get_errno(fallocate(arg1, arg2, target_offset64(arg3, arg4), - target_offset64(arg5, arg6))); -#else - ret = get_errno(fallocate(arg1, arg2, arg3, arg4)); -#endif - return ret; -#endif -#if defined(CONFIG_SYNC_FILE_RANGE) -#if defined(TARGET_NR_sync_file_range) - case TARGET_NR_sync_file_range: -#if TARGET_ABI_BITS == 32 -#if defined(TARGET_MIPS) - ret = get_errno(sync_file_range(arg1, target_offset64(arg3, arg4), - target_offset64(arg5, arg6), arg7)); -#else - ret = get_errno(sync_file_range(arg1, target_offset64(arg2, arg3), - target_offset64(arg4, arg5), arg6)); -#endif /* !TARGET_MIPS */ -#else - ret = get_errno(sync_file_range(arg1, arg2, arg3, arg4)); -#endif - return ret; -#endif -#if defined(TARGET_NR_sync_file_range2) - case TARGET_NR_sync_file_range2: - /* This is like sync_file_range but the arguments are reordered */ -#if TARGET_ABI_BITS == 32 - ret = get_errno(sync_file_range(arg1, target_offset64(arg3, arg4), - target_offset64(arg5, arg6), arg2)); -#else - ret = get_errno(sync_file_range(arg1, arg3, arg4, arg2)); -#endif - return ret; -#endif -#endif #if defined(TARGET_NR_signalfd4) case TARGET_NR_signalfd4: return do_signalfd4(arg1, arg2, arg4); @@ -13341,6 +13355,9 @@ static impl_fn *syscall_table(unsigned num) # else SYSCALL_WITH(fadvise64_64, fadvise64); # endif +#endif +#ifdef CONFIG_FALLOCATE + SYSCALL(fallocate); #endif SYSCALL(fchdir); SYSCALL(fchmod); @@ -13841,6 +13858,14 @@ static impl_fn *syscall_table(unsigned num) #ifdef CONFIG_SYNCFS SYSCALL(syncfs); #endif +#ifdef CONFIG_SYNC_FILE_RANGE +# ifdef TARGET_NR_sync_file_range + SYSCALL(sync_file_range); +# endif +# ifdef TARGET_NR_sync_file_range2 + SYSCALL(sync_file_range2); +# endif +#endif #ifdef TARGET_NR__sysctl SYSCALL(_sysctl); #endif