mrc0mmand / rpms / libguestfs

Forked from rpms/libguestfs 3 years ago
Clone
Blob Blame History Raw
From 3afce3e84c79d7fbca4d6eeb76f237090c5528c9 Mon Sep 17 00:00:00 2001
From: Pino Toscano <ptoscano@redhat.com>
Date: Fri, 29 Nov 2019 12:06:20 +0100
Subject: [PATCH] options: rename key.device as key.id

In the future it will be also something else other than the device name.

(cherry picked from commit c863ee5e1df5e1eca7ad6821bd2db3796277a6bd
in libguestfs-common)

PT: the documentation was amended manually.
---
 cat/virt-cat.pod               | 7 ++++---
 cat/virt-log.pod               | 7 ++++---
 cat/virt-ls.pod                | 7 ++++---
 cat/virt-tail.pod              | 7 ++++---
 common/mltools/tools_utils-c.c | 4 ++--
 common/options/keys.c          | 8 ++++----
 common/options/options.h       | 8 +++++---
 customize/virt-customize.pod   | 7 ++++---
 diff/virt-diff.pod             | 7 ++++---
 edit/virt-edit.pod             | 7 ++++---
 fish/guestfish.pod             | 7 ++++---
 fuse/guestmount.pod            | 7 ++++---
 get-kernel/virt-get-kernel.pod | 7 ++++---
 inspector/virt-inspector.pod   | 7 ++++---
 sparsify/virt-sparsify.pod     | 7 ++++---
 sysprep/virt-sysprep.pod       | 7 ++++---
 v2v/virt-v2v.pod               | 7 ++++---
 17 files changed, 67 insertions(+), 51 deletions(-)

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