Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 24 Dec 2023 08:22:55 GMT
From:      Vladimir Kondratyev <wulf@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: ae1084ff01bf - main - LinuxKPI: Add str_on_off and other helpers to linux/string_helpers.h
Message-ID:  <202312240822.3BO8MtbS086516@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by wulf:

URL: https://cgit.FreeBSD.org/src/commit/?id=ae1084ff01bf9d9a9a2c56caf6c7095f3e96f579

commit ae1084ff01bf9d9a9a2c56caf6c7095f3e96f579
Author:     Vladimir Kondratyev <wulf@FreeBSD.org>
AuthorDate: 2023-12-24 08:19:58 +0000
Commit:     Vladimir Kondratyev <wulf@FreeBSD.org>
CommitDate: 2023-12-24 08:19:58 +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
---
 .../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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202312240822.3BO8MtbS086516>