In function probe_disk_log_file(), handler 'dir'
returned by opendir() is not released before
function return and results in memory leakage.
Tracked-On: #7098
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
detection of any error in 'probe_disk_log_file()'
calling 'pr_err()' will cause 'write_to_disk()' function
being called recursively infinitely, as pr_err will
call write_to_disk() and trap to probe_disk_log_file() again,
hence program will crash finally.
This patch fix above issue by using printf instead of pr_err,
as printf outputs to console directly.
Tracked-On: #6518
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
1. add wall time info into disk log file, to make it easier to
sync with other log
2. improve the log path creating operation, call system to make
dir to avoid the first and second level path not existed.
Tracked-On: #4633
Signed-off-by: Minggui Cao <minggui.cao@intel.com>
Reviewed-by: Yin Fengwei <fengwei.yin@intel.com>
use acrn-dm logger function instread of perror,
this helps the stability testing log capture.
Tracked-On: #4098
Signed-off-by: Mingqiang Chi <mingqiang.chi@intel.com>
Use acrn-dm logger function instread of printf,
this helps the stability testing log capture.
Tracked-On: #4098
Signed-off-by: Mingqiang Chi <mingqiang.chi@intel.com>
Reviewed-by: Cao Minggui <minggui.cao@intel.com>
Reviewed-by: Yin Fengwei <fengwei.yin@intel.com>
sprintf/vsnprintf are not safe, so use snprintf
instead of sprintf, use vasprintf instead of vsnprintf.
Tracked-On: #3394
Signed-off-by: Tianhua Sun <tianhuax.s.sun@intel.com>
Reviewed-by: Yonghua Huang <yonghua.huang@intel.com>
Reviewed-by: Minggui Cao <minggui.cao@intel.com>
when DM exit, it is better to call deinit_loggers
to do some cleanup work.
Tracked-On: #3012
Signed-off-by: Minggui Cao <minggui.cao@intel.com>
Reviewed-by: Yin Fengwei <fengwei.yin@intel.com>
disk-logger used to save persistent log as file in disk.
log path: /var/log/acrn-dm/
each log file size is 2MB; default 8 log files; the log
files' suffix will be increased; when file count more than 8,
the last one added, the first one is removed, like form 1-8 to
2-9 to 3-10 ...
Tracked-On: #3012
Signed-off-by: Minggui Cao <minggui.cao@intel.com>
Reviewed-by: Yin Fengwei <fengwei.yin@intel.com>
variables defined by struct logger_ops just used
in local file, so add static to them.
Tracked-On: #3012
Signed-off-by: Minggui Cao <minggui.cao@intel.com>
Reviewed-by: Yin Fengwei <fengwei.yin@intel.com>
the logger setting can be input as acrn-dm params;
so need parse it to init logger system.
Tracked-On: #3012
Signed-off-by: Minggui Cao <minggui.cao@intel.com>
Acked-by: Yin Fengwei <fengwei.yin@intel.com>
kmsg logger used to output ACRN-DM log to /dev/kmsg,
it is easy to sync with kernel log.
it is better just output key info or error/failure
log to kmsg for kernel log size is limited.
Tracked-On: #3012
Signed-off-by: Minggui Cao <minggui.cao@intel.com>
Acked-by: Yin Fengwei <fengwei.yin@intel.com>
also set default logger as console and enabled.
Tracked-On: #3012
Signed-off-by: Minggui Cao <minggui.cao@intel.com>
Acked-by: Yin Fengwei <fengwei.yin@intel.com>