grub-devel
[Top][All Lists]
Advanced

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

[PROCFS 4/5] cryptodisk: Add header line of field names to (procfs)/luks


From: Glenn Washburn
Subject: [PROCFS 4/5] cryptodisk: Add header line of field names to (procfs)/luks_script
Date: Fri, 19 Mar 2021 18:17:45 -0500

Its not obvious from the grub shell, nor is it documented anywhere, what
the fields in each line of (procfs)/luks_script represent. This makes it
easier for the user to comprehend the meaning of fields directly from the
shell.

Signed-off-by: Glenn Washburn <development@efficientek.com>
---
 grub-core/disk/cryptodisk.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/grub-core/disk/cryptodisk.c b/grub-core/disk/cryptodisk.c
index be97dfab9..6b1d73fd3 100644
--- a/grub-core/disk/cryptodisk.c
+++ b/grub-core/disk/cryptodisk.c
@@ -1219,6 +1219,8 @@ luks_script_get (grub_size_t *sz)
   grub_cryptodisk_t i;
   grub_size_t size = 0;
   char *ptr, *ret;
+  const char header[] = N_("<type> <devname> <source disk> <uuid> <sector "
+                          "offset> <sector size> <cipher> <key> <options>\n");
   static char errmsg[] = N_("Can not list more than " STR(MAX_ID_PRINT)
                            " crypto devices.\n");
 
@@ -1246,11 +1248,11 @@ luks_script_get (grub_size_t *sz)
        size += i->keysize * 2;
       }
 
-  ret = grub_malloc (size + 1);
+  ret = grub_malloc (sizeof (header) + size + 1);
   if (!ret)
     return 0;
 
-  ptr = ret;
+  ptr = grub_stpcpy (ret, header);
 
   for (i = cryptodisk_list; i != NULL; i = i->next)
     if (grub_strcmp (i->modname, "luks") == 0 ||
-- 
2.27.0




reply via email to

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