dm: core: 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:
Sun Peng 2020-08-26 10:54:19 +00:00 committed by wenlingz
parent 25fff0c21a
commit 71c36f19d1
7 changed files with 21 additions and 25 deletions

View File

@ -211,9 +211,9 @@ int acrn_parse_intr_monitor(const char *opt)
(!dm_strtoui(cp + 1, &cp, 10, &period) && *cp == ',') &&
(!dm_strtoui(cp + 1, &cp, 10, &delay) && *cp == ',') &&
(!dm_strtoui(cp + 1, &cp, 10, &duration))) {
printf("interrupt storm monitor params: %d, %d, %d, %d\n", threshold, period, delay, duration);
pr_dbg("interrupt storm monitor params: %d, %d, %d, %d\n", threshold, period, delay, duration);
} else {
printf("%s: not correct, it should be like: --intr_monitor 10000,10,1,100, please check!\n", opt);
pr_err("%s: not correct, it should be like: --intr_monitor 10000,10,1,100, please check!\n", opt);
return -1;
}

View File

@ -179,7 +179,7 @@ int parse_pm_by_vuart(const char *opts)
}
}
printf("pm by vuart node-index = %d\n", node_index);
pr_dbg("pm by vuart node-index = %d\n", node_index);
strncpy(node_path, str, MAX_NODE_PATH - 1);
free(cpy);

View File

@ -128,14 +128,14 @@ acrn_parse_kernel(char *arg)
if (len < STR_LEN) {
strncpy(kernel_path, arg, len + 1);
if (check_image(kernel_path, 0, &kernel_size) != 0){
fprintf(stderr, "SW_LOAD: check_image failed for '%s'\n",
pr_err("SW_LOAD: check_image failed for '%s'\n",
kernel_path);
exit(10); /* Non-zero */
}
kernel_file_name = kernel_path;
with_kernel = 1;
printf("SW_LOAD: get kernel path %s\n", kernel_path);
pr_notice("SW_LOAD: get kernel path %s\n", kernel_path);
return 0;
} else
return -1;
@ -149,13 +149,13 @@ acrn_parse_ramdisk(char *arg)
if (len < STR_LEN) {
strncpy(ramdisk_path, arg, len + 1);
if (check_image(ramdisk_path, 0, &ramdisk_size) != 0){
fprintf(stderr, "SW_LOAD: check_image failed for '%s'\n",
pr_err("SW_LOAD: check_image failed for '%s'\n",
ramdisk_path);
exit(11); /* Non-zero */
}
with_ramdisk = 1;
printf("SW_LOAD: get ramdisk path %s\n", ramdisk_path);
pr_notice("SW_LOAD: get ramdisk path %s\n", ramdisk_path);
return 0;
} else
return -1;
@ -170,7 +170,7 @@ acrn_prepare_ramdisk(struct vmctx *ctx)
fp = fopen(ramdisk_path, "r");
if (fp == NULL) {
printf("SW_LOAD ERR: could not open ramdisk file %s\n",
pr_err("SW_LOAD ERR: could not open ramdisk file %s\n",
ramdisk_path);
return -1;
}
@ -220,7 +220,7 @@ acrn_prepare_kernel(struct vmctx *ctx)
fp = fopen(kernel_path, "r");
if (fp == NULL) {
printf("SW_LOAD ERR: could not open kernel file %s\n",
pr_err("SW_LOAD ERR: could not open kernel file %s\n",
kernel_path);
return -1;
}
@ -236,7 +236,7 @@ acrn_prepare_kernel(struct vmctx *ctx)
}
if ((len + KERNEL_LOAD_OFF(ctx)) > RAMDISK_LOAD_OFF(ctx)) {
printf("SW_LOAD ERR: need big system memory to fit image\n");
pr_err("SW_LOAD ERR: need big system memory to fit image\n");
fclose(fp);
return -1;
}
@ -245,13 +245,13 @@ acrn_prepare_kernel(struct vmctx *ctx)
read = fread(ctx->baseaddr + KERNEL_LOAD_OFF(ctx),
sizeof(char), len, fp);
if (read < len) {
printf("SW_LOAD ERR: could not read the whole kernel file,"
pr_err("SW_LOAD ERR: could not read the whole kernel file,"
" file len=%ld, read %lu\n", len, read);
fclose(fp);
return -1;
}
fclose(fp);
printf("SW_LOAD: kernel %s size %lu copied to guest 0x%lx\n",
pr_info("SW_LOAD: kernel %s size %lu copied to guest 0x%lx\n",
kernel_path, kernel_size, KERNEL_LOAD_OFF(ctx));
return 0;

View File

@ -144,7 +144,7 @@ acrn_parse_bootargs(char *arg)
if (len < BOOT_ARG_LEN) {
strncpy(bootargs, arg, len + 1);
with_bootargs = 1;
printf("SW_LOAD: get bootargs %s\n", bootargs);
pr_notice("SW_LOAD: get bootargs %s\n", bootargs);
return 0;
}
return -1;

View File

@ -103,7 +103,7 @@ acrn_parse_elf(char *arg)
strncpy(elf_path, arg, len + 1);
if (check_image(elf_path, 0, &elfsz) == 0) {
elf_file_name = elf_path;
printf("SW_LOAD: get elf path %s\n", elf_path);
pr_notice("SW_LOAD: get elf path %s\n", elf_path);
err = 0;
}
}

View File

@ -99,7 +99,7 @@ acrn_parse_ovmf(char *arg)
if (check_image(ovmf_path, OVMF_SZ_LIMIT, &ovmf_size) != 0)
break;
ovmf_file_name = ovmf_path;
printf("SW_LOAD: get ovmf path %s, size 0x%lx\n",
pr_notice("SW_LOAD: get ovmf path %s, size 0x%lx\n",
ovmf_path, ovmf_size);
error = 0;
}

View File

@ -149,8 +149,7 @@ acrn_prepare_guest_part_info(struct vmctx *ctx)
fp = fopen(guest_part_info_path, "r");
if (fp == NULL) {
fprintf(stderr,
"SW_LOAD ERR: could not open partition blob %s\n",
pr_err("SW_LOAD ERR: could not open partition blob %s\n",
guest_part_info_path);
return -1;
}
@ -159,15 +158,13 @@ acrn_prepare_guest_part_info(struct vmctx *ctx)
len = ftell(fp);
if (len != guest_part_info_size) {
fprintf(stderr,
"SW_LOAD ERR: partition blob changed\n");
pr_err("SW_LOAD ERR: partition blob changed\n");
fclose(fp);
return -1;
}
if ((len + GUEST_PART_INFO_OFF(ctx)) > BOOTARGS_OFF(ctx)) {
fprintf(stderr,
"SW_LOAD ERR: too large partition blob\n");
pr_err("SW_LOAD ERR: too large partition blob\n");
fclose(fp);
return -1;
}
@ -176,13 +173,12 @@ acrn_prepare_guest_part_info(struct vmctx *ctx)
read = fread(ctx->baseaddr + GUEST_PART_INFO_OFF(ctx),
sizeof(char), len, fp);
if (read < len) {
fprintf(stderr,
"SW_LOAD ERR: could not read whole partition blob\n");
pr_err("SW_LOAD ERR: could not read whole partition blob\n");
fclose(fp);
return -1;
}
fclose(fp);
printf("SW_LOAD: partition blob %s size %lu copy to guest 0x%lx\n",
pr_info("SW_LOAD: partition blob %s size %lu copy to guest 0x%lx\n",
guest_part_info_path, guest_part_info_size,
GUEST_PART_INFO_OFF(ctx));
@ -199,7 +195,7 @@ acrn_parse_vsbl(char *arg)
strncpy(vsbl_path, arg, len + 1);
if (check_image(vsbl_path, 8 * MB, &vsbl_size) == 0) {
vsbl_file_name = vsbl_path;
printf("SW_LOAD: get vsbl path %s\n", vsbl_path);
pr_notice("SW_LOAD: get vsbl path %s\n", vsbl_path);
error = 0;
}
}