Message ID | 20240805152004.5039-24-dakr@kernel.org (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> 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 96E16C3DA7F for <linux-mm@archiver.kernel.org>; Mon, 5 Aug 2024 15:22:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 222178D0006; Mon, 5 Aug 2024 11:22:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1D2F18D0001; Mon, 5 Aug 2024 11:22:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 09A108D0006; Mon, 5 Aug 2024 11:22:25 -0400 (EDT) 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 E00098D0001 for <linux-mm@kvack.org>; Mon, 5 Aug 2024 11:22:24 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 9863E160317 for <linux-mm@kvack.org>; Mon, 5 Aug 2024 15:22:24 +0000 (UTC) X-FDA: 82418558208.29.CCEC824 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf10.hostedemail.com (Postfix) with ESMTP id F2457C002B for <linux-mm@kvack.org>; Mon, 5 Aug 2024 15:22:22 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=vEmVFRkO; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf10.hostedemail.com: domain of dakr@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=dakr@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1722871274; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Kg4rxZnToZCB8OB5w8nf/zd0zNrcWNsGfSrWrCZqegw=; b=pbbHJdxRqtrIQ7ktZuEbf0gFBzDtRX5cvJaKj0GcbIvPQQ3FSKyRMqSb4u3vyqrEwjB4D4 oCdZpjKHR9euy81zcyprKawC9q7PsEWE5m9QKMsXAdSNQjGhwlMXRjZbmnqiNovB4ds6Qz wg3PA4wa9Oc3V+VyWe0A+Dd2udEieWM= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1722871274; a=rsa-sha256; cv=none; b=oFYe+Q63VurKGPJidDG2pLRwmkVyJVPWzyQdSwG0xU3yA4LGvmhQDx9foEV+6dS8GigN9I O9OOlExFZoZeNwPoNXqJj1/BMDT4K/exHDRjpb4p6/KcqwRokFuOMT8pI6NVkAP1jv4CLZ i8prOI7xpLmDS4pfWQvSpubAAKm1NZE= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=vEmVFRkO; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf10.hostedemail.com: domain of dakr@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=dakr@kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 1AD9960D27; Mon, 5 Aug 2024 15:22:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 42B82C32782; Mon, 5 Aug 2024 15:22:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1722871341; bh=EhvuU5VnVA5zmjTNVXg5lAn5aUpDsOgozY6sKUH/Zyw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vEmVFRkOg+K1zHXflqDDLqMsFN5JV8HF2isrn3XG9SHLQENzOcT1gsu+4+g9o/IzO i1NcdMbFG58zjVRkRc8yw/6WVmKfBbia9zg9ZCiJXfUuQ3LyVj5VN/oa0PoAO1m01I MvEgr/p5ZsWrWwkny74Vk6sUqDTVENSSe4P7kEvbpyZHeukri9Abj45hY5u8CkXoCh aN2L+tN6VhYoOARZWnKwC/hxOobR4fqHcZaFq4TnhdsVuma4wHYELV1bVW+P3pV54S mAJX732Y/F1kZcbxCvivOKl4QFC3ef7HJjrVY4T7QgWrZtHUOWkFlOz0riRnp+tfdU 3D1Tn2ABbHY+A== From: Danilo Krummrich <dakr@kernel.org> To: ojeda@kernel.org, alex.gaynor@gmail.com, wedsonaf@gmail.com, boqun.feng@gmail.com, gary@garyguo.net, bjorn3_gh@protonmail.com, benno.lossin@proton.me, a.hindborg@samsung.com, aliceryhl@google.com, akpm@linux-foundation.org Cc: daniel.almeida@collabora.com, faith.ekstrand@collabora.com, boris.brezillon@collabora.com, lina@asahilina.net, mcanal@igalia.com, zhiw@nvidia.com, acurrid@nvidia.com, cjia@nvidia.com, jhubbard@nvidia.com, airlied@redhat.com, ajanulgu@redhat.com, lyude@redhat.com, linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org, linux-mm@kvack.org, Danilo Krummrich <dakr@kernel.org> Subject: [PATCH v4 23/28] rust: error: check for config `test` in `Error::name` Date: Mon, 5 Aug 2024 17:19:42 +0200 Message-ID: <20240805152004.5039-24-dakr@kernel.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240805152004.5039-1-dakr@kernel.org> References: <20240805152004.5039-1-dakr@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: F2457C002B X-Stat-Signature: 1ocaha3ckqoio3yukhase74gi8gd4hus X-Rspam-User: X-HE-Tag: 1722871342-400135 X-HE-Meta: U2FsdGV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zK5OTgNQcPUZEw7iz0wrZi0ZeWdU/f77YnYGzs/VbWqnGXoLC49MRvvnCygFb4o+1/0BsydjgBrsu2KV9QHH36pyNNA7TfNu38AAlRxJK8hNfe5Yd84vq2s1dv3By30CEbtP4i1P5lHLOZQVVqeq8DihrbJugWg52OYrP6pSnMm9JxoswF2w6pl1f30mfQ7/g5apOEyeqhXmWYjT5b9jz2kKFPov4bQ3/B+Qt0Xg4+IyyyDw== 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: <linux-mm.kvack.org> List-Subscribe: <mailto:majordomo@kvack.org> List-Unsubscribe: <mailto:majordomo@kvack.org> |
Series |
Generic `Allocator` support for Rust
|
expand
|
diff --git a/rust/kernel/error.rs b/rust/kernel/error.rs index 2d012cc3881a..7adf889b9526 100644 --- a/rust/kernel/error.rs +++ b/rust/kernel/error.rs @@ -140,7 +140,7 @@ pub(crate) fn to_ptr<T>(self) -> *mut T { } /// Returns a string representing the error, if one exists. - #[cfg(not(testlib))] + #[cfg(not(any(test, testlib)))] pub fn name(&self) -> Option<&'static CStr> { // SAFETY: Just an FFI call, there are no extra safety requirements. let ptr = unsafe { bindings::errname(-self.0) }; @@ -157,7 +157,7 @@ pub fn name(&self) -> Option<&'static CStr> { /// When `testlib` is configured, this always returns `None` to avoid the dependency on a /// kernel function so that tests that use this (e.g., by calling [`Result::unwrap`]) can still /// run in userspace. - #[cfg(testlib)] + #[cfg(any(test, testlib))] pub fn name(&self) -> Option<&'static CStr> { None }
Additional to `testlib` also check for `test` in `Error::name`. This is required by a subsequent patch that (indirectly) uses `Ăˆrror` in test cases. Signed-off-by: Danilo Krummrich <dakr@kernel.org> --- rust/kernel/error.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)