summaryrefslogtreecommitdiffstats
path: root/pcilib/error.h
diff options
context:
space:
mode:
Diffstat (limited to 'pcilib/error.h')
-rw-r--r--pcilib/error.h16
1 files changed, 13 insertions, 3 deletions
diff --git a/pcilib/error.h b/pcilib/error.h
index 511f43d..e68d102 100644
--- a/pcilib/error.h
+++ b/pcilib/error.h
@@ -4,6 +4,11 @@
#include <errno.h>
#include <pcilib.h>
+typedef enum {
+ PCILIB_LOG_DEFAULT = 0,
+ PCILIB_LOG_ONCE = 1
+} pcilib_log_flags_t;
+
enum {
PCILIB_ERROR_SUCCESS = 0,
PCILIB_ERROR_MEMORY = ENOMEM,
@@ -26,15 +31,20 @@ enum {
PCILIB_ERROR_BUSY = EBUSY
} pcilib_errot_t;
-void pcilib_log_message(const char *file, int line, pcilib_log_priority_t prio, const char *msg, ...);
-void pcilib_log_vmessage(const char *file, int line, pcilib_log_priority_t prio, const char *msg, va_list va);
+void pcilib_log_message(const char *file, int line, pcilib_log_flags_t flags, pcilib_log_priority_t prio, const char *msg, ...);
+void pcilib_log_vmessage(const char *file, int line, pcilib_log_flags_t flags, pcilib_log_priority_t prio, const char *msg, va_list va);
#define pcilib_log(prio, ...) \
- pcilib_log_message(__FILE__, __LINE__, prio, __VA_ARGS__)
+ pcilib_log_message(__FILE__, __LINE__, PCILIB_LOG_DEFAULT, prio, __VA_ARGS__)
+
+#define pcilib_log_once(prio, ...) \
+ pcilib_log_message(__FILE__, __LINE__, PCILIB_LOG_ONCE, 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__)
+#define pcilib_warning_once(...) pcilib_log_once(PCILIB_LOG_WARNING, __VA_ARGS__)
+#define pcilib_info_once(...) pcilib_log_once(PCILIB_LOG_INFO, __VA_ARGS__)
#endif /* _PCILIB_ERROR_H */