mrc0mmand / rpms / libguestfs

Forked from rpms/libguestfs 3 years ago
Clone

Blame SOURCES/0038-options-rename-key.device-as-key.id.patch

3efd08
From 3afce3e84c79d7fbca4d6eeb76f237090c5528c9 Mon Sep 17 00:00:00 2001
3efd08
From: Pino Toscano <ptoscano@redhat.com>
3efd08
Date: Fri, 29 Nov 2019 12:06:20 +0100
3efd08
Subject: [PATCH] options: rename key.device as key.id
3efd08
3efd08
In the future it will be also something else other than the device name.
3efd08
3efd08
(cherry picked from commit c863ee5e1df5e1eca7ad6821bd2db3796277a6bd
3efd08
in libguestfs-common)
3efd08
3efd08
PT: the documentation was amended manually.
3efd08
---
3efd08
 cat/virt-cat.pod               | 7 ++++---
3efd08
 cat/virt-log.pod               | 7 ++++---
3efd08
 cat/virt-ls.pod                | 7 ++++---
3efd08
 cat/virt-tail.pod              | 7 ++++---
3efd08
 common/mltools/tools_utils-c.c | 4 ++--
3efd08
 common/options/keys.c          | 8 ++++----
3efd08
 common/options/options.h       | 8 +++++---
3efd08
 customize/virt-customize.pod   | 7 ++++---
3efd08
 diff/virt-diff.pod             | 7 ++++---
3efd08
 edit/virt-edit.pod             | 7 ++++---
3efd08
 fish/guestfish.pod             | 7 ++++---
3efd08
 fuse/guestmount.pod            | 7 ++++---
3efd08
 get-kernel/virt-get-kernel.pod | 7 ++++---
3efd08
 inspector/virt-inspector.pod   | 7 ++++---
3efd08
 sparsify/virt-sparsify.pod     | 7 ++++---
3efd08
 sysprep/virt-sysprep.pod       | 7 ++++---
3efd08
 v2v/virt-v2v.pod               | 7 ++++---
3efd08
 17 files changed, 67 insertions(+), 51 deletions(-)
3efd08
3efd08
diff --git a/cat/virt-cat.pod b/cat/virt-cat.pod
3efd08
index 745d4a4b6..b0301d636 100644
3efd08
--- a/cat/virt-cat.pod
3efd08
+++ b/cat/virt-cat.pod
3efd08
@@ -124,15 +124,16 @@ security problem with malicious guests (CVE-2010-3851).
3efd08
 =item B<--key> SELECTOR
3efd08
 
3efd08
 Specify a key for LUKS, to automatically open a LUKS device when using
3efd08
-the inspection.  C<SELECTOR> can be in one of the following formats:
3efd08
+the inspection.  C<ID> must be the libguestfs device name of the LUKS
3efd08
+device.
3efd08
 
3efd08
 =over 4
3efd08
 
3efd08
-=item B<--key> C<DEVICE>:key:KEY_STRING
3efd08
+=item B<--key> C<ID>:key:KEY_STRING
3efd08
 
3efd08
 Use the specified C<KEY_STRING> as passphrase.
3efd08
 
3efd08
-=item B<--key> C<DEVICE>:file:FILENAME
3efd08
+=item B<--key> C<ID>:file:FILENAME
3efd08
 
3efd08
 Read the passphrase from F<FILENAME>.
3efd08
 
3efd08
diff --git a/cat/virt-log.pod b/cat/virt-log.pod
3efd08
index 8de000c5f..0d447b3b5 100644
3efd08
--- a/cat/virt-log.pod
3efd08
+++ b/cat/virt-log.pod
3efd08
@@ -108,15 +108,16 @@ security problem with malicious guests (CVE-2010-3851).
3efd08
 =item B<--key> SELECTOR
3efd08
 
3efd08
 Specify a key for LUKS, to automatically open a LUKS device when using
3efd08
-the inspection.  C<SELECTOR> can be in one of the following formats:
3efd08
+the inspection.  C<ID> must be the libguestfs device name of the LUKS
3efd08
+device.
3efd08
 
3efd08
 =over 4
3efd08
 
3efd08
-=item B<--key> C<DEVICE>:key:KEY_STRING
3efd08
+=item B<--key> C<ID>:key:KEY_STRING
3efd08
 
3efd08
 Use the specified C<KEY_STRING> as passphrase.
3efd08
 
3efd08
-=item B<--key> C<DEVICE>:file:FILENAME
3efd08
+=item B<--key> C<ID>:file:FILENAME
3efd08
 
3efd08
 Read the passphrase from F<FILENAME>.
3efd08
 
3efd08
diff --git a/cat/virt-ls.pod b/cat/virt-ls.pod
3efd08
index 8d6a9fe37..de02a473d 100644
3efd08
--- a/cat/virt-ls.pod
3efd08
+++ b/cat/virt-ls.pod
3efd08
@@ -355,15 +355,16 @@ L</RECURSIVE LONG LISTING> above.
3efd08
 =item B<--key> SELECTOR
3efd08
 
3efd08
 Specify a key for LUKS, to automatically open a LUKS device when using
3efd08
-the inspection.  C<SELECTOR> can be in one of the following formats:
3efd08
+the inspection.  C<ID> must be the libguestfs device name of the LUKS
3efd08
+device.
3efd08
 
3efd08
 =over 4
3efd08
 
3efd08
-=item B<--key> C<DEVICE>:key:KEY_STRING
3efd08
+=item B<--key> C<ID>:key:KEY_STRING
3efd08
 
3efd08
 Use the specified C<KEY_STRING> as passphrase.
3efd08
 
3efd08
-=item B<--key> C<DEVICE>:file:FILENAME
3efd08
+=item B<--key> C<ID>:file:FILENAME
3efd08
 
3efd08
 Read the passphrase from F<FILENAME>.
3efd08
 
3efd08
diff --git a/cat/virt-tail.pod b/cat/virt-tail.pod
3efd08
index cf8700d1a..f00384f5d 100644
3efd08
--- a/cat/virt-tail.pod
3efd08
+++ b/cat/virt-tail.pod
3efd08
@@ -126,15 +126,16 @@ security problem with malicious guests (CVE-2010-3851).
3efd08
 =item B<--key> SELECTOR
3efd08
 
3efd08
 Specify a key for LUKS, to automatically open a LUKS device when using
3efd08
-the inspection.  C<SELECTOR> can be in one of the following formats:
3efd08
+the inspection.  C<ID> must be the libguestfs device name of the LUKS
3efd08
+device.
3efd08
 
3efd08
 =over 4
3efd08
 
3efd08
-=item B<--key> C<DEVICE>:key:KEY_STRING
3efd08
+=item B<--key> C<ID>:key:KEY_STRING
3efd08
 
3efd08
 Use the specified C<KEY_STRING> as passphrase.
3efd08
 
3efd08
-=item B<--key> C<DEVICE>:file:FILENAME
3efd08
+=item B<--key> C<ID>:file:FILENAME
3efd08
 
3efd08
 Read the passphrase from F<FILENAME>.
3efd08
 
3efd08
diff --git a/common/mltools/tools_utils-c.c b/common/mltools/tools_utils-c.c
3efd08
index 3b80091c0..6c43b8d74 100644
3efd08
--- a/common/mltools/tools_utils-c.c
3efd08
+++ b/common/mltools/tools_utils-c.c
3efd08
@@ -57,8 +57,8 @@ guestfs_int_mllib_inspect_decrypt (value gv, value gpv, value keysv)
3efd08
     struct key_store_key key;
3efd08
 
3efd08
     elemv = Field (keysv, 0);
3efd08
-    key.device = strdup (String_val (Field (elemv, 0)));
3efd08
-    if (!key.device)
3efd08
+    key.id = strdup (String_val (Field (elemv, 0)));
3efd08
+    if (!key.id)
3efd08
       caml_raise_out_of_memory ();
3efd08
 
3efd08
     v = Field (elemv, 1);
3efd08
diff --git a/common/options/keys.c b/common/options/keys.c
3efd08
index 782bdb67f..7c391acde 100644
3efd08
--- a/common/options/keys.c
3efd08
+++ b/common/options/keys.c
3efd08
@@ -148,7 +148,7 @@ get_keys (struct key_store *ks, const char *device)
3efd08
     for (i = 0; i < ks->nr_keys; ++i) {
3efd08
       struct key_store_key *key = &ks->keys[i];
3efd08
 
3efd08
-      if (STRNEQ (key->device, device))
3efd08
+      if (STRNEQ (key->id, device))
3efd08
         continue;
3efd08
 
3efd08
       switch (key->type) {
3efd08
@@ -193,8 +193,8 @@ key_store_add_from_selector (struct key_store *ks, const char *selector)
3efd08
   }
3efd08
 
3efd08
   /* 1: device */
3efd08
-  key.device = strdup (fields[0]);
3efd08
-  if (!key.device)
3efd08
+  key.id = strdup (fields[0]);
3efd08
+  if (!key.id)
3efd08
     error (EXIT_FAILURE, errno, "strdup");
3efd08
 
3efd08
   /* 2: key type */
3efd08
@@ -265,6 +265,6 @@ free_key_store (struct key_store *ks)
3efd08
       free (key->file.name);
3efd08
       break;
3efd08
     }
3efd08
-    free (key->device);
3efd08
+    free (key->id);
3efd08
   }
3efd08
 }
3efd08
diff --git a/common/options/options.h b/common/options/options.h
3efd08
index 510e8a8a9..b83a92b06 100644
3efd08
--- a/common/options/options.h
3efd08
+++ b/common/options/options.h
3efd08
@@ -104,10 +104,12 @@ struct mp {
3efd08
 
3efd08
 /* A key in the key store. */
3efd08
 struct key_store_key {
3efd08
-  /* The device this key refers to.  There may be multiple matching
3efd08
-   * devices in the list.
3efd08
+  /* An ID for the device this key refers to.  It must be the libguestfs
3efd08
+   * device name.
3efd08
+   *
3efd08
+   * There may be multiple matching devices in the list.
3efd08
    */
3efd08
-  char *device;
3efd08
+  char *id;
3efd08
 
3efd08
   enum {
3efd08
     key_string,             /* key specified as string */
3efd08
diff --git a/customize/virt-customize.pod b/customize/virt-customize.pod
3efd08
index d1b568040..491606591 100644
3efd08
--- a/customize/virt-customize.pod
3efd08
+++ b/customize/virt-customize.pod
3efd08
@@ -141,15 +141,16 @@ security problem with malicious guests (CVE-2010-3851).
3efd08
 =item B<--key> SELECTOR
3efd08
 
3efd08
 Specify a key for LUKS, to automatically open a LUKS device when using
3efd08
-the inspection.  C<SELECTOR> can be in one of the following formats:
3efd08
+the inspection.  C<ID> must be the libguestfs device name of the LUKS
3efd08
+device.
3efd08
 
3efd08
 =over 4
3efd08
 
3efd08
-=item B<--key> C<DEVICE>:key:KEY_STRING
3efd08
+=item B<--key> C<ID>:key:KEY_STRING
3efd08
 
3efd08
 Use the specified C<KEY_STRING> as passphrase.
3efd08
 
3efd08
-=item B<--key> C<DEVICE>:file:FILENAME
3efd08
+=item B<--key> C<ID>:file:FILENAME
3efd08
 
3efd08
 Read the passphrase from F<FILENAME>.
3efd08
 
3efd08
diff --git a/diff/virt-diff.pod b/diff/virt-diff.pod
3efd08
index 36ee10ced..22658072d 100644
3efd08
--- a/diff/virt-diff.pod
3efd08
+++ b/diff/virt-diff.pod
3efd08
@@ -169,15 +169,16 @@ Display file sizes in human-readable format.
3efd08
 =item B<--key> SELECTOR
3efd08
 
3efd08
 Specify a key for LUKS, to automatically open a LUKS device when using
3efd08
-the inspection.  C<SELECTOR> can be in one of the following formats:
3efd08
+the inspection.  C<ID> must be the libguestfs device name of the LUKS
3efd08
+device.
3efd08
 
3efd08
 =over 4
3efd08
 
3efd08
-=item B<--key> C<DEVICE>:key:KEY_STRING
3efd08
+=item B<--key> C<ID>:key:KEY_STRING
3efd08
 
3efd08
 Use the specified C<KEY_STRING> as passphrase.
3efd08
 
3efd08
-=item B<--key> C<DEVICE>:file:FILENAME
3efd08
+=item B<--key> C<ID>:file:FILENAME
3efd08
 
3efd08
 Read the passphrase from F<FILENAME>.
3efd08
 
3efd08
diff --git a/edit/virt-edit.pod b/edit/virt-edit.pod
3efd08
index 3cb3ce6da..5a63cd05f 100644
3efd08
--- a/edit/virt-edit.pod
3efd08
+++ b/edit/virt-edit.pod
3efd08
@@ -156,15 +156,16 @@ security problem with malicious guests (CVE-2010-3851).
3efd08
 =item B<--key> SELECTOR
3efd08
 
3efd08
 Specify a key for LUKS, to automatically open a LUKS device when using
3efd08
-the inspection.  C<SELECTOR> can be in one of the following formats:
3efd08
+the inspection.  C<ID> must be the libguestfs device name of the LUKS
3efd08
+device.
3efd08
 
3efd08
 =over 4
3efd08
 
3efd08
-=item B<--key> C<DEVICE>:key:KEY_STRING
3efd08
+=item B<--key> C<ID>:key:KEY_STRING
3efd08
 
3efd08
 Use the specified C<KEY_STRING> as passphrase.
3efd08
 
3efd08
-=item B<--key> C<DEVICE>:file:FILENAME
3efd08
+=item B<--key> C<ID>:file:FILENAME
3efd08
 
3efd08
 Read the passphrase from F<FILENAME>.
3efd08
 
3efd08
diff --git a/fish/guestfish.pod b/fish/guestfish.pod
3efd08
index 06644c5b8..ccb57b159 100644
3efd08
--- a/fish/guestfish.pod
3efd08
+++ b/fish/guestfish.pod
3efd08
@@ -283,15 +283,16 @@ were found.
3efd08
 =item B<--key> SELECTOR
3efd08
 
3efd08
 Specify a key for LUKS, to automatically open a LUKS device when using
3efd08
-the inspection.  C<SELECTOR> can be in one of the following formats:
3efd08
+the inspection.  C<ID> must be the libguestfs device name of the LUKS
3efd08
+device.
3efd08
 
3efd08
 =over 4
3efd08
 
3efd08
-=item B<--key> C<DEVICE>:key:KEY_STRING
3efd08
+=item B<--key> C<ID>:key:KEY_STRING
3efd08
 
3efd08
 Use the specified C<KEY_STRING> as passphrase.
3efd08
 
3efd08
-=item B<--key> C<DEVICE>:file:FILENAME
3efd08
+=item B<--key> C<ID>:file:FILENAME
3efd08
 
3efd08
 Read the passphrase from F<FILENAME>.
3efd08
 
3efd08
diff --git a/fuse/guestmount.pod b/fuse/guestmount.pod
3efd08
index 9319d093c..d9e957b8b 100644
3efd08
--- a/fuse/guestmount.pod
3efd08
+++ b/fuse/guestmount.pod
3efd08
@@ -249,15 +249,16 @@ mounted on the real virtual machine.
3efd08
 =item B<--key> SELECTOR
3efd08
 
3efd08
 Specify a key for LUKS, to automatically open a LUKS device when using
3efd08
-the inspection.  C<SELECTOR> can be in one of the following formats:
3efd08
+the inspection.  C<ID> must be the libguestfs device name of the LUKS
3efd08
+device.
3efd08
 
3efd08
 =over 4
3efd08
 
3efd08
-=item B<--key> C<DEVICE>:key:KEY_STRING
3efd08
+=item B<--key> C<ID>:key:KEY_STRING
3efd08
 
3efd08
 Use the specified C<KEY_STRING> as passphrase.
3efd08
 
3efd08
-=item B<--key> C<DEVICE>:file:FILENAME
3efd08
+=item B<--key> C<ID>:file:FILENAME
3efd08
 
3efd08
 Read the passphrase from F<FILENAME>.
3efd08
 
3efd08
diff --git a/get-kernel/virt-get-kernel.pod b/get-kernel/virt-get-kernel.pod
3efd08
index 3802412e2..f0ace2d6d 100644
3efd08
--- a/get-kernel/virt-get-kernel.pod
3efd08
+++ b/get-kernel/virt-get-kernel.pod
3efd08
@@ -92,15 +92,16 @@ security problem with malicious guests (CVE-2010-3851).
3efd08
 =item B<--key> SELECTOR
3efd08
 
3efd08
 Specify a key for LUKS, to automatically open a LUKS device when using
3efd08
-the inspection.  C<SELECTOR> can be in one of the following formats:
3efd08
+the inspection.  C<ID> must be the libguestfs device name of the LUKS
3efd08
+device.
3efd08
 
3efd08
 =over 4
3efd08
 
3efd08
-=item B<--key> C<DEVICE>:key:KEY_STRING
3efd08
+=item B<--key> C<ID>:key:KEY_STRING
3efd08
 
3efd08
 Use the specified C<KEY_STRING> as passphrase.
3efd08
 
3efd08
-=item B<--key> C<DEVICE>:file:FILENAME
3efd08
+=item B<--key> C<ID>:file:FILENAME
3efd08
 
3efd08
 Read the passphrase from F<FILENAME>.
3efd08
 
3efd08
diff --git a/inspector/virt-inspector.pod b/inspector/virt-inspector.pod
3efd08
index 98b278f26..eac9dc3cd 100644
3efd08
--- a/inspector/virt-inspector.pod
3efd08
+++ b/inspector/virt-inspector.pod
3efd08
@@ -117,15 +117,16 @@ ensure the format is always specified.
3efd08
 =item B<--key> SELECTOR
3efd08
 
3efd08
 Specify a key for LUKS, to automatically open a LUKS device when using
3efd08
-the inspection.  C<SELECTOR> can be in one of the following formats:
3efd08
+the inspection.  C<ID> must be the libguestfs device name of the LUKS
3efd08
+device.
3efd08
 
3efd08
 =over 4
3efd08
 
3efd08
-=item B<--key> C<DEVICE>:key:KEY_STRING
3efd08
+=item B<--key> C<ID>:key:KEY_STRING
3efd08
 
3efd08
 Use the specified C<KEY_STRING> as passphrase.
3efd08
 
3efd08
-=item B<--key> C<DEVICE>:file:FILENAME
3efd08
+=item B<--key> C<ID>:file:FILENAME
3efd08
 
3efd08
 Read the passphrase from F<FILENAME>.
3efd08
 
3efd08
diff --git a/sparsify/virt-sparsify.pod b/sparsify/virt-sparsify.pod
3efd08
index 3f5f9995f..cf7970a5f 100644
3efd08
--- a/sparsify/virt-sparsify.pod
3efd08
+++ b/sparsify/virt-sparsify.pod
3efd08
@@ -233,15 +233,16 @@ See L</IN-PLACE SPARSIFICATION> below.
3efd08
 =item B<--key> SELECTOR
3efd08
 
3efd08
 Specify a key for LUKS, to automatically open a LUKS device when using
3efd08
-the inspection.  C<SELECTOR> can be in one of the following formats:
3efd08
+the inspection.  C<ID> must be the libguestfs device name of the LUKS
3efd08
+device.
3efd08
 
3efd08
 =over 4
3efd08
 
3efd08
-=item B<--key> C<DEVICE>:key:KEY_STRING
3efd08
+=item B<--key> C<ID>:key:KEY_STRING
3efd08
 
3efd08
 Use the specified C<KEY_STRING> as passphrase.
3efd08
 
3efd08
-=item B<--key> C<DEVICE>:file:FILENAME
3efd08
+=item B<--key> C<ID>:file:FILENAME
3efd08
 
3efd08
 Read the passphrase from F<FILENAME>.
3efd08
 
3efd08
diff --git a/sysprep/virt-sysprep.pod b/sysprep/virt-sysprep.pod
3efd08
index 8d248db94..d7ad7ee33 100644
3efd08
--- a/sysprep/virt-sysprep.pod
3efd08
+++ b/sysprep/virt-sysprep.pod
3efd08
@@ -189,15 +189,16 @@ security problem with malicious guests (CVE-2010-3851).
3efd08
 =item B<--key> SELECTOR
3efd08
 
3efd08
 Specify a key for LUKS, to automatically open a LUKS device when using
3efd08
-the inspection.  C<SELECTOR> can be in one of the following formats:
3efd08
+the inspection.  C<ID> must be the libguestfs device name of the LUKS
3efd08
+device.
3efd08
 
3efd08
 =over 4
3efd08
 
3efd08
-=item B<--key> C<DEVICE>:key:KEY_STRING
3efd08
+=item B<--key> C<ID>:key:KEY_STRING
3efd08
 
3efd08
 Use the specified C<KEY_STRING> as passphrase.
3efd08
 
3efd08
-=item B<--key> C<DEVICE>:file:FILENAME
3efd08
+=item B<--key> C<ID>:file:FILENAME
3efd08
 
3efd08
 Read the passphrase from F<FILENAME>.
3efd08
 
3efd08
diff --git a/v2v/virt-v2v.pod b/v2v/virt-v2v.pod
3efd08
index 0642d158f..8c2867814 100644
3efd08
--- a/v2v/virt-v2v.pod
3efd08
+++ b/v2v/virt-v2v.pod
3efd08
@@ -337,15 +337,16 @@ through VDDK.
3efd08
 =item B<--key> SELECTOR
3efd08
 
3efd08
 Specify a key for LUKS, to automatically open a LUKS device when using
3efd08
-the inspection.  C<SELECTOR> can be in one of the following formats:
3efd08
+the inspection.  C<ID> must be the libguestfs device name of the LUKS
3efd08
+device.
3efd08
 
3efd08
 =over 4
3efd08
 
3efd08
-=item B<--key> C<DEVICE>:key:KEY_STRING
3efd08
+=item B<--key> C<ID>:key:KEY_STRING
3efd08
 
3efd08
 Use the specified C<KEY_STRING> as passphrase.
3efd08
 
3efd08
-=item B<--key> C<DEVICE>:file:FILENAME
3efd08
+=item B<--key> C<ID>:file:FILENAME
3efd08
 
3efd08
 Read the passphrase from F<FILENAME>.
3efd08
 
3efd08
-- 
3efd08
2.25.4
3efd08