[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [UNIKRAFT PATCH v2 01/10] lib/ukdebug: Introduce uk_pr_*() wrapper for uk_printd()



Similar to Linux's printing wrappers pr_*() we introduce printing
wrappers for the libukdebug:

 uk_pr_debug(fmt, ...) - does uk_printd(DLVL_EXTRA, fmt, ...)
 uk_pr_info(fmt, ...)  - does uk_printd(DLVL_INFO, fmt, ...)
 uk_pr_warn(fmt, ...)  - does uk_printd(DLVL_WARN, fmt, ...)
 uk_pr_err(fmt, ...)   - does uk_printd(DLVL_ERR, fmt, ...)
 uk_pr_crit(fmt, ...)  - does uk_printd(DLVL_CRIT, fmt, ...)

Signed-off-by: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>
Reviewed-by: Sharan Santhanam <sharan.santhanam@xxxxxxxxx>
---
 lib/ukdebug/include/uk/assert.h | 10 +++++-----
 lib/ukdebug/include/uk/print.h  | 10 ++++++++++
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/lib/ukdebug/include/uk/assert.h b/lib/ukdebug/include/uk/assert.h
index e623536..d81f42f 100644
--- a/lib/ukdebug/include/uk/assert.h
+++ b/lib/ukdebug/include/uk/assert.h
@@ -52,8 +52,8 @@ extern "C" {
 #define UK_ASSERT(x)                                                   \
        do {                                                            \
                if (unlikely(!(x))) {                                   \
-                       uk_printd(DLVL_CRIT, "Assertion failure: %s\n", \
-                                 STRINGIFY(x));                        \
+                       uk_pr_crit("Assertion failure: %s\n",           \
+                                  STRINGIFY(x));                       \
                        /* TODO: stack trace */                         \
                        ukplat_terminate(UKPLAT_CRASH);                 \
                }                                                       \
@@ -62,8 +62,8 @@ extern "C" {
 #define UK_WARNIF(x)                                                   \
        do {                                                            \
                if (unlikely(x)) {                                      \
-                       uk_printd(DLVL_WARN, "Condition warning: %s\n", \
-                                 STRINGIFY(x));                        \
+                       uk_pr_warn("Condition warning: %s\n",           \
+                                  STRINGIFY(x));                       \
                }                                                       \
        } while (0)
 
@@ -85,7 +85,7 @@ extern "C" {
 
 #define UK_CRASH(fmt, ...)                                             \
        do {                                                            \
-               uk_printd(DLVL_CRIT, (fmt), ##__VA_ARGS__);             \
+               uk_pr_crit((fmt), ##__VA_ARGS__);                       \
                /* TODO: stack trace */                                 \
                ukplat_terminate(UKPLAT_CRASH);                         \
        } while (0)
diff --git a/lib/ukdebug/include/uk/print.h b/lib/ukdebug/include/uk/print.h
index 965082c..07966e4 100644
--- a/lib/ukdebug/include/uk/print.h
+++ b/lib/ukdebug/include/uk/print.h
@@ -155,6 +155,16 @@ static inline void uk_printd(int lvl __unused, const char 
*fmt __unused, ...)
                uk_printd((dlvl), (fmt), ##__VA_ARGS__);                       \
        } while (0)
 
+/*
+ * Convenience wrapper for uk_printd()
+ * This is similar to the pr_* variants that you find in the Linux kernel
+ */
+#define uk_pr_debug(fmt, ...) uk_printd(DLVL_EXTRA, (fmt), ##__VA_ARGS__)
+#define uk_pr_info(fmt, ...)  uk_printd(DLVL_INFO,  (fmt), ##__VA_ARGS__)
+#define uk_pr_warn(fmt, ...)  uk_printd(DLVL_WARN,  (fmt), ##__VA_ARGS__)
+#define uk_pr_err(fmt, ...)   uk_printd(DLVL_ERR,   (fmt), ##__VA_ARGS__)
+#define uk_pr_crit(fmt, ...)  uk_printd(DLVL_CRIT,  (fmt), ##__VA_ARGS__)
+
 #ifdef __cplusplus
 }
 #endif
-- 
2.7.4


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.