Linux Hardening
 help / color / mirror / Atom feed
From: R Sundar <prosunofficial@gmail.com>
To: Kees Cook <kees@kernel.org>, Andy Shevchenko <andy@kernel.org>
Cc: linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org,
	R Sundar <prosunofficial@gmail.com>,
	Przemek Kitszel <przemyslaw.kitszel@intel.com>
Subject: [PATCH linux-next] lib/string_choices: Add str_locked_unlocked()/str_unlocked_locked() helper
Date: Fri, 15 Nov 2024 20:16:16 +0530	[thread overview]
Message-ID: <20241115144616.7453-1-prosunofficial@gmail.com> (raw)

Add str_locked_unlocked()/str_unlocked_locked() helper to return
"locked" or "unlocked" string literal

Suggested-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Signed-off-by: R Sundar <prosunofficial@gmail.com>
---

https://lore.kernel.org/all/ca4f7990-16c4-42ef-b0ae-12e64a100f5e@intel.com/

https://lore.kernel.org/all/498a3d58-55e0-4349-bd92-8ce16c6016@inria.fr/

There are about 9 occurence for locked and unlocked string combination.

 include/linux/string_choices.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/include/linux/string_choices.h b/include/linux/string_choices.h
index 120ca0f28e95..c3ad47e1051b 100644
--- a/include/linux/string_choices.h
+++ b/include/linux/string_choices.h
@@ -82,4 +82,10 @@ static inline const char *str_plural(size_t num)
 	return num == 1 ? "" : "s";
 }
 
+static inline const char *str_locked_unlocked(bool v)
+{
+	return v ? "locked" : "unlocked";
+}
+#define str_unlocked_locked(v)		str_locked_unlocked(!(v))
+
 #endif
-- 
2.34.1


             reply	other threads:[~2024-11-15 14:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-15 14:46 R Sundar [this message]
2024-11-15 19:44 ` [PATCH linux-next] lib/string_choices: Add str_locked_unlocked()/str_unlocked_locked() helper Andy Shevchenko
2024-11-15 19:46   ` Andy Shevchenko
2024-11-16  3:48     ` R Sundar
2024-11-17 20:03       ` Andy Shevchenko
2024-11-18  3:10         ` R Sundar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241115144616.7453-1-prosunofficial@gmail.com \
    --to=prosunofficial@gmail.com \
    --cc=andy@kernel.org \
    --cc=kees@kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=przemyslaw.kitszel@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox