aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorThanos Makatos <thanos.makatos@nutanix.com>2020-12-02 05:31:52 -0500
committerThanos <tmakatos@gmail.com>2020-12-02 11:09:41 +0000
commitddf444e8da02e0c8796944e2484cd0ca91a0105d (patch)
tree72b8ee1f1fae4ba84155fc1970da16bb49693345 /include
parent806284b29414e11f7fd5274ba608ba66bbedc49f (diff)
downloadlibvfio-user-ddf444e8da02e0c8796944e2484cd0ca91a0105d.zip
libvfio-user-ddf444e8da02e0c8796944e2484cd0ca91a0105d.tar.gz
libvfio-user-ddf444e8da02e0c8796944e2484cd0ca91a0105d.tar.bz2
use log level defines from syslog
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
Diffstat (limited to 'include')
-rw-r--r--include/libvfio-user.h16
1 files changed, 6 insertions, 10 deletions
diff --git a/include/libvfio-user.h b/include/libvfio-user.h
index 4735991..f6a073c 100644
--- a/include/libvfio-user.h
+++ b/include/libvfio-user.h
@@ -41,6 +41,7 @@
#include <stdint.h>
#include <sys/uio.h>
#include <unistd.h>
+#include <syslog.h>
#include "pci.h"
#include "pci_caps/pm.h"
@@ -110,19 +111,14 @@ vfu_pci_get_config_space(vfu_ctx_t *vfu_ctx);
#define VFU_DMA_REGIONS 0x10
-typedef enum {
- VFU_ERR,
- VFU_INF,
- VFU_DBG
-} vfu_log_lvl_t;
-
/**
* Callback function signature for log function
* @pvt: private pointer
+ * @level: log level as defined in syslog(3)
* @vfu_log_fn_t: typedef for log function.
* @msg: message
*/
-typedef void (vfu_log_fn_t) (void *pvt, vfu_log_lvl_t lvl, const char *msg);
+typedef void (vfu_log_fn_t) (void *pvt, int level, const char *msg);
/**
* Callback function that gets called when a capability is accessed. The
@@ -261,10 +257,10 @@ vfu_create_ctx(vfu_trans_t trans, const char *path,
* Setup logging information.
* @vfu_ctx: the libvfio-user context
* @log: logging function
- * @log_lvl: logging level
+ * @level: logging level as defined in syslog(3)
*/
int
-vfu_setup_log(vfu_ctx_t *vfu_ctx, vfu_log_fn_t *log, vfu_log_lvl_t log_lvl);
+vfu_setup_log(vfu_ctx_t *vfu_ctx, vfu_log_fn_t *log, int level);
//TODO: Check other PCI header registers suitable to be filled by device.
// Or should we pass whole vfu_pci_hdr_t to be filled by user.
@@ -637,7 +633,7 @@ uint8_t *
vfu_ctx_get_cap(vfu_ctx_t *vfu_ctx, uint8_t id);
void
-vfu_log(vfu_ctx_t *vfu_ctx, vfu_log_lvl_t lvl, const char *fmt, ...);
+vfu_log(vfu_ctx_t *vfu_ctx, int level, const char *fmt, ...);
#ifdef __cplusplus
}