mrc0mmand / rpms / libguestfs

Forked from rpms/libguestfs 3 years ago
Clone

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

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