fstest xnu_uuid subcommand.

* grub-core/commands/xnu_uuid.c (libgrubkrn): Add
	grub-core/commands/xnu_uuid.c.
	* util/grub-fstest.c (CMD_XNU_UUID): New enum value.
	(fstest): Handle xnu_uuid.
	(options): Document xnu_uuid.
	(argp_parser): Parse xnu_uuid.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2011-10-27 02:58:32 +02:00
parent 8e32442e80
commit 3be82e10a9
3 changed files with 41 additions and 1 deletions

View File

@ -1,3 +1,14 @@
2011-10-26 Vladimir Serbinenko <phcoder@gmail.com>
fstest xnu_uuid subcommand.
* grub-core/commands/xnu_uuid.c (libgrubkrn): Add
grub-core/commands/xnu_uuid.c.
* util/grub-fstest.c (CMD_XNU_UUID): New enum value.
(fstest): Handle xnu_uuid.
(options): Document xnu_uuid.
(argp_parser): Parse xnu_uuid.
2011-10-26 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/commands/xnu_uuid.c (grub_cmd_xnu_uuid): Support

View File

@ -43,6 +43,7 @@ library = {
common_nodist = grub_script.tab.h;
common = grub-core/commands/blocklist.c;
common = grub-core/commands/xnu_uuid.c;
common = grub-core/commands/testload.c;
common = grub-core/commands/ls.c;
common = grub-core/disk/dmraid_nvidia.c;

View File

@ -63,7 +63,8 @@ enum {
CMD_CRC,
CMD_BLOCKLIST,
CMD_TESTLOAD,
CMD_ZFSINFO
CMD_ZFSINFO,
CMD_XNU_UUID
};
#define BUF_SIZE 32256
@ -378,6 +379,27 @@ fstest (int n, char **args)
case CMD_TESTLOAD:
execute_command ("testload", n, args);
grub_printf ("\n");
case CMD_XNU_UUID:
{
grub_device_t dev;
grub_fs_t fs;
char *uuid = 0;
char *argv[3] = { "-l", NULL, NULL};
dev = grub_device_open (n ? args[0] : 0);
if (!dev)
grub_util_error (grub_errmsg);
fs = grub_fs_probe (dev);
if (!fs)
grub_util_error (grub_errmsg);
if (!fs->uuid)
grub_util_error ("couldn't retrieve UUID");
if (fs->uuid (dev, &uuid))
grub_util_error (grub_errmsg);
if (!uuid)
grub_util_error ("couldn't retrieve UUID");
argv[1] = uuid;
execute_command ("xnu_uuid", 2, argv);
}
}
for (i = 0; i < num_disks; i++)
@ -406,6 +428,7 @@ static struct argp_option options[] = {
{N_("hex FILE"), 0, 0 , OPTION_DOC, N_("Hex dump FILE."), 1},
{N_("crc FILE"), 0, 0 , OPTION_DOC, N_("Get crc32 checksum of FILE."), 1},
{N_("blocklist FILE"), 0, 0, OPTION_DOC, N_("Display blocklist of FILE."), 1},
{N_("xnu_uuid"), 0, 0, OPTION_DOC, N_("Compute XNU UUID of the device."), 1},
{"root", 'r', N_("DEVICE_NAME"), 0, N_("Set root device."), 2},
{"skip", 's', "N", 0, N_("Skip N bytes from output file."), 2},
@ -558,6 +581,11 @@ argp_parser (int key, char *arg, struct argp_state *state)
cmd = CMD_TESTLOAD;
nparm = 1;
}
else if (grub_strcmp (arg, "xnu_uuid") == 0)
{
cmd = CMD_XNU_UUID;
nparm = 0;
}
else
{
fprintf (stderr, _("Invalid command %s.\n"), arg);