[libvirt PATCH v2 1/9] util: remove unused virStorageGenerateQcowPassphrase

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

 



The last user was removed by commit
<40f0e0348dfc84f28a500e262c4953b0d3b44fa0>.

Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
Reviewed-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/libvirt_private.syms        |  1 -
 src/util/virstorageencryption.c | 34 ---------------------------------
 src/util/virstorageencryption.h |  2 --
 3 files changed, 37 deletions(-)

diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 583fc5800e..d7714361d3 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -3118,7 +3118,6 @@ virSocketAddrSetPort;
 virStorageEncryptionFormat;
 virStorageEncryptionFree;
 virStorageEncryptionParseNode;
-virStorageGenerateQcowPassphrase;
 
 
 # util/virstoragefile.h
diff --git a/src/util/virstorageencryption.c b/src/util/virstorageencryption.c
index a330b79637..c893f0babe 100644
--- a/src/util/virstorageencryption.c
+++ b/src/util/virstorageencryption.c
@@ -364,37 +364,3 @@ virStorageEncryptionFormat(virBufferPtr buf,
 
     return 0;
 }
-
-int
-virStorageGenerateQcowPassphrase(unsigned char *dest)
-{
-    int fd;
-    size_t i;
-
-    /* A qcow passphrase is up to 16 bytes, with any data following a NUL
-       ignored.  Prohibit control and non-ASCII characters to avoid possible
-       unpleasant surprises with the qemu monitor input mechanism. */
-    fd = open("/dev/urandom", O_RDONLY);
-    if (fd < 0) {
-        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                       _("Cannot open /dev/urandom"));
-        return -1;
-    }
-    i = 0;
-    while (i < VIR_STORAGE_QCOW_PASSPHRASE_SIZE) {
-        ssize_t r;
-
-        while ((r = read(fd, dest + i, 1)) == -1 && errno == EINTR)
-            ;
-        if (r <= 0) {
-            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                           _("Cannot read from /dev/urandom"));
-            VIR_FORCE_CLOSE(fd);
-            return -1;
-        }
-        if (dest[i] >= 0x20 && dest[i] <= 0x7E)
-            i++; /* Got an acceptable character */
-    }
-    VIR_FORCE_CLOSE(fd);
-    return 0;
-}
diff --git a/src/util/virstorageencryption.h b/src/util/virstorageencryption.h
index 05a7bffdfc..352dd373d6 100644
--- a/src/util/virstorageencryption.h
+++ b/src/util/virstorageencryption.h
@@ -90,5 +90,3 @@ int virStorageEncryptionFormat(virBufferPtr buf,
 enum {
   VIR_STORAGE_QCOW_PASSPHRASE_SIZE = 16
 };
-
-int virStorageGenerateQcowPassphrase(unsigned char *dest);
-- 
2.29.2




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux