dm: ioc: Convert print output to acrn-dm logger
Unifies the logs to pr_* interfaces instead of printf for better log management. Tracked-On: #5267 Signed-off-by: Sun Peng <peng.p.sun@intel.com> Reviewed-by: Chi Mingqiang <mingqiang.chi@intel.com> Acked-by: Wang, Yu1 <yu1.wang@intel.com>
This commit is contained in:
parent
c655313abd
commit
31a9525fa8
|
@ -69,22 +69,12 @@
|
|||
#include "ioc.h"
|
||||
#include "vmmapi.h"
|
||||
#include "monitor.h"
|
||||
#include "log.h"
|
||||
|
||||
/* For debugging log to a file */
|
||||
static int ioc_debug;
|
||||
static FILE *dbg_file;
|
||||
#define IOC_LOG_INIT do { if (ioc_debug) {\
|
||||
dbg_file = fopen("/tmp/ioc_log", "w+");\
|
||||
if (!dbg_file)\
|
||||
printf("ioc log open failed\r\n"); else cbc_set_log_file(dbg_file);\
|
||||
} } while (0)
|
||||
#define IOC_LOG_DEINIT do { if (dbg_file) fclose(dbg_file); dbg_file = NULL;\
|
||||
cbc_set_log_file(dbg_file);\
|
||||
} while (0)
|
||||
#define DPRINTF(format, arg...) \
|
||||
do { if (ioc_debug && dbg_file) { fprintf(dbg_file, format, arg);\
|
||||
fflush(dbg_file); } } while (0)
|
||||
#define WPRINTF(format, arg...) printf(format, ##arg)
|
||||
do { if (ioc_debug) { pr_dbg(format, arg); } } while (0)
|
||||
#define WPRINTF(format, arg...) pr_err(format, ##arg)
|
||||
|
||||
/*
|
||||
* For debugging only, to generate lifecycle, signal and oem-raw data
|
||||
|
@ -1528,8 +1518,6 @@ ioc_init(struct vmctx *ctx)
|
|||
int rc;
|
||||
struct ioc_dev *ioc;
|
||||
|
||||
IOC_LOG_INIT;
|
||||
|
||||
if (ioc_is_platform_supported() != 0)
|
||||
goto ioc_err;
|
||||
|
||||
|
@ -1695,7 +1683,6 @@ alloc_err:
|
|||
free(ioc->pool);
|
||||
free(ioc);
|
||||
ioc_err:
|
||||
IOC_LOG_DEINIT;
|
||||
DPRINTF("%s", "ioc mediator startup failed!!\r\n");
|
||||
return -1;
|
||||
}
|
||||
|
@ -1720,7 +1707,6 @@ ioc_deinit(struct vmctx *ctx)
|
|||
free(ioc->evts);
|
||||
free(ioc->pool);
|
||||
free(ioc);
|
||||
IOC_LOG_DEINIT;
|
||||
|
||||
ctx->ioc_dev = NULL;
|
||||
}
|
||||
|
|
|
@ -13,16 +13,15 @@
|
|||
|
||||
#include "ioc.h"
|
||||
#include "monitor.h"
|
||||
#include "log.h"
|
||||
|
||||
/*
|
||||
* Debug printf
|
||||
*/
|
||||
static int ioc_cbc_debug;
|
||||
static FILE *dbg_file;
|
||||
#define DPRINTF(format, arg...) \
|
||||
do { if (ioc_cbc_debug && dbg_file) { fprintf(dbg_file, format, arg);\
|
||||
fflush(dbg_file); } } while (0)
|
||||
#define WPRINTF(format, arg...) printf(format, ##arg)
|
||||
do { if (ioc_cbc_debug) { pr_dbg(format, arg); } } while (0)
|
||||
#define WPRINTF(format, arg...) pr_err(format, ##arg)
|
||||
|
||||
static void cbc_send_pkt(struct cbc_pkt *pkt);
|
||||
|
||||
|
@ -1018,12 +1017,3 @@ wlist_init_signal(struct cbc_signal *cbc_tbl, size_t cbc_size,
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Share log file with IOC.
|
||||
*/
|
||||
void
|
||||
cbc_set_log_file(FILE *f)
|
||||
{
|
||||
dbg_file = f;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue