From: Nicholas Vinson <nvinson234@gmail.com>
To: grub-devel@gnu.org
Subject: [GRUB PARTUUID PATCH V9 1/5] Centralize guid prints
Date: Sat, 7 Apr 2018 16:28:10 -0700 [thread overview]
Message-ID: <284de397a106cb4d7a08c623ed35f807e6a7d019.1523131110.git.nvinson234@gmail.com> (raw)
In-Reply-To: <cover.1523131110.git.nvinson234@gmail.com>
In-Reply-To: <cover.1523131110.git.nvinson234@gmail.com>
Define print_gpt_guid(), so there is a central function for printing
GUID strings. This change is a precursor for later patches which rely
on this logic.
Signed-off-by: Nicholas Vinson <nvinson234@gmail.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
---
util/grub-probe.c | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/util/grub-probe.c b/util/grub-probe.c
index 8ac527d2f..21cb80fbe 100644
--- a/util/grub-probe.c
+++ b/util/grub-probe.c
@@ -129,6 +129,20 @@ get_targets_string (void)
return str;
}
+static int
+print_gpt_guid (grub_gpt_part_guid_t guid)
+{
+ guid.data1 = grub_le_to_cpu32 (guid.data1);
+ guid.data2 = grub_le_to_cpu16 (guid.data2);
+ guid.data3 = grub_le_to_cpu16 (guid.data3);
+
+ return grub_printf ("%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
+ guid.data1, guid.data2, guid.data3, guid.data4[0],
+ guid.data4[1], guid.data4[2], guid.data4[3],
+ guid.data4[4], guid.data4[5], guid.data4[6],
+ guid.data4[7]);
+}
+
static void
do_print (const char *x, void *data)
{
@@ -641,21 +655,7 @@ probe (const char *path, char **device_names, char delim)
if (grub_disk_read (dev->disk, p->offset, p->index,
sizeof (gptdata), &gptdata) == 0)
- {
- grub_gpt_part_type_t gpttype;
- gpttype.data1 = grub_le_to_cpu32 (gptdata.type.data1);
- gpttype.data2 = grub_le_to_cpu16 (gptdata.type.data2);
- gpttype.data3 = grub_le_to_cpu16 (gptdata.type.data3);
- grub_memcpy (gpttype.data4, gptdata.type.data4, 8);
-
- grub_printf ("%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
- gpttype.data1, gpttype.data2,
- gpttype.data3, gpttype.data4[0],
- gpttype.data4[1], gpttype.data4[2],
- gpttype.data4[3], gpttype.data4[4],
- gpttype.data4[5], gpttype.data4[6],
- gpttype.data4[7]);
- }
+ print_gpt_guid(gptdata.type);
dev->disk->partition = p;
}
putchar (delim);
--
2.16.3
next prev parent reply other threads:[~2018-04-07 23:28 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-07 23:28 [GRUB PARTUUID PATCH V9 0/5] Add PARTUUID detection support Nicholas Vinson
2018-04-07 23:28 ` Nicholas Vinson [this message]
2018-04-07 23:28 ` [GRUB PARTUUID PATCH V9 2/5] Update grub_gpt_partentry Nicholas Vinson
2018-04-07 23:28 ` [GRUB PARTUUID PATCH V9 3/5] Add PARTUUID detection support to grub-probe Nicholas Vinson
2018-04-07 23:28 ` [GRUB PARTUUID PATCH V9 4/5] Update grub script template files Nicholas Vinson
2018-04-10 20:52 ` Daniel Kiper
2018-04-11 3:00 ` Nick Vinson
2018-04-11 8:31 ` Daniel Kiper
2018-04-11 14:45 ` Nick Vinson
2018-04-16 11:47 ` Daniel Kiper
2018-04-17 5:34 ` Nick Vinson
2018-04-07 23:28 ` [GRUB PARTUUID PATCH V9 5/5] Default to disabling partition UUID support Nicholas Vinson
2018-04-10 20:56 ` [GRUB PARTUUID PATCH V9 0/5] Add PARTUUID detection support Daniel Kiper
2018-04-11 3:02 ` Nick Vinson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=284de397a106cb4d7a08c623ed35f807e6a7d019.1523131110.git.nvinson234@gmail.com \
--to=nvinson234@gmail.com \
--cc=grub-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.