git: 1341925217a6 - stable/14 - LinuxKPI: Add str_on_off and other helpers to linux/string_helpers.h
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 17 Feb 2024 21:32:49 UTC
The branch stable/14 has been updated by wulf:
URL: https://cgit.FreeBSD.org/src/commit/?id=1341925217a6c1d2e47a54d1d2f9a8f83643e8a3
commit 1341925217a6c1d2e47a54d1d2f9a8f83643e8a3
Author: Vladimir Kondratyev <wulf@FreeBSD.org>
AuthorDate: 2023-12-24 08:19:58 +0000
Commit: Vladimir Kondratyev <wulf@FreeBSD.org>
CommitDate: 2024-02-17 20:58:36 +0000
LinuxKPI: Add str_on_off and other helpers to linux/string_helpers.h
Sponsored by: Serenity Cyber Security, LLC
Reviewed by: manu, bz, imp (previous version)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D42794
(cherry picked from commit ae1084ff01bf9d9a9a2c56caf6c7095f3e96f579)
---
.../linuxkpi/common/include/linux/string_helpers.h | 29 +++++++++++++++++++++-
1 file changed, 28 insertions(+), 1 deletion(-)
diff --git a/sys/compat/linuxkpi/common/include/linux/string_helpers.h b/sys/compat/linuxkpi/common/include/linux/string_helpers.h
index faa097c97a87..1bdff2730361 100644
--- a/sys/compat/linuxkpi/common/include/linux/string_helpers.h
+++ b/sys/compat/linuxkpi/common/include/linux/string_helpers.h
@@ -39,4 +39,31 @@ str_yes_no(bool value)
return "no";
}
-#endif /* _LINUXKPI_LINUX_STRING_HELPERS_H_ */
+static inline const char *
+str_on_off(bool value)
+{
+ if (value)
+ return "on";
+ else
+ return "off";
+}
+
+static inline const char *
+str_enabled_disabled(bool value)
+{
+ if (value)
+ return "enabled";
+ else
+ return "disabled";
+}
+
+static inline const char *
+str_enable_disable(bool value)
+{
+ if (value)
+ return "enable";
+ else
+ return "disable";
+}
+
+#endif