1 Star 0 Fork 83

KMF / grub2

forked from src-openEuler / grub2 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0069-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch 1.84 KB
一键复制 编辑 原始数据 按行查看 历史
zhangqiumiao 提交于 2022-03-07 17:05 . update to version 2.06
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Sun, 28 Jun 2015 13:09:58 -0400
Subject: [PATCH] Add grub_qdprintf() - grub_dprintf() without the file+line
number.
This just makes copy+paste of our debug loading info easier.
Signed-off-by: Peter Jones <pjones@redhat.com>
---
grub-core/kern/misc.c | 18 ++++++++++++++++++
include/grub/misc.h | 2 ++
2 files changed, 20 insertions(+)
diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c
index a432a6be54a..9a2fae6398e 100644
--- a/grub-core/kern/misc.c
+++ b/grub-core/kern/misc.c
@@ -191,6 +191,24 @@ grub_real_dprintf (const char *file, const int line, const char *condition,
}
}
+void
+grub_qdprintf (const char *condition, const char *fmt, ...)
+{
+ va_list args;
+ const char *debug = grub_env_get ("debug");
+
+ if (! debug)
+ return;
+
+ if (grub_strword (debug, "all") || grub_strword (debug, condition))
+ {
+ va_start (args, fmt);
+ grub_vprintf (fmt, args);
+ va_end (args);
+ grub_refresh ();
+ }
+}
+
#define PREALLOC_SIZE 255
int
diff --git a/include/grub/misc.h b/include/grub/misc.h
index fd18e6320b8..3adc4036e3b 100644
--- a/include/grub/misc.h
+++ b/include/grub/misc.h
@@ -345,6 +345,8 @@ void EXPORT_FUNC(grub_real_dprintf) (const char *file,
const int line,
const char *condition,
const char *fmt, ...) __attribute__ ((format (GNU_PRINTF, 4, 5)));
+void EXPORT_FUNC(grub_qdprintf) (const char *condition,
+ const char *fmt, ...) __attribute__ ((format (GNU_PRINTF, 2, 3)));
int EXPORT_FUNC(grub_vprintf) (const char *fmt, va_list args);
int EXPORT_FUNC(grub_snprintf) (char *str, grub_size_t n, const char *fmt, ...)
__attribute__ ((format (GNU_PRINTF, 3, 4)));
1
https://gitee.com/kmf/grub2.git
git@gitee.com:kmf/grub2.git
kmf
grub2
grub2
master

搜索帮助