]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
util/grub-fstest: Add a new command zfs-bootfs
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Fri, 15 Mar 2024 19:59:04 +0000 (22:59 +0300)
committerDaniel Kiper <daniel.kiper@oracle.com>
Thu, 11 Apr 2024 13:48:25 +0000 (15:48 +0200)
It is useful to check zfs-bootfs command.

Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
util/grub-fstest.c

index 25ae52ab6f4a9e99ae1dd9b191b5612a0dc4b62d..7ff9037b89683aa925cca3149b4af6fe42a03ec6 100644 (file)
@@ -69,7 +69,8 @@ enum {
   CMD_BLOCKLIST,
   CMD_TESTLOAD,
   CMD_ZFSINFO,
-  CMD_XNU_UUID
+  CMD_XNU_UUID,
+  CMD_ZFS_BOOTFS
 };
 #define BUF_SIZE  32256
 
@@ -441,6 +442,9 @@ fstest (int n)
     case CMD_ZFSINFO:
       execute_command ("zfsinfo", n, args);
       break;
+    case CMD_ZFS_BOOTFS:
+      execute_command ("zfs-bootfs", n, args);
+      break;
     case CMD_CP:
       cmd_cp (args[0], args[1]);
       break;
@@ -518,6 +522,7 @@ static struct argp_option options[] = {
   {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 DEVICE"), 0, 0, OPTION_DOC, N_("Compute XNU UUID of the device."), 1},
+  {N_("zfs-bootfs ZFS_DATASET"), 0, 0, OPTION_DOC, N_("Compute ZFS dataset bootpath."), 1},
 
   {"root",      'r', N_("DEVICE_NAME"), 0, N_("Set root device."),                 2},
   {"skip",      's', N_("NUM"),           0, N_("Skip N bytes from output file."),   2},
@@ -712,6 +717,11 @@ argp_parser (int key, char *arg, struct argp_state *state)
          cmd = CMD_XNU_UUID;
          nparm = 0;
        }
+      else if (grub_strcmp (arg, "zfs-bootfs") == 0)
+       {
+         cmd = CMD_ZFS_BOOTFS;
+         nparm = 0;
+       }
       else
        {
          fprintf (stderr, _("Invalid command %s.\n"), arg);