zipl/src: Introduce verbosity levels of zipl session

Introduce verbosity levels of zipl session and verbosity classes of
messages. This is used by the next patches in the series to suppress
information not corresponding the default output of zipl tool that
could be confusing for user.

Add a new option "--debug" of zipl tool to set up verbosity level 2
(and higher) of zipl session.

Reviewed-by: Peter Oberparleiter <oberpar@linux.ibm.com>
Reviewed-by: Stefan Haberland <sth@linux.ibm.com>
Signed-off-by: Eduard Shishkin <edward6@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Eduard Shishkin
2024-08-26 14:10:41 +02:00
committed by Jan Höppner
parent dc42460d82
commit a902fd9afe
4 changed files with 41 additions and 2 deletions
+20
View File
@@ -66,4 +66,24 @@ extern int verbose;
extern int interactive;
extern int dry_run;
/* Verbosity levels/classes */
#define VERBOSITY_STANDARD 0
#define VERBOSITY_EXTENDED 1
#define VERBOSITY_DEBUG 2
/*
* Macro for messages with assigned verbosity classes
*
* NOTE: Verbosity levels/classes 3 and higher are "reserved". To implement
* them, make "--debug" zipl option accept arguments.
*/
#define pr_class(class_id, ...) \
do { \
if (verbose >= (class_id)) \
printf(__VA_ARGS__); \
} while (0)
#define pr_verbose(...) pr_class(VERBOSITY_EXTENDED, __VA_ARGS__)
#define pr_debug(...) pr_class(VERBOSITY_DEBUG, __VA_ARGS__)
#endif /* not ZIPL_H */