lib/string_choices: Add str_up_down() helper

Add str_up_down() helper to return "up" or "down" string literal.

Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Link: https://lore.kernel.org/r/20240725101841.574-1-michal.wajdeczko@intel.com
Signed-off-by: Kees Cook <kees@kernel.org>
pull/958/head
Michal Wajdeczko 2024-07-25 12:18:40 +02:00 committed by Kees Cook
parent 9c6b7fbbd7
commit a98ae7f045
1 changed files with 5 additions and 0 deletions

View File

@ -42,6 +42,11 @@ static inline const char *str_yes_no(bool v)
return v ? "yes" : "no";
}
static inline const char *str_up_down(bool v)
{
return v ? "up" : "down";
}
/**
* str_plural - Return the simple pluralization based on English counts
* @num: Number used for deciding pluralization