aboutsummaryrefslogtreecommitdiff
path: root/include/linux/string_choices.h
AgeCommit message (Collapse)AuthorFilesLines
2024-09-05lib/string_choices: Add some comments to make more clear for string choices ↵Hongbo Li1-0/+13
helpers. Add some comments to explain why we should use string_choices helpers. Signed-off-by: Hongbo Li <[email protected]> Acked-by: Andy Shevchenko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Kees Cook <[email protected]>
2024-09-05lib/string_choices: Introduce several opposite string choice helpersHongbo Li1-0/+4
Similar to the exists helper: str_enable_disable/ str_enabled_disabled/str_on_off/str_yes_no helpers, we can add the opposite helpers. That's str_disable_enable, str_disabled_enabled, str_off_on and str_no_yes. There are more than 10 cases currently (expect str_disable_enable now has 3 use cases) exist in the code can be replaced with these helper. Signed-off-by: Hongbo Li <[email protected]> Acked-by: Andy Shevchenko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Kees Cook <[email protected]>
2024-09-05lib/string_choices: Add str_true_false()/str_false_true() helperHongbo Li1-0/+6
Add str_true_false()/str_false_true() helper to return "true" or "false" string literal. Signed-off-by: Hongbo Li <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Kees Cook <[email protected]>
2024-08-15string_choices: Add wrapper for str_down_up()Kees Cook1-0/+1
The string choice functions which are not clearly true/false synonyms also have inverted wrappers. Add this for str_down_up() as well. Suggested-by: Andy Shevchenko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Kees Cook <[email protected]>
2024-08-15lib/string_choices: Add str_up_down() helperMichal Wajdeczko1-0/+5
Add str_up_down() helper to return "up" or "down" string literal. Signed-off-by: Michal Wajdeczko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Kees Cook <[email protected]>
2024-02-29lib/string_choices: Add str_plural() helperMichal Wajdeczko1-0/+11
Add str_plural() helper to replace existing open implementations used by many drivers and help improve future user facing messages. Signed-off-by: Michal Wajdeczko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Kees Cook <[email protected]>
2023-07-28lib/string_choices: Add str_write_read() helperAndy Shevchenko1-0/+1
Add an inversed variant of str_read_write(), i.e. str_write_read(). Signed-off-by: Andy Shevchenko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Benjamin Tissoires <[email protected]>
2023-06-12lib/string_choices: Add str_high_low() helperAndy Shevchenko1-0/+12
Add str_high_low() helper to return 'high' or 'low' string literal. Also add an inversed variant, i.e. str_low_high(). All the same for str_hi_low(). Signed-off-by: Andy Shevchenko <[email protected]>
2023-06-12lib/string_helpers: Split out string_choices.hAndy Shevchenko1-0/+32
Some users may only need the string choice APIs. Split the respective header, i.e. string_choices.h. Include it in the string_helpers.h for backward compatibility. Signed-off-by: Andy Shevchenko <[email protected]>