[SeaBIOS] [PATCH v2 2/3] add format_uuid() utility function
Laszlo Ersek
lersek at redhat.com
Tue Dec 11 17:16:39 CET 2012
Signed-off-by: Laszlo Ersek <lersek at redhat.com>
---
src/util.h | 1 +
src/output.c | 16 ++++++++++++++++
2 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/src/util.h b/src/util.h
index 7723bb1..aafa9b0 100644
--- a/src/util.h
+++ b/src/util.h
@@ -227,6 +227,7 @@ void __set_code_invalid(struct bregs *regs, u32 linecode, const char *fname);
void __set_code_unimplemented(struct bregs *regs, u32 linecode
, const char *fname);
void hexdump(const void *d, int len);
+void format_uuid(char buf[37], const u8 uuid[16]);
#define dprintf(lvl, fmt, args...) do { \
if (CONFIG_DEBUG_LEVEL && (lvl) <= CONFIG_DEBUG_LEVEL) \
diff --git a/src/output.c b/src/output.c
index 83de7f4..b6263b6 100644
--- a/src/output.c
+++ b/src/output.c
@@ -474,6 +474,22 @@ hexdump(const void *d, int len)
debug_serial_flush();
}
+void
+format_uuid(char buf[37], const u8 uuid[16])
+{
+ snprintf(buf, 37
+ , "%02x%02x%02x%02x"
+ "-%02x%02x"
+ "-%02x%02x"
+ "-%02x%02x"
+ "-%02x%02x%02x%02x%02x%02x"
+ , uuid[ 0], uuid[ 1], uuid[ 2], uuid[ 3]
+ , uuid[ 4], uuid[ 5]
+ , uuid[ 6], uuid[ 7]
+ , uuid[ 8], uuid[ 9]
+ , uuid[10], uuid[11], uuid[12], uuid[13], uuid[14], uuid[15]);
+}
+
static void
dump_regs(struct bregs *regs)
{
--
1.7.1
More information about the SeaBIOS
mailing list