[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240827024517.914100-2-lihongbo22@huawei.com>
Date: Tue, 27 Aug 2024 10:45:15 +0800
From: Hongbo Li <lihongbo22@...wei.com>
To: <kees@...nel.org>, <andy@...nel.org>, <akpm@...ux-foundation.org>,
<trondmy@...nel.org>, <anna@...nel.org>, <gregkh@...uxfoundation.org>
CC: <linux-hardening@...r.kernel.org>, <linux-mm@...ck.org>,
<linux-nfs@...r.kernel.org>, <lihongbo22@...wei.com>
Subject: [PATCH -next v3 1/3] lib/string_choices: Add str_true_false()/str_false_true() helper
Add str_true_false()/str_false_true() helper to return "true" or
"false" string literal.
Signed-off-by: Hongbo Li <lihongbo22@...wei.com>
---
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 1320bcdcb89c..ebcc56b28ede 100644
--- a/include/linux/string_choices.h
+++ b/include/linux/string_choices.h
@@ -48,6 +48,12 @@ static inline const char *str_up_down(bool v)
}
#define str_down_up(v) str_up_down(!(v))
+static inline const char *str_true_false(bool v)
+{
+ return v ? "true" : "false";
+}
+#define str_false_true(v) str_true_false(!(v))
+
/**
* str_plural - Return the simple pluralization based on English counts
* @num: Number used for deciding pluralization
--
2.34.1
Powered by blists - more mailing lists