grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/2] Support qcow in grub-fstest


From: Vladimir Serbinenko
Subject: [PATCH 2/2] Support qcow in grub-fstest
Date: Thu, 16 May 2024 21:57:48 +0300

Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com>
---
 util/grub-fstest.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/util/grub-fstest.c b/util/grub-fstest.c
index 7ff9037b8..3c4fa26c6 100644
--- a/util/grub-fstest.c
+++ b/util/grub-fstest.c
@@ -383,12 +383,14 @@ static int cmd = 0;
 static char *debug_str = NULL;
 static char **args = NULL;
 static int mount_crypt = 0;
+static int mount_qcow = 0;
 
 static void
 fstest (int n)
 {
   char *host_file;
   char *loop_name;
+  const char *loopback_cmd = mount_qcow ? "qcow" : "loopback";
   int i;
 
   for (i = 0; i < num_disks; i++)
@@ -405,8 +407,8 @@ fstest (int n)
       argv[0] = loop_name;
       argv[1] = host_file;
 
-      if (execute_command ("loopback", 2, argv))
-        grub_util_error (_("`loopback' command fails: %s"), grub_errmsg);
+      if (execute_command (loopback_cmd, 2, argv))
+        grub_util_error (_("`%s' command fails: %s"), loopback_cmd, 
grub_errmsg);
 
       grub_free (loop_name);
       grub_free (host_file);
@@ -530,6 +532,7 @@ static struct argp_option options[] = {
   {"diskcount", 'c', N_("NUM"),           0, N_("Specify the number of input 
files."),                   2},
   {"debug",     'd', N_("STRING"),           0, N_("Set debug environment 
variable."),  2},
   {"crypto",   'C', NULL, 0, N_("Mount crypto devices."), 2},
+  {"qcow",      'q', NULL, 0, N_("Mount qcow images."), 2},
   {"zfs-key",      'K',
    /* TRANSLATORS: "prompt" is a keyword.  */
    N_("FILE|prompt"), 0, N_("Load zfs crypto key."),                 2},
@@ -597,6 +600,10 @@ argp_parser (int key, char *arg, struct argp_state *state)
       mount_crypt = 1;
       return 0;
 
+    case 'q':
+      mount_qcow = 1;
+      return 0;
+
     case 's':
       skip = grub_strtoul (arg, &p, 0);
       if (*p == 's')
-- 
2.39.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]