summaryrefslogtreecommitdiffstats
path: root/pcilib/error.h
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2015-05-06 03:42:02 +0200
committerSuren A. Chilingaryan <csa@suren.me>2015-05-06 03:42:02 +0200
commit98d3c9e1b820020111aa85853c93ecb3550c627b (patch)
treecaea2ad19be18d716f47091c23b4fd01e37776a4 /pcilib/error.h
parent9ccacea308f336d10c8a94d393b261539a6970bf (diff)
downloadpcitool-98d3c9e1b820020111aa85853c93ecb3550c627b.tar.gz
pcitool-98d3c9e1b820020111aa85853c93ecb3550c627b.tar.bz2
pcitool-98d3c9e1b820020111aa85853c93ecb3550c627b.tar.xz
pcitool-98d3c9e1b820020111aa85853c93ecb3550c627b.zip
Support pcilib_log_once calls
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 */