From patchwork Fri Oct 27 18:08:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joey Gouly X-Patchwork-Id: 13438789 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 79C34C25B47 for ; Fri, 27 Oct 2023 18:09:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 047E86B03E7; Fri, 27 Oct 2023 14:09:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E9BE96B03E8; Fri, 27 Oct 2023 14:09:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CC9C86B03E9; Fri, 27 Oct 2023 14:09:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id B97186B03E7 for ; Fri, 27 Oct 2023 14:09:50 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 912E6120749 for ; Fri, 27 Oct 2023 18:09:50 +0000 (UTC) X-FDA: 81392029740.28.527136C Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf19.hostedemail.com (Postfix) with ESMTP id C064A1A000B for ; Fri, 27 Oct 2023 18:09:48 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=none; spf=pass (imf19.hostedemail.com: domain of joey.gouly@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=joey.gouly@arm.com; dmarc=pass (policy=none) header.from=arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1698430188; 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=6M0PnMRf2NwJStPiaPV4dv7glE2fIGPRERK4vKfYjX9RMSORcBI2Y/3EPfmyVUzLIEmB7Y bip4WqYwKOs3t/Mt3q9r69g/ADSjhwGfKOyuASKmaBG6mP51I5ChLzsnEyRRhJHTUnYoC2 BjOBfY9Ir8sTg8w8M0XQcn9tuipIJvQ= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1698430188; a=rsa-sha256; cv=none; b=CrNgQ3NnGM8yJfUTpMo8wpYV4P92dktpn35KHM9Zk9T/6/m3Mq2QDc/sXGxtQntxcJqxz7 XQ88HR5Fv+/C2/bD6aQcis3uh4hWBV4Z5eBZS122RStaJjAqwuAwdQH8yKdPhb9qjVBKvK U+h3nstwELfukeAEboUlrpHF8AbsYyM= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=none; spf=pass (imf19.hostedemail.com: domain of joey.gouly@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=joey.gouly@arm.com; dmarc=pass (policy=none) header.from=arm.com 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 C04221424; Fri, 27 Oct 2023 11:10:29 -0700 (PDT) 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 F2A533F64C; Fri, 27 Oct 2023 11:09:45 -0700 (PDT) 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 v2 18/24] kselftest/arm64: move get_header() Date: Fri, 27 Oct 2023 19:08:44 +0100 Message-Id: <20231027180850.1068089-19-joey.gouly@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231027180850.1068089-1-joey.gouly@arm.com> References: <20231027180850.1068089-1-joey.gouly@arm.com> MIME-Version: 1.0 X-Stat-Signature: d39wqph71hb4tgptou39h9qqiktw9c7b X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: C064A1A000B X-Rspam-User: X-HE-Tag: 1698430188-683732 X-HE-Meta: U2FsdGVkX1/LMkx6dfDhDaJLgd5wp+StYdv9cAu/WlKH/kJZtIgMFtRZcGlDW+xlDNSaRa/pRVuc6ovuhBQ1Zptq850GlsBhezE8vGdhUOU8TFhgxfHfhJ6GV/lNqwO4AlWrw5LX+f9+K0RTVR3x8Z5KKL4rQHHraSQkvlC9HIbNjk3UXJeTFtK4NrKAiYkgRe/t2Wuggyek9L15ez72G7+7eLNmDIqfTuM1gse6N9oUqwBzMh5q6xgy5ZSkY8+N59Ld8N3iy9PXikLqIQs+VZ3+3dC+OoUJdLjCozREQnK0pl8KwYI+HPoyt8QI5uEBPGR5K9tvvs2k5fONnTlhssa7BGizgoG4jZim3mas2JBCNYZA40pZnJtRnT4cV2mcCj/w4Twbiy3ksnHWK0f3nl7uQieoMevNLfZ5BGbU8ObIs6jO/qm3VLw3u4VeBrqiXwGMRLwlfI2Jd3llfGWa/DMhW3cFBl/DOt1NIHGrbwFBPFaIqCG7HBJ74x5yVWnlQ8mYPa4otFf6a0y4rFD+mxoLTFQV8Un/wyEe7GwoUjIQFPPgfqfL+Qm4UjpyhQRjbdHbhVqtw9oHGZiR733wcGWzHhEbljl2Lx6nIceT60oGL1Ytm3YXkv1ouxYJWgSQmyb9ZbOgJZPH3s7vLHNl6BGNKXFYjVO6nhqr829nfNiSWe3y86LypBQ1ejmC2d1Nd6weowoz9L2MHjMTs+fgIJ59hcLZ1e49iuaV4icBGLTEdKPg+tClI60U7fKb1piT11yi2r+uGrhMrWZD+XBrM30zrS1c/G2DqyvVAQISJLQTyW4Vx2zA/dtZ9Sj5y7skTYkrxJ9znmNZNpf+ersOzHNsYvZHqlUuER1tEG9KY8YuxEDqQGYigcPD+2rAp1oDhk/J/pulRrDyziBSXeyWDvjs6DuMBKLUoleO23oeAjqCHnJrbzALqBRoSp3PUEZxZwoIqakBpcyGSHrS527 PuOZP7Ht 5QrFhGXpgV7wfarwzSZMEG6naJObeJq5U2K6GMfd52vyteql6A/rTMdh/Emrf2E85G3wXzV1jP6RDLKOA7+rEhllvTANVhRcO/xNWJMFxvqyoPBTJSOe5TPqaWm2ZXWg+aC9irKwGx8pjfT9d9sH03NraLQiLMVRkeuMFsP0AKaPlcWqhA/0bFUZCwkJqJSccc0YqKIGjQ3jxn4lniKLaQv81I0O1J8fiv+ZIuJWXkRDNVVN1K8lYlw6MGGPxOBL3oL+U9IMXE/6M4aj1KzCI7Z89QgQ/+KPIycPFt5YxCb2q8ICU8Qi8k/JgLmwWlldpUMNHLPtgRICvEvreYpK3cbbaPh59GQje/TuyE12PDkABe6F2gfdhX0giXg== 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 --- .../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,