From nobody Mon Sep 28 17:50:03 2026 Received: from forward200a.mail.yandex.net (forward200a.mail.yandex.net [178.154.239.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B7BEB3AF66E for ; Wed, 19 Aug 2026 14:41:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=178.154.239.93 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787150512; cv=none; b=LpPkfPxIA/CVLM3AOZU1amw2q6htvYz9zRlwAyofiPVhg4AEl4dOlQi0IKCnX9+U4jVPCvblPql/fQOW5RNjdemdreOhg4VyovI1hcE2ImuekSnhXEwJEFJ/gaWfFeRyVVMyIkAIA+zrhGkzX47DtDZHDZUi4CXhMlaiihryXCk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787150512; c=relaxed/simple; bh=bSaJJWhPyQQj6cz8I4/iCdg02UqLcqD75mi66EVA4IY=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=hMF6O9UWwUFSe4dEPMxyKnX2p2oXyzFAnNwCCZEaogVpoeB5yI2Leklprh8GQDCVN6oOF/UXT54HvHbtD6joeBiY6f0dUVWWbdKqyvnpmlTzIRN/ynYHiLRNYcJxRYpagPCLlPQjpai55Z75oooqDNvBf4sunVC93m7aJWC01Yk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=yandex.ru; spf=pass smtp.mailfrom=yandex.ru; dkim=pass (1024-bit key) header.d=yandex.ru header.i=@yandex.ru header.b=NozGNO/P; arc=none smtp.client-ip=178.154.239.93 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=yandex.ru Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=yandex.ru Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=yandex.ru header.i=@yandex.ru header.b="NozGNO/P" Received: from forward103a.mail.yandex.net (forward103a.mail.yandex.net [IPv6:2a02:6b8:c0e:500:1:45:d181:d103]) by forward200a.mail.yandex.net (postfix) with ESMTPS id 1DF43C4657 for ; Wed, 19 Aug 2026 17:35:43 +0300 (MSK) Received: from mail-nwsmtp-smtp-production-main-94.vla.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-94.vla.yp-c.yandex.net [IPv6:2a02:6b8:c15:290e:0:640:f317:0]) by forward103a.mail.yandex.net (postfix) with ESMTPS id 138B380604; Wed, 19 Aug 2026 17:35:35 +0300 (MSK) Received: by mail-nwsmtp-smtp-production-main-94.vla.yp-c.yandex.net (smtp) with ESMTPSA id XZXek10e68c0-zNQS7zrd; Wed, 19 Aug 2026 17:35:34 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1787150134; bh=Pf6QFU23Y62exfGQJWImIsDb/qIEWxC4ADypW7heBFE=; h=Message-ID:Date:Cc:Subject:To:From; b=NozGNO/PWnSnmgQXTH052zBgrJlgLERq7XjMzcJcJSvax8tSJda0DXRPj7XSPE09A F2l2OhIKoP9ysS+iKm+cXANff6PRmEax8iEp/YdKMwJWtMizyUXO++F3eMSCQTljBQ tR0Tqiqch8tdsAt3YFLShCd91DElYip9+kv9Qn6o= Authentication-Results: mail-nwsmtp-smtp-production-main-94.vla.yp-c.yandex.net; dkim=pass header.i=@yandex.ru From: Dmitry Antipov To: Kees Cook , Andy Shevchenko Cc: linux-kernel@vger.kernel.org, Dmitry Antipov Subject: [PATCH] lib/string_choices: add str_pass_fail() and str_passed_failed() Date: Wed, 19 Aug 2026 17:34:48 +0300 Message-ID: <20260819143448.3161037-1-dmantipov@yandex.ru> X-Mailer: git-send-email 2.55.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Looking over a few kernel subsystems I'm currently working on, I suppose that 'str_pass_fail()' and 'str_passed_failed()' with their opposite counterpart macros may be useful as well. Signed-off-by: Dmitry Antipov --- include/linux/string_choices.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/include/linux/string_choices.h b/include/linux/string_choices.h index ee84087d4b26..901ab80bfdd7 100644 --- a/include/linux/string_choices.h +++ b/include/linux/string_choices.h @@ -59,6 +59,20 @@ static inline const char *str_on_off(bool v) } #define str_off_on(v) str_on_off(!(v)) =20 +static inline const char *str_pass_fail(bool v) +{ + return v ? "pass" : "fail"; +} + +#define str_fail_pass(v) str_pass_fail(!(v)) + +static inline const char *str_passed_failed(bool v) +{ + return v ? "passed" : "failed"; +} + +#define str_failed_passed(v) str_passed_failed(!(v)) + static inline const char *str_read_write(bool v) { return v ? "read" : "write"; --=20 2.55.0