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)
This commit is contained in:
Vladimir Kondratyev 2023-12-24 11:19:58 +03:00
parent 73832b11e5
commit 1341925217

View file

@ -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