From patchwork Fri Nov 24 16:35:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joey Gouly X-Patchwork-Id: 13467934 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 58A59C61DF4 for ; Fri, 24 Nov 2023 16:36:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D17356B0315; Fri, 24 Nov 2023 11:36:11 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CC5C26B0316; Fri, 24 Nov 2023 11:36:11 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B694D6B0319; Fri, 24 Nov 2023 11:36:11 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id A2F5B6B0315 for ; Fri, 24 Nov 2023 11:36:11 -0500 (EST) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 7B7BD807FC for ; Fri, 24 Nov 2023 16:36:11 +0000 (UTC) X-FDA: 81493400142.19.D592007 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf06.hostedemail.com (Postfix) with ESMTP id AB590180029 for ; Fri, 24 Nov 2023 16:36:09 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf06.hostedemail.com: domain of joey.gouly@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=joey.gouly@arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1700843769; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=N1J/hb7qs30qDd5psWMdxqs4a31Kgvgyac8y65CzPj0=; b=VAWz//KuHFOXdsvhaewH7NN/Ag95ZA5K4SYNshNrN9KENN4GMBDOd0VquiAv8E5q1jRkvm 9CBnLbi+7eBSZltgsJXJ7BEXuDsZXDMRvE2XwpYyb8nw07WuyAERMWBc/Li0PW2P60njGm biBMwYIStJXVVmEupMMSdKoYMHR1RYg= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf06.hostedemail.com: domain of joey.gouly@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=joey.gouly@arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1700843769; a=rsa-sha256; cv=none; b=ik5sorCk2SC0mgdgwuD9Pae6DF4AT33qP9SK/9pizFxYqEAYRe2sxXTWy5dxVjIXbMU2aM +PXWOUi7boASCoX/ce9MXXZUhX8W6h8tEGcke/ptlssIZGrLHLWnPB4HCGzh9XGkzqNRZG DdxkT8mM9BqhjfT/cdpqio8MXO9VgBE= Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8A96E1C00; Fri, 24 Nov 2023 08:36:55 -0800 (PST) Received: from e124191.cambridge.arm.com (e124191.cambridge.arm.com [10.1.197.45]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id DB4B43F73F; Fri, 24 Nov 2023 08:36:06 -0800 (PST) From: Joey Gouly To: linux-arm-kernel@lists.infradead.org Cc: akpm@linux-foundation.org, aneesh.kumar@linux.ibm.com, broonie@kernel.org, catalin.marinas@arm.com, dave.hansen@linux.intel.com, joey.gouly@arm.com, maz@kernel.org, oliver.upton@linux.dev, shuah@kernel.org, will@kernel.org, kvmarm@lists.linux.dev, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, James Morse , Suzuki K Poulose , Zenghui Yu Subject: [PATCH v3 19/25] kselftest/arm64: move get_header() Date: Fri, 24 Nov 2023 16:35:04 +0000 Message-Id: <20231124163510.1835740-20-joey.gouly@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231124163510.1835740-1-joey.gouly@arm.com> References: <20231124163510.1835740-1-joey.gouly@arm.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: AB590180029 X-Stat-Signature: k996qbtnb4nr1us1q69xudsc85rmxej8 X-HE-Tag: 1700843769-709844 X-HE-Meta: U2FsdGVkX18HC1lV4bNODDjJ6ph+KDxZj9DMYzGp/tBjKPDmVCU+E6bZEMlKu6FKGEP1wVNEQlABqZbzp8ar79mny1EJLuBOC/2hCzqX9gQ82hzKPsgBeXrglbCS5rqxtgu+9DTut4s7fpUJAnSoqV/AZhV8990/P0pv+UZJSMKGL4cgnb8bB0qHg0obC+D8Z/HczzqDcDtQJFYHx9KRF4g65/dvg4a7zU6fGkczUdbDnY5KuE2AUlvtyLwi9uhH7mFs9bheenA+3gxa7FjyAsOnzpzqRsK5FSHT4vOM6gDnbix5a4QMz7hottTyiJKQ5x8xUFnDBuu3KSih2DW3IK25bJqqwbJKYKaSeiWr9DRtofDLeasFKgsunRHUCBRAFL9XyaSZFjT1GzXJ00uYvxR+Z6gVPp+cJ5dS6U4hqnXAaxSgU0QrbzZoDCtFT59fWWXRc2ZGxrn2wrr2zl5c3tzUpe8XqrINVNNKnxl3oPP0grNUDVp+EVgsgKmGKtOn3vonhGBPcWUPR/17FOFOwxbPP5xzNgA8RI8Qw5f/Kt19tU9meFB6GoJwK7HiEL8ULKMZ1M3HTDZkGt7PVCXkzOIm+pGBTKMfhOsWimZeCygE17RiwsVZnUQ47rsqTzRrdUBo24JV/v3hZ0rMTxLoX2eGjlcJgJOpUo8VVQ3ixU8K2Cg8qYCR+b1Li5PYde1rUXjdNQUmDaCsz9k4u6ybLjSxjYKa45Z7tRySv4Mjgfz0ifO72JxEr+90TKiCWE2Hgns20MbRiwgfQquFPGiWn5226C5XE2XYVjXVr+4cBZtIn7wK4aJHfJqWaP/vYlCLUJurVmum5aoyGKfHDomuw3RDctaNcJp1PwFdqhMVc+GYC69XpnQX4+FF1D3Oc2VEIxBCH/uc4zB/thP6r9nSbm2dmZNfDzXNTVawSzIG3zhDLHQEpna6qn3rw5YsmK/RjsOriF8B04mYlKlMeQd YEAyOpSY bugSD5aOcEL/fVwJK/C2xqOCwfPOiRW10vaudmPgbPm3sd3znNQzf42aA2k7AOXXNIuqjiyhoUPm+Nw4Du8eM21wBRufBUzxIE8WWg50kT7g00xJlyw8ESZkNbLKN9yx2YCUHvYSkLgqIjcuZ3Lo7EIBs6sRkScA3dNtjCToZ/ms/be/2mP279lngVw7GIJpHb21smIdoCNtIdQG2DPbGtMIbG0MOeH0yudh0NjsRMVR4f+dEV3wJFycK/eAQa3MQcCiqaEL274x3I2fwSf+UxISiT28M9P/0qhpZ9NME3fhNCyn/AMx7h2m7JFTWFkvW8Vc32shr4C10XAsEb6KE15evXp1/LCHkl4DYzJPg5ZnhMIF/Dxah3nG0/A== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Put this function in the header so that it can be used by other tests, without needing to link to testcases.c. Signed-off-by: Joey Gouly Cc: Catalin Marinas Cc: Will Deacon Cc: Andrew Morton Cc: Shuah Khan Cc: Dave Hansen Cc: Aneesh Kumar K.V Reviewed-by: Mark Brown --- .../arm64/signal/testcases/testcases.c | 23 ----------------- .../arm64/signal/testcases/testcases.h | 25 +++++++++++++++++-- 2 files changed, 23 insertions(+), 25 deletions(-) diff --git a/tools/testing/selftests/arm64/signal/testcases/testcases.c b/tools/testing/selftests/arm64/signal/testcases/testcases.c index 9f580b55b388..fe950b6bca6b 100644 --- a/tools/testing/selftests/arm64/signal/testcases/testcases.c +++ b/tools/testing/selftests/arm64/signal/testcases/testcases.c @@ -6,29 +6,6 @@ #include "testcases.h" -struct _aarch64_ctx *get_header(struct _aarch64_ctx *head, uint32_t magic, - size_t resv_sz, size_t *offset) -{ - size_t offs = 0; - struct _aarch64_ctx *found = NULL; - - if (!head || resv_sz < HDR_SZ) - return found; - - while (offs <= resv_sz - HDR_SZ && - head->magic != magic && head->magic) { - offs += head->size; - head = GET_RESV_NEXT_HEAD(head); - } - if (head->magic == magic) { - found = head; - if (offset) - *offset = offs; - } - - return found; -} - bool validate_extra_context(struct extra_context *extra, char **err, void **extra_data, size_t *extra_size) { diff --git a/tools/testing/selftests/arm64/signal/testcases/testcases.h b/tools/testing/selftests/arm64/signal/testcases/testcases.h index a08ab0d6207a..d33154c9a4bd 100644 --- a/tools/testing/selftests/arm64/signal/testcases/testcases.h +++ b/tools/testing/selftests/arm64/signal/testcases/testcases.h @@ -87,8 +87,29 @@ struct fake_sigframe { bool validate_reserved(ucontext_t *uc, size_t resv_sz, char **err); -struct _aarch64_ctx *get_header(struct _aarch64_ctx *head, uint32_t magic, - size_t resv_sz, size_t *offset); +static inline struct _aarch64_ctx *get_header(struct _aarch64_ctx *head, uint32_t magic, + size_t resv_sz, size_t *offset) +{ + size_t offs = 0; + struct _aarch64_ctx *found = NULL; + + if (!head || resv_sz < HDR_SZ) + return found; + + while (offs <= resv_sz - HDR_SZ && + head->magic != magic && head->magic) { + offs += head->size; + head = GET_RESV_NEXT_HEAD(head); + } + if (head->magic == magic) { + found = head; + if (offset) + *offset = offs; + } + + return found; +} + static inline struct _aarch64_ctx *get_terminator(struct _aarch64_ctx *head, size_t resv_sz,