diff options
author | Suren A. Chilingaryan <csa@suren.me> | 2015-04-29 03:42:43 +0200 |
---|---|---|
committer | Suren A. Chilingaryan <csa@suren.me> | 2015-04-29 03:42:43 +0200 |
commit | bf466a54a10293067765bf767c572cbf09bcd170 (patch) | |
tree | 7b285a15aa71949dceb17b8726717ca3e003bee1 /pcilib/error.h | |
parent | c95fc0fb80a5e72cf198e77c9bf64fd17286dfde (diff) | |
download | pcitool-bf466a54a10293067765bf767c572cbf09bcd170.tar.gz pcitool-bf466a54a10293067765bf767c572cbf09bcd170.tar.bz2 pcitool-bf466a54a10293067765bf767c572cbf09bcd170.tar.xz pcitool-bf466a54a10293067765bf767c572cbf09bcd170.zip |
New error reporting public interface
Diffstat (limited to 'pcilib/error.h')
-rw-r--r-- | pcilib/error.h | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/pcilib/error.h b/pcilib/error.h index d923d3f..5b5f8b1 100644 --- a/pcilib/error.h +++ b/pcilib/error.h @@ -2,7 +2,8 @@ #define _PCILIB_ERROR_H #include <errno.h> - +#include <pcilib.h> + enum { PCILIB_ERROR_SUCCESS = 0, PCILIB_ERROR_MEMORY = ENOMEM, @@ -25,8 +26,14 @@ enum { PCILIB_ERROR_BUSY = EBUSY } pcilib_errot_t; -void pcilib_print_error(const char *msg, ...); -extern void (*pcilib_error)(const char *msg, ...); -extern void (*pcilib_warning)(const char *msg, ...); +void pcilib_log_message(const char *file, int line, pcilib_log_priority_t prio, const char *msg, ...); + +#define pcilib_log(prio, ...) \ + pcilib_log_message(__FILE__, __LINE__, prio, __VA_ARGS__) + +#define pcilib_error(...) pcilib_log(PCILIB_LOG_ERROR, __VA_ARGS__) +#define pcilib_warning(...) pcilib_log(PCILIB_LOG_WARNING, __VA_ARGS__) +#define pcilib_info(...) pcilib_log(PCILIB_LOG_INFO, __VA_ARGS__) + #endif /* _PCILIB_ERROR_H */ |