From 0ab9eb1aec7e70c37ce75be210f8ef76932fd444 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Aug 06 2019 12:56:40 +0000 Subject: import nbdkit-1.8.0-1.el7 --- diff --git a/.gitignore b/.gitignore index 7c39d2a..7e054dd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ SOURCES/libguestfs.keyring -SOURCES/nbdkit-1.2.6.tar.gz +SOURCES/nbdkit-1.8.0.tar.gz diff --git a/.nbdkit.metadata b/.nbdkit.metadata index d0870cf..48f7ac4 100644 --- a/.nbdkit.metadata +++ b/.nbdkit.metadata @@ -1,2 +1,2 @@ 1bbc40f501a7fef9eef2a39b701a71aee2fea7c4 SOURCES/libguestfs.keyring -d5bc6e56b35c971ddec17b2abab5ba1d94a9b7a5 SOURCES/nbdkit-1.2.6.tar.gz +32c12f1563d2d00b186a9e65e9012324a46d3c81 SOURCES/nbdkit-1.8.0.tar.gz diff --git a/SOURCES/0001-partitioning-Rename-crc32-to-efi_crc32-to-avoid-conf.patch b/SOURCES/0001-partitioning-Rename-crc32-to-efi_crc32-to-avoid-conf.patch new file mode 100644 index 0000000..0fcfa60 --- /dev/null +++ b/SOURCES/0001-partitioning-Rename-crc32-to-efi_crc32-to-avoid-conf.patch @@ -0,0 +1,461 @@ +From 8538ef6a2caabe2b261903859754af32e4239346 Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Tue, 13 Nov 2018 10:54:06 +0000 +Subject: [PATCH] partitioning: Rename crc32 to efi_crc32 to avoid conflict + with zlib. + +zlib exports a symbol called crc32, which is also the name of our +EFI-specific CRC calculation function. As a result if we link nbdkit +or the plugin with zlib (even indirectly) then we may end up using the +zlib symbol, which causes a segmentation fault. Renaming our function +avoids this. I also renamed the source files to make the name less +generic, since this function really only works for EFI CRCs, not for +general CRCs. + +This only affects RHEL 7. I believe that's because Fedora uses a flag +such as --as-needed or similar. + +(cherry picked from commit fc789b9c3a9d0b6b4b0ae63a08ea34a70e0ea8db) +--- + plugins/partitioning/Makefile.am | 4 +- + plugins/partitioning/crc32.c | 140 ----------------------------------- + plugins/partitioning/crc32.h | 41 ---------- + plugins/partitioning/efi-crc32.c | 140 +++++++++++++++++++++++++++++++++++ + plugins/partitioning/efi-crc32.h | 41 ++++++++++ + plugins/partitioning/partition-gpt.c | 6 +- + 6 files changed, 186 insertions(+), 186 deletions(-) + delete mode 100644 plugins/partitioning/crc32.c + delete mode 100644 plugins/partitioning/crc32.h + create mode 100644 plugins/partitioning/efi-crc32.c + create mode 100644 plugins/partitioning/efi-crc32.h + +diff --git a/plugins/partitioning/Makefile.am b/plugins/partitioning/Makefile.am +index bc768be..8519bda 100644 +--- a/plugins/partitioning/Makefile.am ++++ b/plugins/partitioning/Makefile.am +@@ -37,8 +37,8 @@ EXTRA_DIST = nbdkit-partitioning-plugin.pod + plugin_LTLIBRARIES = nbdkit-partitioning-plugin.la + + nbdkit_partitioning_plugin_la_SOURCES = \ +- crc32.c \ +- crc32.h \ ++ efi-crc32.c \ ++ efi-crc32.h \ + partitioning.c \ + partition-gpt.c \ + partition-mbr.c \ +diff --git a/plugins/partitioning/crc32.c b/plugins/partitioning/crc32.c +deleted file mode 100644 +index e707a50..0000000 +--- a/plugins/partitioning/crc32.c ++++ /dev/null +@@ -1,140 +0,0 @@ +-/* This code was taken from parted and indirectly from other sources +- * as you can see from the messages below. The license is compatible +- * with the permissive license used in nbdkit. - RWMJ 2018-09-16 +- */ +- +-/* +- * Dec 5, 2000 Matt Domsch +- * - Copied crc32.c from the linux/drivers/net/cipe directory. +- * - Now pass seed as an arg +- * - changed unsigned long to uint32_t, added #include +- * - changed len to be an unsigned long +- * - changed crc32val to be a register +- * - License remains unchanged! It's still GPL-compatable! +- */ +- +- /* ============================================================= */ +- /* COPYRIGHT (C) 1986 Gary S. Brown. You may use this program, or */ +- /* code or tables extracted from it, as desired without restriction. */ +- /* */ +- /* First, the polynomial itself and its table of feedback terms. The */ +- /* polynomial is */ +- /* X^32+X^26+X^23+X^22+X^16+X^12+X^11+X^10+X^8+X^7+X^5+X^4+X^2+X^1+X^0 */ +- /* */ +- /* Note that we take it "backwards" and put the highest-order term in */ +- /* the lowest-order bit. The X^32 term is "implied"; the LSB is the */ +- /* X^31 term, etc. The X^0 term (usually shown as "+1") results in */ +- /* the MSB being 1. */ +- /* */ +- /* Note that the usual hardware shift register implementation, which */ +- /* is what we're using (we're merely optimizing it by doing eight-bit */ +- /* chunks at a time) shifts bits into the lowest-order term. In our */ +- /* implementation, that means shifting towards the right. Why do we */ +- /* do it this way? Because the calculated CRC must be transmitted in */ +- /* order from highest-order term to lowest-order term. UARTs transmit */ +- /* characters in order from LSB to MSB. By storing the CRC this way, */ +- /* we hand it to the UART in the order low-byte to high-byte; the UART */ +- /* sends each low-bit to hight-bit; and the result is transmission bit */ +- /* by bit from highest- to lowest-order term without requiring any bit */ +- /* shuffling on our part. Reception works similarly. */ +- /* */ +- /* The feedback terms table consists of 256, 32-bit entries. Notes: */ +- /* */ +- /* The table can be generated at runtime if desired; code to do so */ +- /* is shown later. It might not be obvious, but the feedback */ +- /* terms simply represent the results of eight shift/xor opera- */ +- /* tions for all combinations of data and CRC register values. */ +- /* */ +- /* The values must be right-shifted by eight bits by the "updcrc" */ +- /* logic; the shift must be unsigned (bring in zeroes). On some */ +- /* hardware you could probably optimize the shift in assembler by */ +- /* using byte-swap instructions. */ +- /* polynomial $edb88320 */ +- /* */ +- /* -------------------------------------------------------------------- */ +- +-#include +- +-#include +-#include +- +-#include "crc32.h" +- +-static const uint32_t crc32_tab[] = { +- 0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L, +- 0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L, +- 0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L, +- 0x90bf1d91L, 0x1db71064L, 0x6ab020f2L, 0xf3b97148L, 0x84be41deL, +- 0x1adad47dL, 0x6ddde4ebL, 0xf4d4b551L, 0x83d385c7L, 0x136c9856L, +- 0x646ba8c0L, 0xfd62f97aL, 0x8a65c9ecL, 0x14015c4fL, 0x63066cd9L, +- 0xfa0f3d63L, 0x8d080df5L, 0x3b6e20c8L, 0x4c69105eL, 0xd56041e4L, +- 0xa2677172L, 0x3c03e4d1L, 0x4b04d447L, 0xd20d85fdL, 0xa50ab56bL, +- 0x35b5a8faL, 0x42b2986cL, 0xdbbbc9d6L, 0xacbcf940L, 0x32d86ce3L, +- 0x45df5c75L, 0xdcd60dcfL, 0xabd13d59L, 0x26d930acL, 0x51de003aL, +- 0xc8d75180L, 0xbfd06116L, 0x21b4f4b5L, 0x56b3c423L, 0xcfba9599L, +- 0xb8bda50fL, 0x2802b89eL, 0x5f058808L, 0xc60cd9b2L, 0xb10be924L, +- 0x2f6f7c87L, 0x58684c11L, 0xc1611dabL, 0xb6662d3dL, 0x76dc4190L, +- 0x01db7106L, 0x98d220bcL, 0xefd5102aL, 0x71b18589L, 0x06b6b51fL, +- 0x9fbfe4a5L, 0xe8b8d433L, 0x7807c9a2L, 0x0f00f934L, 0x9609a88eL, +- 0xe10e9818L, 0x7f6a0dbbL, 0x086d3d2dL, 0x91646c97L, 0xe6635c01L, +- 0x6b6b51f4L, 0x1c6c6162L, 0x856530d8L, 0xf262004eL, 0x6c0695edL, +- 0x1b01a57bL, 0x8208f4c1L, 0xf50fc457L, 0x65b0d9c6L, 0x12b7e950L, +- 0x8bbeb8eaL, 0xfcb9887cL, 0x62dd1ddfL, 0x15da2d49L, 0x8cd37cf3L, +- 0xfbd44c65L, 0x4db26158L, 0x3ab551ceL, 0xa3bc0074L, 0xd4bb30e2L, +- 0x4adfa541L, 0x3dd895d7L, 0xa4d1c46dL, 0xd3d6f4fbL, 0x4369e96aL, +- 0x346ed9fcL, 0xad678846L, 0xda60b8d0L, 0x44042d73L, 0x33031de5L, +- 0xaa0a4c5fL, 0xdd0d7cc9L, 0x5005713cL, 0x270241aaL, 0xbe0b1010L, +- 0xc90c2086L, 0x5768b525L, 0x206f85b3L, 0xb966d409L, 0xce61e49fL, +- 0x5edef90eL, 0x29d9c998L, 0xb0d09822L, 0xc7d7a8b4L, 0x59b33d17L, +- 0x2eb40d81L, 0xb7bd5c3bL, 0xc0ba6cadL, 0xedb88320L, 0x9abfb3b6L, +- 0x03b6e20cL, 0x74b1d29aL, 0xead54739L, 0x9dd277afL, 0x04db2615L, +- 0x73dc1683L, 0xe3630b12L, 0x94643b84L, 0x0d6d6a3eL, 0x7a6a5aa8L, +- 0xe40ecf0bL, 0x9309ff9dL, 0x0a00ae27L, 0x7d079eb1L, 0xf00f9344L, +- 0x8708a3d2L, 0x1e01f268L, 0x6906c2feL, 0xf762575dL, 0x806567cbL, +- 0x196c3671L, 0x6e6b06e7L, 0xfed41b76L, 0x89d32be0L, 0x10da7a5aL, +- 0x67dd4accL, 0xf9b9df6fL, 0x8ebeeff9L, 0x17b7be43L, 0x60b08ed5L, +- 0xd6d6a3e8L, 0xa1d1937eL, 0x38d8c2c4L, 0x4fdff252L, 0xd1bb67f1L, +- 0xa6bc5767L, 0x3fb506ddL, 0x48b2364bL, 0xd80d2bdaL, 0xaf0a1b4cL, +- 0x36034af6L, 0x41047a60L, 0xdf60efc3L, 0xa867df55L, 0x316e8eefL, +- 0x4669be79L, 0xcb61b38cL, 0xbc66831aL, 0x256fd2a0L, 0x5268e236L, +- 0xcc0c7795L, 0xbb0b4703L, 0x220216b9L, 0x5505262fL, 0xc5ba3bbeL, +- 0xb2bd0b28L, 0x2bb45a92L, 0x5cb36a04L, 0xc2d7ffa7L, 0xb5d0cf31L, +- 0x2cd99e8bL, 0x5bdeae1dL, 0x9b64c2b0L, 0xec63f226L, 0x756aa39cL, +- 0x026d930aL, 0x9c0906a9L, 0xeb0e363fL, 0x72076785L, 0x05005713L, +- 0x95bf4a82L, 0xe2b87a14L, 0x7bb12baeL, 0x0cb61b38L, 0x92d28e9bL, +- 0xe5d5be0dL, 0x7cdcefb7L, 0x0bdbdf21L, 0x86d3d2d4L, 0xf1d4e242L, +- 0x68ddb3f8L, 0x1fda836eL, 0x81be16cdL, 0xf6b9265bL, 0x6fb077e1L, +- 0x18b74777L, 0x88085ae6L, 0xff0f6a70L, 0x66063bcaL, 0x11010b5cL, +- 0x8f659effL, 0xf862ae69L, 0x616bffd3L, 0x166ccf45L, 0xa00ae278L, +- 0xd70dd2eeL, 0x4e048354L, 0x3903b3c2L, 0xa7672661L, 0xd06016f7L, +- 0x4969474dL, 0x3e6e77dbL, 0xaed16a4aL, 0xd9d65adcL, 0x40df0b66L, +- 0x37d83bf0L, 0xa9bcae53L, 0xdebb9ec5L, 0x47b2cf7fL, 0x30b5ffe9L, +- 0xbdbdf21cL, 0xcabac28aL, 0x53b39330L, 0x24b4a3a6L, 0xbad03605L, +- 0xcdd70693L, 0x54de5729L, 0x23d967bfL, 0xb3667a2eL, 0xc4614ab8L, +- 0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL, +- 0x2d02ef8dL +- }; +- +-/* Return a 32-bit CRC of the contents of the buffer. */ +- +-static uint32_t +-efi_crc32 (const void *buf, size_t len, uint32_t seed) +-{ +- size_t i; +- uint32_t crc32val; +- const unsigned char *s = buf; +- +- crc32val = seed; +- for (i = 0; i < len; i++) { +- crc32val = +- crc32_tab[(crc32val ^ s[i]) & 0xff] ^ +- (crc32val >> 8); +- } +- return crc32val; +-} +- +-uint32_t +-crc32 (const void *buf, size_t len) +-{ +- return efi_crc32 (buf, len, ~0L) ^ ~0L; +-} +diff --git a/plugins/partitioning/crc32.h b/plugins/partitioning/crc32.h +deleted file mode 100644 +index 6bd5d2d..0000000 +--- a/plugins/partitioning/crc32.h ++++ /dev/null +@@ -1,41 +0,0 @@ +-/* nbdkit +- * Copyright (C) 2018 Red Hat Inc. +- * All rights reserved. +- * +- * Redistribution and use in source and binary forms, with or without +- * modification, are permitted provided that the following conditions are +- * met: +- * +- * * Redistributions of source code must retain the above copyright +- * notice, this list of conditions and the following disclaimer. +- * +- * * Redistributions in binary form must reproduce the above copyright +- * notice, this list of conditions and the following disclaimer in the +- * documentation and/or other materials provided with the distribution. +- * +- * * Neither the name of Red Hat nor the names of its contributors may be +- * used to endorse or promote products derived from this software without +- * specific prior written permission. +- * +- * THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND +- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +- * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR +- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +- * SUCH DAMAGE. +- */ +- +-#ifndef NBDKIT_CRC32_H +-#define NBDKIT_CRC32_H +- +-#include +- +-extern uint32_t crc32 (const void *buf, size_t len); +- +-#endif /* NBDKIT_CRC32_H */ +diff --git a/plugins/partitioning/efi-crc32.c b/plugins/partitioning/efi-crc32.c +new file mode 100644 +index 0000000..2b080d3 +--- /dev/null ++++ b/plugins/partitioning/efi-crc32.c +@@ -0,0 +1,140 @@ ++/* This code was taken from parted and indirectly from other sources ++ * as you can see from the messages below. The license is compatible ++ * with the permissive license used in nbdkit. - RWMJ 2018-09-16 ++ */ ++ ++/* ++ * Dec 5, 2000 Matt Domsch ++ * - Copied crc32.c from the linux/drivers/net/cipe directory. ++ * - Now pass seed as an arg ++ * - changed unsigned long to uint32_t, added #include ++ * - changed len to be an unsigned long ++ * - changed crc32val to be a register ++ * - License remains unchanged! It's still GPL-compatable! ++ */ ++ ++ /* ============================================================= */ ++ /* COPYRIGHT (C) 1986 Gary S. Brown. You may use this program, or */ ++ /* code or tables extracted from it, as desired without restriction. */ ++ /* */ ++ /* First, the polynomial itself and its table of feedback terms. The */ ++ /* polynomial is */ ++ /* X^32+X^26+X^23+X^22+X^16+X^12+X^11+X^10+X^8+X^7+X^5+X^4+X^2+X^1+X^0 */ ++ /* */ ++ /* Note that we take it "backwards" and put the highest-order term in */ ++ /* the lowest-order bit. The X^32 term is "implied"; the LSB is the */ ++ /* X^31 term, etc. The X^0 term (usually shown as "+1") results in */ ++ /* the MSB being 1. */ ++ /* */ ++ /* Note that the usual hardware shift register implementation, which */ ++ /* is what we're using (we're merely optimizing it by doing eight-bit */ ++ /* chunks at a time) shifts bits into the lowest-order term. In our */ ++ /* implementation, that means shifting towards the right. Why do we */ ++ /* do it this way? Because the calculated CRC must be transmitted in */ ++ /* order from highest-order term to lowest-order term. UARTs transmit */ ++ /* characters in order from LSB to MSB. By storing the CRC this way, */ ++ /* we hand it to the UART in the order low-byte to high-byte; the UART */ ++ /* sends each low-bit to hight-bit; and the result is transmission bit */ ++ /* by bit from highest- to lowest-order term without requiring any bit */ ++ /* shuffling on our part. Reception works similarly. */ ++ /* */ ++ /* The feedback terms table consists of 256, 32-bit entries. Notes: */ ++ /* */ ++ /* The table can be generated at runtime if desired; code to do so */ ++ /* is shown later. It might not be obvious, but the feedback */ ++ /* terms simply represent the results of eight shift/xor opera- */ ++ /* tions for all combinations of data and CRC register values. */ ++ /* */ ++ /* The values must be right-shifted by eight bits by the "updcrc" */ ++ /* logic; the shift must be unsigned (bring in zeroes). On some */ ++ /* hardware you could probably optimize the shift in assembler by */ ++ /* using byte-swap instructions. */ ++ /* polynomial $edb88320 */ ++ /* */ ++ /* -------------------------------------------------------------------- */ ++ ++#include ++ ++#include ++#include ++ ++#include "efi-crc32.h" ++ ++static const uint32_t crc32_tab[] = { ++ 0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L, ++ 0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L, ++ 0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L, ++ 0x90bf1d91L, 0x1db71064L, 0x6ab020f2L, 0xf3b97148L, 0x84be41deL, ++ 0x1adad47dL, 0x6ddde4ebL, 0xf4d4b551L, 0x83d385c7L, 0x136c9856L, ++ 0x646ba8c0L, 0xfd62f97aL, 0x8a65c9ecL, 0x14015c4fL, 0x63066cd9L, ++ 0xfa0f3d63L, 0x8d080df5L, 0x3b6e20c8L, 0x4c69105eL, 0xd56041e4L, ++ 0xa2677172L, 0x3c03e4d1L, 0x4b04d447L, 0xd20d85fdL, 0xa50ab56bL, ++ 0x35b5a8faL, 0x42b2986cL, 0xdbbbc9d6L, 0xacbcf940L, 0x32d86ce3L, ++ 0x45df5c75L, 0xdcd60dcfL, 0xabd13d59L, 0x26d930acL, 0x51de003aL, ++ 0xc8d75180L, 0xbfd06116L, 0x21b4f4b5L, 0x56b3c423L, 0xcfba9599L, ++ 0xb8bda50fL, 0x2802b89eL, 0x5f058808L, 0xc60cd9b2L, 0xb10be924L, ++ 0x2f6f7c87L, 0x58684c11L, 0xc1611dabL, 0xb6662d3dL, 0x76dc4190L, ++ 0x01db7106L, 0x98d220bcL, 0xefd5102aL, 0x71b18589L, 0x06b6b51fL, ++ 0x9fbfe4a5L, 0xe8b8d433L, 0x7807c9a2L, 0x0f00f934L, 0x9609a88eL, ++ 0xe10e9818L, 0x7f6a0dbbL, 0x086d3d2dL, 0x91646c97L, 0xe6635c01L, ++ 0x6b6b51f4L, 0x1c6c6162L, 0x856530d8L, 0xf262004eL, 0x6c0695edL, ++ 0x1b01a57bL, 0x8208f4c1L, 0xf50fc457L, 0x65b0d9c6L, 0x12b7e950L, ++ 0x8bbeb8eaL, 0xfcb9887cL, 0x62dd1ddfL, 0x15da2d49L, 0x8cd37cf3L, ++ 0xfbd44c65L, 0x4db26158L, 0x3ab551ceL, 0xa3bc0074L, 0xd4bb30e2L, ++ 0x4adfa541L, 0x3dd895d7L, 0xa4d1c46dL, 0xd3d6f4fbL, 0x4369e96aL, ++ 0x346ed9fcL, 0xad678846L, 0xda60b8d0L, 0x44042d73L, 0x33031de5L, ++ 0xaa0a4c5fL, 0xdd0d7cc9L, 0x5005713cL, 0x270241aaL, 0xbe0b1010L, ++ 0xc90c2086L, 0x5768b525L, 0x206f85b3L, 0xb966d409L, 0xce61e49fL, ++ 0x5edef90eL, 0x29d9c998L, 0xb0d09822L, 0xc7d7a8b4L, 0x59b33d17L, ++ 0x2eb40d81L, 0xb7bd5c3bL, 0xc0ba6cadL, 0xedb88320L, 0x9abfb3b6L, ++ 0x03b6e20cL, 0x74b1d29aL, 0xead54739L, 0x9dd277afL, 0x04db2615L, ++ 0x73dc1683L, 0xe3630b12L, 0x94643b84L, 0x0d6d6a3eL, 0x7a6a5aa8L, ++ 0xe40ecf0bL, 0x9309ff9dL, 0x0a00ae27L, 0x7d079eb1L, 0xf00f9344L, ++ 0x8708a3d2L, 0x1e01f268L, 0x6906c2feL, 0xf762575dL, 0x806567cbL, ++ 0x196c3671L, 0x6e6b06e7L, 0xfed41b76L, 0x89d32be0L, 0x10da7a5aL, ++ 0x67dd4accL, 0xf9b9df6fL, 0x8ebeeff9L, 0x17b7be43L, 0x60b08ed5L, ++ 0xd6d6a3e8L, 0xa1d1937eL, 0x38d8c2c4L, 0x4fdff252L, 0xd1bb67f1L, ++ 0xa6bc5767L, 0x3fb506ddL, 0x48b2364bL, 0xd80d2bdaL, 0xaf0a1b4cL, ++ 0x36034af6L, 0x41047a60L, 0xdf60efc3L, 0xa867df55L, 0x316e8eefL, ++ 0x4669be79L, 0xcb61b38cL, 0xbc66831aL, 0x256fd2a0L, 0x5268e236L, ++ 0xcc0c7795L, 0xbb0b4703L, 0x220216b9L, 0x5505262fL, 0xc5ba3bbeL, ++ 0xb2bd0b28L, 0x2bb45a92L, 0x5cb36a04L, 0xc2d7ffa7L, 0xb5d0cf31L, ++ 0x2cd99e8bL, 0x5bdeae1dL, 0x9b64c2b0L, 0xec63f226L, 0x756aa39cL, ++ 0x026d930aL, 0x9c0906a9L, 0xeb0e363fL, 0x72076785L, 0x05005713L, ++ 0x95bf4a82L, 0xe2b87a14L, 0x7bb12baeL, 0x0cb61b38L, 0x92d28e9bL, ++ 0xe5d5be0dL, 0x7cdcefb7L, 0x0bdbdf21L, 0x86d3d2d4L, 0xf1d4e242L, ++ 0x68ddb3f8L, 0x1fda836eL, 0x81be16cdL, 0xf6b9265bL, 0x6fb077e1L, ++ 0x18b74777L, 0x88085ae6L, 0xff0f6a70L, 0x66063bcaL, 0x11010b5cL, ++ 0x8f659effL, 0xf862ae69L, 0x616bffd3L, 0x166ccf45L, 0xa00ae278L, ++ 0xd70dd2eeL, 0x4e048354L, 0x3903b3c2L, 0xa7672661L, 0xd06016f7L, ++ 0x4969474dL, 0x3e6e77dbL, 0xaed16a4aL, 0xd9d65adcL, 0x40df0b66L, ++ 0x37d83bf0L, 0xa9bcae53L, 0xdebb9ec5L, 0x47b2cf7fL, 0x30b5ffe9L, ++ 0xbdbdf21cL, 0xcabac28aL, 0x53b39330L, 0x24b4a3a6L, 0xbad03605L, ++ 0xcdd70693L, 0x54de5729L, 0x23d967bfL, 0xb3667a2eL, 0xc4614ab8L, ++ 0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL, ++ 0x2d02ef8dL ++ }; ++ ++/* Return a 32-bit CRC of the contents of the buffer. */ ++ ++static uint32_t ++_efi_crc32 (const void *buf, size_t len, uint32_t seed) ++{ ++ size_t i; ++ uint32_t crc32val; ++ const unsigned char *s = buf; ++ ++ crc32val = seed; ++ for (i = 0; i < len; i++) { ++ crc32val = ++ crc32_tab[(crc32val ^ s[i]) & 0xff] ^ ++ (crc32val >> 8); ++ } ++ return crc32val; ++} ++ ++uint32_t ++efi_crc32 (const void *buf, size_t len) ++{ ++ return _efi_crc32 (buf, len, ~0L) ^ ~0L; ++} +diff --git a/plugins/partitioning/efi-crc32.h b/plugins/partitioning/efi-crc32.h +new file mode 100644 +index 0000000..76f5a6a +--- /dev/null ++++ b/plugins/partitioning/efi-crc32.h +@@ -0,0 +1,41 @@ ++/* nbdkit ++ * Copyright (C) 2018 Red Hat Inc. ++ * All rights reserved. ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions are ++ * met: ++ * ++ * * Redistributions of source code must retain the above copyright ++ * notice, this list of conditions and the following disclaimer. ++ * ++ * * Redistributions in binary form must reproduce the above copyright ++ * notice, this list of conditions and the following disclaimer in the ++ * documentation and/or other materials provided with the distribution. ++ * ++ * * Neither the name of Red Hat nor the names of its contributors may be ++ * used to endorse or promote products derived from this software without ++ * specific prior written permission. ++ * ++ * THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND ++ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, ++ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A ++ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR ++ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ++ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ++ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF ++ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ++ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, ++ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT ++ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ++ * SUCH DAMAGE. ++ */ ++ ++#ifndef NBDKIT_EFI_CRC32_H ++#define NBDKIT_EFI_CRC32_H ++ ++#include ++ ++extern uint32_t efi_crc32 (const void *buf, size_t len); ++ ++#endif /* NBDKIT_EFI_CRC32_H */ +diff --git a/plugins/partitioning/partition-gpt.c b/plugins/partitioning/partition-gpt.c +index 14a58ad..5fb7602 100644 +--- a/plugins/partitioning/partition-gpt.c ++++ b/plugins/partitioning/partition-gpt.c +@@ -44,7 +44,7 @@ + + #include "byte-swapping.h" + +-#include "crc32.h" ++#include "efi-crc32.h" + #include "regions.h" + #include "virtual-disk.h" + +@@ -121,10 +121,10 @@ create_gpt_partition_header (const void *pt, int is_primary, + header->nr_partition_entries = htole32 (GPT_PTA_SIZE); + header->size_partition_entry = htole32 (GPT_PT_ENTRY_SIZE); + header->crc_partitions = +- htole32 (crc32 (pt, GPT_PT_ENTRY_SIZE * GPT_PTA_SIZE)); ++ htole32 (efi_crc32 (pt, GPT_PT_ENTRY_SIZE * GPT_PTA_SIZE)); + + /* Must be computed last. */ +- header->crc = htole32 (crc32 (header, sizeof *header)); ++ header->crc = htole32 (efi_crc32 (header, sizeof *header)); + } + + static void +-- +1.8.3.1 + diff --git a/SOURCES/0001-vddk-Remove-vimapiver-parameter.patch b/SOURCES/0001-vddk-Remove-vimapiver-parameter.patch deleted file mode 100644 index 134499f..0000000 --- a/SOURCES/0001-vddk-Remove-vimapiver-parameter.patch +++ /dev/null @@ -1,117 +0,0 @@ -From f8871cf914911e620c1321e9ecd0915322dca1f3 Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Tue, 24 Jul 2018 12:08:41 +0100 -Subject: [PATCH 1/8] vddk: Remove vimapiver parameter. - -VDDK never used this, setting it is useless. - -(cherry picked from commit ecface865aa121a601c571831d78f4ea1f0574b8) ---- - plugins/vddk/nbdkit-vddk-plugin.pod | 12 ++---------- - plugins/vddk/vddk.c | 20 +++----------------- - 2 files changed, 5 insertions(+), 27 deletions(-) - -diff --git a/plugins/vddk/nbdkit-vddk-plugin.pod b/plugins/vddk/nbdkit-vddk-plugin.pod -index 4d9c6e9..c5486a3 100644 ---- a/plugins/vddk/nbdkit-vddk-plugin.pod -+++ b/plugins/vddk/nbdkit-vddk-plugin.pod -@@ -10,7 +10,7 @@ nbdkit-vddk-plugin - VMware VDDK plugin for nbdkit - [vm=moref=ID] [server=HOSTNAME] [user=USERNAME] - [password=PASSWORD | password=- | password=+FILENAME] - [cookie=COOKIE] [thumbprint=THUMBPRINT] -- [vimapiver=APIVER] [port=PORT] [nfchostport=PORT] -+ [port=PORT] [nfchostport=PORT] - [snapshot=MOREF] [transports=MODE:MODE:...] - nbdkit vddk --dump-plugin - -@@ -177,10 +177,7 @@ L - --Optional. Specify the VIM API version. If not given it defaults to --the current version. -- --(Only supported in VDDK ≥ 6.5.0) -+This parameter is ignored for backwards compatibility. - - =back - -@@ -271,11 +268,6 @@ at runtime. - If this is printed then the C parameter is supported - by this build. - --=item C -- --If this is printed then the C parameter is supported --by this build. -- - =back - - =head1 DEBUGGING VDDK -diff --git a/plugins/vddk/vddk.c b/plugins/vddk/vddk.c -index 1c15127..d7a4987 100644 ---- a/plugins/vddk/vddk.c -+++ b/plugins/vddk/vddk.c -@@ -1,5 +1,5 @@ - /* nbdkit -- * Copyright (C) 2013-2017 Red Hat Inc. -+ * Copyright (C) 2013-2018 Red Hat Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without -@@ -59,7 +59,6 @@ static const char *snapshot_moref = NULL; /* snapshot */ - static const char *thumb_print = NULL; /* thumbprint */ - static const char *transport_modes = NULL; /* transports */ - static const char *username = NULL; /* user */ --static const char *vim_api_ver = NULL; /* vimapiver */ - static const char *vmx_spec = NULL; /* vm */ - static int is_remote = 0; - -@@ -208,12 +207,7 @@ vddk_config (const char *key, const char *value) - username = value; - } - else if (strcmp (key, "vimapiver") == 0) { --#if HAVE_VIXDISKLIBCONNECTPARAMS_VIMAPIVER -- vim_api_ver = value; --#else -- nbdkit_error ("this version of VDDK is too old to support vimapiver"); -- return -1; --#endif -+ /* Ignored for backwards compatibility. */ - } - else if (strcmp (key, "vm") == 0) { - vmx_spec = value; -@@ -248,8 +242,7 @@ vddk_config_complete (void) - cookie || - thumb_print || - port || -- nfc_host_port || -- vim_api_ver; -+ nfc_host_port; - - if (is_remote) { - #define missing(test, param) \ -@@ -281,10 +274,6 @@ vddk_dump_plugin (void) - printf ("vddk_has_nfchostport=1\n"); - #endif - --#if HAVE_VIXDISKLIBCONNECTPARAMS_VIMAPIVER -- printf ("vddk_has_vimapiver=1\n"); --#endif -- - /* XXX We really need to print the version of the dynamically - * linked library here, but VDDK does not provide it. - */ -@@ -336,9 +325,6 @@ vddk_open (int readonly) - params.port = port; - #if HAVE_VIXDISKLIBCONNECTPARAMS_NFCHOSTPORT - params.nfcHostPort = nfc_host_port; --#endif --#if HAVE_VIXDISKLIBCONNECTPARAMS_VIMAPIVER -- params.vimApiVer = (char *) vim_api_ver; - #endif - } - --- -2.18.0 - diff --git a/SOURCES/0002-vddk-Remove-compile-time-dependency-on-VDDK-library.patch b/SOURCES/0002-vddk-Remove-compile-time-dependency-on-VDDK-library.patch deleted file mode 100644 index 1ea3a6f..0000000 --- a/SOURCES/0002-vddk-Remove-compile-time-dependency-on-VDDK-library.patch +++ /dev/null @@ -1,600 +0,0 @@ -From cc20761db7c5a1f9183c3a94528a2ed241c7cf00 Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Tue, 24 Jul 2018 12:11:17 +0100 -Subject: [PATCH 2/8] vddk: Remove compile-time dependency on VDDK library. -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Allow the plugin to be compiled without needing the library. Instead -of linking to the library at compile time we open the library at -runtime using dlopen. - -The plugin is now compiled unconditionally, unless you use -‘./configure --disable-vddk’. (Of course you still need the VDDK -library if you want to use the plugin. We cannot even test the plugin -loads without the library.). - -This change also moves the initialization of VDDK (calling InitEx) -into the config_complete method instead of the load method. This -later initialization allows the "config=FILENAME" and -"libdir=PATHNAME" parameters to have an effect whereas previously they -were silently ignored. - -(cherry picked from commit 8d7f7c26eb435334d7fa35e84ceee7d266dfae4c) ---- - README | 4 - - configure.ac | 75 ++--------------- - plugins/vddk/Makefile.am | 13 +-- - plugins/vddk/README.VDDK | 25 ++---- - plugins/vddk/nbdkit-vddk-plugin.pod | 48 ++++++++--- - plugins/vddk/vddk-structs.h | 125 ++++++++++++++++++++++++++++ - plugins/vddk/vddk.c | 89 ++++++++++++++------ - 7 files changed, 244 insertions(+), 135 deletions(-) - create mode 100644 plugins/vddk/vddk-structs.h - -diff --git a/README b/README -index baa29fc..8867cab 100644 ---- a/README -+++ b/README -@@ -65,10 +65,6 @@ For the libguestfs plugin, and to run the test suite: - - - guestfish (from libguestfs) - --For the VDDK plugin: -- -- - VDDK (see plugins/vddk/README.VDDK) -- - For the Perl, example4 and tar plugins: - - - perl development libraries -diff --git a/configure.ac b/configure.ac -index d207050..b3278eb 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -430,77 +430,14 @@ dnl Check for qemu-io (only needed for some of the tests). - AC_CHECK_PROG([QEMU_IO], [qemu-io], [qemu-io], [no]) - AM_CONDITIONAL([HAVE_QEMU_IO], [test "x$QEMU_IO" != "xno"]) - -+dnl Check if the user wants to disable VDDK support. - dnl See plugins/vddk/README.VDDK. --AC_CHECK_SIZEOF([size_t]) --AS_IF([test "x$ac_cv_sizeof_size_t" = "x4"],[bits=32],[bits=64]) --AC_ARG_WITH([vddk],[ -- AS_HELP_STRING([--with-vddk], -- [enable VMware VDDK plugin @<:@default=no@:>@])], -+AC_ARG_ENABLE([vddk],[ -+ AS_HELP_STRING([--disable-vddk], -+ [disable VMware VDDK plugin])], - [], -- [with_vddk=no]) --AS_IF([test "$with_vddk" = "yes"],[ -- VDDK_CFLAGS= -- VDDK_LIBS="-lvixDiskLib" -- # XXX Warning: stupid VMware API. -- VDDK_LIBDIR="$libdir/vmware-vix-disklib" -- AC_MSG_NOTICE([VDDK plugin enabled from $VDDK_LIBDIR]) -- ],[ -- AS_IF([test "$with_vddk" != "no"], [ -- VDDK_CFLAGS="-I$with_vddk/include" -- VDDK_LIBS="-L$with_vddk/lib$bits -lvixDiskLib" -- VDDK_LIBDIR="$with_vddk" -- AC_MSG_NOTICE([VDDK plugin enabled from $with_vddk]) -- ], -- [AC_MSG_NOTICE([VDDK plugin disabled]) -- ]) --]) -- --dnl If the VDDK plugin was enabled, compile and link a test program to make --dnl sure the library really works. --AS_IF([test "x$VDDK_LIBS" != "x"],[ -- # Save CFLAGS etc while we do this test. -- acx_nbdkit_save_CFLAGS="${CFLAGS}" -- acx_nbdkit_save_LIBS="${LIBS}" -- CFLAGS="$CFLAGS $VDDK_CFLAGS" -- LIBS="$VDDK_LIBS $LIBS" -- -- AC_MSG_CHECKING([if we can link to VDDK]) -- AC_LINK_IFELSE([ -- AC_LANG_SOURCE([[ --#include --#include --#include -- --int --main () --{ -- VixDiskLib_Exit (); --} --]]) -- ],[ -- AC_MSG_RESULT([yes]) -- ],[ -- AC_MSG_RESULT([no]) -- AC_MSG_ERROR([could not link to VDDK, see ‘config.log’ for more information]) -- ]) -- -- dnl Check for optional fields in VixDiskLibConnectParams struct. -- AC_CHECK_MEMBERS([VixDiskLibConnectParams.nfcHostPort, VixDiskLibConnectParams.vimApiVer], -- [], [], [[ --#include --#include --#include --]]) -- -- dnl Restore CFLAGS, etc. -- CFLAGS="${acx_nbdkit_save_CFLAGS}" -- LIBS="${acx_nbdkit_save_LIBS}" --]) -- --AC_SUBST([VDDK_CFLAGS]) --AC_SUBST([VDDK_LIBS]) --AC_DEFINE_UNQUOTED([VDDK_LIBDIR],["$VDDK_LIBDIR"],[VDDK 'libDir'.]) --AM_CONDITIONAL([HAVE_VDDK],[test "x$VDDK_LIBS" != "x"]) -+ [enable_vddk=yes]) -+AM_CONDITIONAL([HAVE_VDDK], [test "x$enable_vddk" = "xyes"]) - - dnl Produce output files. - AC_CONFIG_HEADERS([config.h]) -diff --git a/plugins/vddk/Makefile.am b/plugins/vddk/Makefile.am -index b910a64..1f4c91e 100644 ---- a/plugins/vddk/Makefile.am -+++ b/plugins/vddk/Makefile.am -@@ -1,5 +1,5 @@ - # nbdkit --# Copyright (C) 2013 Red Hat Inc. -+# Copyright (C) 2013-2018 Red Hat Inc. - # All rights reserved. - # - # Redistribution and use in source and binary forms, with or without -@@ -44,15 +44,16 @@ plugin_LTLIBRARIES = nbdkit-vddk-plugin.la - - nbdkit_vddk_plugin_la_SOURCES = \ - vddk.c \ -+ vddk-structs.h \ - $(top_srcdir)/include/nbdkit-plugin.h - - nbdkit_vddk_plugin_la_CPPFLAGS = \ -- -I$(top_srcdir)/include -+ -I$(top_srcdir)/include \ -+ -DVDDK_LIBDIR=\"$(libdir)/vmware-vix-disklib\" - nbdkit_vddk_plugin_la_CFLAGS = \ -- $(WARNINGS_CFLAGS) \ -- $(VDDK_CFLAGS) -+ $(WARNINGS_CFLAGS) - nbdkit_vddk_plugin_la_LIBADD = \ -- $(VDDK_LIBS) -+ -ldl - nbdkit_vddk_plugin_la_LDFLAGS = \ - -module -avoid-version -shared - -@@ -68,4 +69,4 @@ nbdkit-vddk-plugin.1: nbdkit-vddk-plugin.pod - - endif - --endif -+endif HAVE_VDDK -diff --git a/plugins/vddk/README.VDDK b/plugins/vddk/README.VDDK -index d8c62b1..1e56631 100644 ---- a/plugins/vddk/README.VDDK -+++ b/plugins/vddk/README.VDDK -@@ -11,27 +11,14 @@ account and download it from: - This directory contains an nbdkit plugin which uses this library to - export VMDK files and VMware disks over NBD. - --VDDK >= 6.5 is required. -- --Note: VDDK can do NBD on its own, so nbdkit might not be needed unless --you want the extra features and flexibility of nbdkit. -- --It is never compiled by default. To enable it you have to do: -- -- ./configure --with-vddk -- --If the VDDK library is located in a non-standard location, use this --instead: -- -- ./configure --with-vddk=/path/to/vmware-vix-disklib-distrib -- --(This looks for include/ and lib{32,64}/ subdirectories of the given --path for header files and libraries respectively.) -+You do NOT require VDDK to compile the plugin, and the plugin does not -+contain any VMware code. You only need VDDK at runtime. The plugin -+uses dlopen to load the library from LD_LIBRARY_PATH (or else the -+standard shared library paths). - - After building nbdkit-vddk-plugin.so, read the man page to find out --how to use it (nbdkit-vddk-plugin(1)). -- --You'll probably also want to read the VDDK developer documentation. -+how to use it (nbdkit-vddk-plugin(1)). You'll probably also want to -+read the VDDK developer documentation. - - Bugs - ---- -diff --git a/plugins/vddk/nbdkit-vddk-plugin.pod b/plugins/vddk/nbdkit-vddk-plugin.pod -index c5486a3..ba7806d 100644 ---- a/plugins/vddk/nbdkit-vddk-plugin.pod -+++ b/plugins/vddk/nbdkit-vddk-plugin.pod -@@ -16,21 +16,41 @@ nbdkit-vddk-plugin - VMware VDDK plugin for nbdkit - - =head1 DESCRIPTION - --C is a L plugin that serves files from -+C is an L plugin that serves files from - local VMware VMDK files, VMware ESXi servers, VMware VCenter servers, --and other sources by using VMware's proprietary VDDK library. -+and other sources. It requires VMware's proprietary VDDK library that -+you must download yourself separately. - - The plugin can serve read-only (if the I<-r> option is used) or - read/write. - --=head1 LIBRARY LOCATION -+=head1 LIBRARY AND CONFIG FILE LOCATIONS - --If the VDDK library (C) is located on a non-standard --path, you may need to set C or modify --C before this plugin will work. -+If the VDDK library (F) is located on a -+non-standard path, you may need to set C or modify -+F before this plugin will work. In addition you may -+want to set the C parameter so that the VDDK library can load -+plugins like Advanced Transport. - --The VDDK library may depend on C or other libraries --which you may have to install yourself. -+For 64 bit platforms pass the F subdirectory: -+ -+ export LD_LIBRARY_PATH=/path/to/vmware-vix-disklib-distrib/lib64 -+ -+For 32 bit platforms pass the F subdirectory: -+ -+ export LD_LIBRARY_PATH=/path/to/vmware-vix-disklib-distrib/lib32 -+ -+Then pass the VDDK distribution directory as C along with -+other parameters as required: -+ -+ nbdkit vddk \ -+ libdir=/path/to/vmware-vix-disklib-distrib \ -+ file=file.vmdk -+ -+VDDK itself looks in a few default locations for the optional -+configuration file, usually including F and -+F<$HOME/.vmware/config>, but you can override this using the C -+parameter. - - =head1 PARAMETERS - -@@ -67,11 +87,14 @@ L below). - - =item B - --Optional. This sets the path of the VMware VDDK library. It must be --an absolute path. -+Optional. This sets the path of the VMware VDDK distribution. It -+must be an absolute path. -+ -+VDDK uses this to load its own plugins, if this path is unspecified or -+wrong then VDDK will work with reduced functionality. - - If the parameter is not given, then a hard-coded path determined at --compile time is used. -+compile time is used, see L below. - - =item B - -@@ -307,7 +330,6 @@ support this. - - =head1 SEE ALSO - --L, - L, - L, - L, -@@ -319,7 +341,7 @@ Richard W.M. Jones - - =head1 COPYRIGHT - --Copyright (C) 2013-2017 Red Hat Inc. -+Copyright (C) 2013-2018 Red Hat Inc. - - =head1 LICENSE - -diff --git a/plugins/vddk/vddk-structs.h b/plugins/vddk/vddk-structs.h -new file mode 100644 -index 0000000..3e7a3c6 ---- /dev/null -+++ b/plugins/vddk/vddk-structs.h -@@ -0,0 +1,125 @@ -+/* nbdkit -+ * Copyright (C) 2013-2018 Red Hat Inc. -+ * All rights reserved. -+ * -+ * Redistribution and use in source and binary forms, with or without -+ * modification, are permitted provided that the following conditions are -+ * met: -+ * -+ * * Redistributions of source code must retain the above copyright -+ * notice, this list of conditions and the following disclaimer. -+ * -+ * * Redistributions in binary form must reproduce the above copyright -+ * notice, this list of conditions and the following disclaimer in the -+ * documentation and/or other materials provided with the distribution. -+ * -+ * * Neither the name of Red Hat nor the names of its contributors may be -+ * used to endorse or promote products derived from this software without -+ * specific prior written permission. -+ * -+ * THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND -+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR -+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT -+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -+ * SUCH DAMAGE. -+ */ -+ -+/* Types and structs that we pass to or return from the VDDK API. -+ * -+ * Updated to VDDK 6.7 -+ */ -+ -+#ifndef NBDKIT_VDDK_STRUCTS_H -+#define NBDKIT_VDDK_STRUCTS_H -+ -+typedef uint64_t VixError; -+#define VIX_OK 0 -+ -+#define VIXDISKLIB_FLAG_OPEN_READ_ONLY 4 -+#define VIXDISKLIB_SECTOR_SIZE 512 -+ -+typedef void *VixDiskLibConnection; -+typedef void *VixDiskLibHandle; -+ -+typedef void VixDiskLibGenericLogFunc (const char *fmt, va_list args); -+ -+enum VixDiskLibCredType { -+ VIXDISKLIB_CRED_UID = 1, -+ VIXDISKLIB_CRED_SESSIONID = 2, -+ VIXDISKLIB_CRED_TICKETID = 3, -+ VIXDISKLIB_CRED_SSPI = 4, -+ VIXDISKLIB_CRED_UNKNOWN = 256 -+}; -+ -+enum VixDiskLibSpecType { -+ VIXDISKLIB_SPEC_VMX = 0, -+ VIXDISKLIB_SPEC_VSTORAGE_OBJECT = 1, -+ VIXDISKLIB_SPEC_UNKNOWN = 2 -+}; -+ -+struct VixDiskLibVStorageObjectSpec { -+ char *id; -+ char *datastoreMoRef; -+ char *ssId; -+}; -+ -+typedef struct VixDiskLibConnectParams { -+ char *vmxSpec; -+ char *serverName; -+ char *thumbPrint; -+ long reserved1; -+ enum VixDiskLibCredType credType; -+ union { -+ struct { -+ char *userName; -+ char *password; -+ } uid; -+ struct { -+ char *cookie; -+ char *userName; -+ char *key; -+ } sessionId; -+ void *reserved2; -+ } creds; -+ uint32_t port; -+ uint32_t nfcHostPort; -+ char *reserved3; -+ char reserved4[8]; -+ void *reserved5; -+ union { -+ struct VixDiskLibVStorageObjectSpec vStorageObjSpec; -+ } spec; -+ enum VixDiskLibSpecType specType; -+} VixDiskLibConnectParams; -+ -+struct VixDiskLibGeometry { -+ uint32_t cylinders; -+ uint32_t heads; -+ uint32_t sectors; -+}; -+ -+enum VixDiskLibAdapterType { -+ VIXDISKLIB_ADAPTER_IDE = 1, -+ VIXDISKLIB_ADAPTER_SCSI_BUSLOGIC = 2, -+ VIXDISKLIB_ADAPTER_SCSI_LSILOGIC = 3, -+ VIXDISKLIB_ADAPTER_UNKNOWN = 256 -+}; -+ -+typedef struct VixDiskLibInfo { -+ struct VixDiskLibGeometry biosGeo; -+ struct VixDiskLibGeometry physGeo; -+ uint64_t capacity; -+ enum VixDiskLibAdapterType adapterType; -+ int numLinks; -+ char *parentFileNameHint; -+ char *uuid; -+} VixDiskLibInfo; -+ -+#endif /* NBDKIT_VDDK_STRUCTS_H */ -diff --git a/plugins/vddk/vddk.c b/plugins/vddk/vddk.c -index d7a4987..e3190cd 100644 ---- a/plugins/vddk/vddk.c -+++ b/plugins/vddk/vddk.c -@@ -39,14 +39,36 @@ - #include - #include - #include -+#include - - #include - --#include -+#include "vddk-structs.h" - -+/* The VDDK APIs that we call. These globals are initialized when the -+ * plugin is loaded (by vddk_load). -+ */ -+char *(*VixDiskLib_GetErrorText) (VixError err, const char *unused); -+void (*VixDiskLib_FreeErrorText) (char *text); -+VixError (*VixDiskLib_InitEx) (uint32_t major, uint32_t minor, VixDiskLibGenericLogFunc *log_function, VixDiskLibGenericLogFunc *warn_function, VixDiskLibGenericLogFunc *panic_function, const char *lib_dir, const char *config_file); -+void (*VixDiskLib_Exit) (void); -+VixError (*VixDiskLib_ConnectEx) (const VixDiskLibConnectParams *params, char read_only, const char *snapshot_ref, const char *transport_modes, VixDiskLibConnection *connection); -+VixError (*VixDiskLib_Open) (const VixDiskLibConnection connection, const char *path, uint32_t flags, VixDiskLibHandle *handle); -+const char *(*VixDiskLib_GetTransportMode) (VixDiskLibHandle handle); -+VixError (*VixDiskLib_Close) (VixDiskLibHandle handle); -+VixError (*VixDiskLib_Disconnect) (VixDiskLibConnection connection); -+VixError (*VixDiskLib_GetInfo) (VixDiskLibHandle handle, VixDiskLibInfo **info); -+void (*VixDiskLib_FreeInfo) (VixDiskLibInfo *info); -+VixError (*VixDiskLib_Read) (VixDiskLibHandle handle, uint64_t start_sector, uint64_t nr_sectors, unsigned char *buf); -+VixError (*VixDiskLib_Write) (VixDiskLibHandle handle, uint64_t start_sector, uint64_t nr_sectors, const unsigned char *buf); -+ -+/* Parameters passed to InitEx. */ - #define VDDK_MAJOR 5 - #define VDDK_MINOR 1 - -+static void *dl = NULL; /* dlopen handle */ -+static int init_called = 0; /* was InitEx called */ -+ - static char *config = NULL; /* config */ - static const char *cookie = NULL; /* cookie */ - static const char *filename = NULL; /* file */ -@@ -120,27 +142,39 @@ error_function (const char *fs, va_list args) - static void - vddk_load (void) - { -- VixError err; -+ const char *soname = "libvixDiskLib.so.6"; - -- DEBUG_CALL ("VixDiskLib_InitEx", -- "%d, %d, &debug_fn, &error_fn, &error_fn, %s, %s", -- VDDK_MAJOR, VDDK_MINOR, libdir, config ? : "NULL"); -- err = VixDiskLib_InitEx (VDDK_MAJOR, VDDK_MINOR, -- &debug_function, /* log function */ -- &error_function, /* warn function */ -- &error_function, /* panic function */ -- libdir, config); -- if (err != VIX_OK) { -- VDDK_ERROR (err, "VixDiskLib_InitEx"); -+ /* Load the plugin and set the entry points. */ -+ dl = dlopen (soname, RTLD_NOW); -+ if (dl == NULL) { -+ nbdkit_error ("%s: %s", soname, dlerror ()); - exit (EXIT_FAILURE); - } -+ -+ VixDiskLib_GetErrorText = dlsym (dl, "VixDiskLib_GetErrorText"); -+ VixDiskLib_FreeErrorText = dlsym (dl, "VixDiskLib_FreeErrorText"); -+ VixDiskLib_InitEx = dlsym (dl, "VixDiskLib_InitEx"); -+ VixDiskLib_Exit = dlsym (dl, "VixDiskLib_Exit"); -+ VixDiskLib_ConnectEx = dlsym (dl, "VixDiskLib_ConnectEx"); -+ VixDiskLib_Open = dlsym (dl, "VixDiskLib_Open"); -+ VixDiskLib_GetTransportMode = dlsym (dl, "VixDiskLib_GetTransportMode"); -+ VixDiskLib_Close = dlsym (dl, "VixDiskLib_Close"); -+ VixDiskLib_Disconnect = dlsym (dl, "VixDiskLib_Disconnect"); -+ VixDiskLib_GetInfo = dlsym (dl, "VixDiskLib_GetInfo"); -+ VixDiskLib_FreeInfo = dlsym (dl, "VixDiskLib_FreeInfo"); -+ VixDiskLib_Read = dlsym (dl, "VixDiskLib_Read"); -+ VixDiskLib_Write = dlsym (dl, "VixDiskLib_Write"); - } - - static void - vddk_unload (void) - { -- DEBUG_CALL ("VixDiskLib_Exit", ""); -- VixDiskLib_Exit (); -+ if (init_called) { -+ DEBUG_CALL ("VixDiskLib_Exit", ""); -+ VixDiskLib_Exit (); -+ } -+ if (dl) -+ dlclose (dl); - free (config); - free (password); - } -@@ -170,15 +204,10 @@ vddk_config (const char *key, const char *value) - libdir = value; - } - else if (strcmp (key, "nfchostport") == 0) { --#if HAVE_VIXDISKLIBCONNECTPARAMS_NFCHOSTPORT - if (sscanf (value, "%d", &nfc_host_port) != 1) { - nbdkit_error ("cannot parse nfchostport: %s", value); - return -1; - } --#else -- nbdkit_error ("this version of VDDK is too old to support nfchostpost"); -- return -1; --#endif - } - else if (strcmp (key, "password") == 0) { - free (password); -@@ -223,6 +252,8 @@ vddk_config (const char *key, const char *value) - static int - vddk_config_complete (void) - { -+ VixError err; -+ - if (filename == NULL) { - nbdkit_error ("you must supply the file= parameter after the plugin name on the command line"); - return -1; -@@ -258,6 +289,21 @@ vddk_config_complete (void) - #undef missing - } - -+ /* Initialize VDDK library. */ -+ DEBUG_CALL ("VixDiskLib_InitEx", -+ "%d, %d, &debug_fn, &error_fn, &error_fn, %s, %s", -+ VDDK_MAJOR, VDDK_MINOR, libdir, config ? : "NULL"); -+ err = VixDiskLib_InitEx (VDDK_MAJOR, VDDK_MINOR, -+ &debug_function, /* log function */ -+ &error_function, /* warn function */ -+ &error_function, /* panic function */ -+ libdir, config); -+ if (err != VIX_OK) { -+ VDDK_ERROR (err, "VixDiskLib_InitEx"); -+ exit (EXIT_FAILURE); -+ } -+ init_called = 1; -+ - return 0; - } - -@@ -269,10 +315,7 @@ static void - vddk_dump_plugin (void) - { - printf ("vddk_default_libdir=%s\n", VDDK_LIBDIR); -- --#if HAVE_VIXDISKLIBCONNECTPARAMS_NFCHOSTPORT - printf ("vddk_has_nfchostport=1\n"); --#endif - - /* XXX We really need to print the version of the dynamically - * linked library here, but VDDK does not provide it. -@@ -323,9 +366,7 @@ vddk_open (int readonly) - } - params.thumbPrint = (char *) thumb_print; - params.port = port; --#if HAVE_VIXDISKLIBCONNECTPARAMS_NFCHOSTPORT - params.nfcHostPort = nfc_host_port; --#endif - } - - /* XXX Some documentation suggests we should call --- -2.18.0 - diff --git a/SOURCES/0003-vddk-Add-comment-about-my-experiment-with-PrepareFor.patch b/SOURCES/0003-vddk-Add-comment-about-my-experiment-with-PrepareFor.patch deleted file mode 100644 index f240786..0000000 --- a/SOURCES/0003-vddk-Add-comment-about-my-experiment-with-PrepareFor.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 3573a04198b562a52de8870a8a7aff9af1c3c584 Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Tue, 24 Jul 2018 15:35:20 +0100 -Subject: [PATCH 3/8] vddk: Add comment about my experiment with - PrepareForAccess. - -(cherry picked from commit ba593d2dfa3b3ccd4073f7bad7bcd2d67ce23b64) ---- - plugins/vddk/vddk.c | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -diff --git a/plugins/vddk/vddk.c b/plugins/vddk/vddk.c -index e3190cd..77e3406 100644 ---- a/plugins/vddk/vddk.c -+++ b/plugins/vddk/vddk.c -@@ -370,8 +370,9 @@ vddk_open (int readonly) - } - - /* XXX Some documentation suggests we should call -- * VixDiskLib_PrepareForAccess here. However we need the true VM -- * name to do that. -+ * VixDiskLib_PrepareForAccess here. It may be required for -+ * Advanced Transport modes, but I could not make it work with -+ * either ESXi or vCenter servers. - */ - - DEBUG_CALL ("VixDiskLib_ConnectEx", --- -2.18.0 - diff --git a/SOURCES/0004-vddk-Make-dlsym-variables-static.patch b/SOURCES/0004-vddk-Make-dlsym-variables-static.patch deleted file mode 100644 index 995e9a9..0000000 --- a/SOURCES/0004-vddk-Make-dlsym-variables-static.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 54eb27a47cf5cd8eb4521506d7abc64514cdb256 Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Wed, 25 Jul 2018 09:10:03 +0100 -Subject: [PATCH 4/8] vddk: Make dlsym variables static. - -Fixes commit 8d7f7c26eb435334d7fa35e84ceee7d266dfae4c. - -(cherry picked from commit 168364eff47004e64d0880516de5744fecaa8047) ---- - plugins/vddk/vddk.c | 22 +++++++++++----------- - 1 file changed, 11 insertions(+), 11 deletions(-) - -diff --git a/plugins/vddk/vddk.c b/plugins/vddk/vddk.c -index 77e3406..4f03498 100644 ---- a/plugins/vddk/vddk.c -+++ b/plugins/vddk/vddk.c -@@ -48,19 +48,19 @@ - /* The VDDK APIs that we call. These globals are initialized when the - * plugin is loaded (by vddk_load). - */ --char *(*VixDiskLib_GetErrorText) (VixError err, const char *unused); --void (*VixDiskLib_FreeErrorText) (char *text); --VixError (*VixDiskLib_InitEx) (uint32_t major, uint32_t minor, VixDiskLibGenericLogFunc *log_function, VixDiskLibGenericLogFunc *warn_function, VixDiskLibGenericLogFunc *panic_function, const char *lib_dir, const char *config_file); -+static char *(*VixDiskLib_GetErrorText) (VixError err, const char *unused); -+static void (*VixDiskLib_FreeErrorText) (char *text); -+static VixError (*VixDiskLib_InitEx) (uint32_t major, uint32_t minor, VixDiskLibGenericLogFunc *log_function, VixDiskLibGenericLogFunc *warn_function, VixDiskLibGenericLogFunc *panic_function, const char *lib_dir, const char *config_file); - void (*VixDiskLib_Exit) (void); --VixError (*VixDiskLib_ConnectEx) (const VixDiskLibConnectParams *params, char read_only, const char *snapshot_ref, const char *transport_modes, VixDiskLibConnection *connection); --VixError (*VixDiskLib_Open) (const VixDiskLibConnection connection, const char *path, uint32_t flags, VixDiskLibHandle *handle); -+static VixError (*VixDiskLib_ConnectEx) (const VixDiskLibConnectParams *params, char read_only, const char *snapshot_ref, const char *transport_modes, VixDiskLibConnection *connection); -+static VixError (*VixDiskLib_Open) (const VixDiskLibConnection connection, const char *path, uint32_t flags, VixDiskLibHandle *handle); - const char *(*VixDiskLib_GetTransportMode) (VixDiskLibHandle handle); --VixError (*VixDiskLib_Close) (VixDiskLibHandle handle); --VixError (*VixDiskLib_Disconnect) (VixDiskLibConnection connection); --VixError (*VixDiskLib_GetInfo) (VixDiskLibHandle handle, VixDiskLibInfo **info); --void (*VixDiskLib_FreeInfo) (VixDiskLibInfo *info); --VixError (*VixDiskLib_Read) (VixDiskLibHandle handle, uint64_t start_sector, uint64_t nr_sectors, unsigned char *buf); --VixError (*VixDiskLib_Write) (VixDiskLibHandle handle, uint64_t start_sector, uint64_t nr_sectors, const unsigned char *buf); -+static VixError (*VixDiskLib_Close) (VixDiskLibHandle handle); -+static VixError (*VixDiskLib_Disconnect) (VixDiskLibConnection connection); -+static VixError (*VixDiskLib_GetInfo) (VixDiskLibHandle handle, VixDiskLibInfo **info); -+static void (*VixDiskLib_FreeInfo) (VixDiskLibInfo *info); -+static VixError (*VixDiskLib_Read) (VixDiskLibHandle handle, uint64_t start_sector, uint64_t nr_sectors, unsigned char *buf); -+static VixError (*VixDiskLib_Write) (VixDiskLibHandle handle, uint64_t start_sector, uint64_t nr_sectors, const unsigned char *buf); - - /* Parameters passed to InitEx. */ - #define VDDK_MAJOR 5 --- -2.18.0 - diff --git a/SOURCES/0005-vddk-Improve-error-message-if-the-proprietary-librar.patch b/SOURCES/0005-vddk-Improve-error-message-if-the-proprietary-librar.patch deleted file mode 100644 index 483273f..0000000 --- a/SOURCES/0005-vddk-Improve-error-message-if-the-proprietary-librar.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 9039b0fabc700982af9d86a1c0afcb951c6a90f7 Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Wed, 25 Jul 2018 09:28:04 +0100 -Subject: [PATCH 5/8] vddk: Improve error message if the proprietary library - cannot be found. - -(cherry picked from commit 94e791f87c6029983befa6199771345fd9cdfcc9) ---- - plugins/vddk/vddk.c | 8 ++++++-- - 1 file changed, 6 insertions(+), 2 deletions(-) - -diff --git a/plugins/vddk/vddk.c b/plugins/vddk/vddk.c -index 4f03498..79bcf7f 100644 ---- a/plugins/vddk/vddk.c -+++ b/plugins/vddk/vddk.c -@@ -142,12 +142,16 @@ error_function (const char *fs, va_list args) - static void - vddk_load (void) - { -- const char *soname = "libvixDiskLib.so.6"; -+ static const char soname[] = "libvixDiskLib.so.6"; - - /* Load the plugin and set the entry points. */ - dl = dlopen (soname, RTLD_NOW); - if (dl == NULL) { -- nbdkit_error ("%s: %s", soname, dlerror ()); -+ nbdkit_error ("%s\n\n" -+ "If '%s' is located on a non-standard path you may need to\n" -+ "set $LD_LIBRARY_PATH or edit /etc/ld.so.conf.\n\n" -+ "See the nbdkit-vddk-plugin(1) man page for details.", -+ dlerror (), soname); - exit (EXIT_FAILURE); - } - --- -2.18.0 - diff --git a/SOURCES/0006-vddk-If-relative-libdir-parameter-is-passed-make-it-.patch b/SOURCES/0006-vddk-If-relative-libdir-parameter-is-passed-make-it-.patch deleted file mode 100644 index 583a98a..0000000 --- a/SOURCES/0006-vddk-If-relative-libdir-parameter-is-passed-make-it-.patch +++ /dev/null @@ -1,82 +0,0 @@ -From cb13bf0b5218a75b8f91722126008b78ada89955 Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Wed, 25 Jul 2018 09:28:32 +0100 -Subject: [PATCH 6/8] vddk: If relative libdir parameter is passed, make it - absolute. - -(cherry picked from commit 8838497c44d51f2c3ea12adad89fd836116af201) - -RHEL 7.6: Replace the nbdkit_realpath function with -nbdkit_absolute_path, since nbdkit-1.2 does not have the former. ---- - plugins/vddk/nbdkit-vddk-plugin.pod | 3 +-- - plugins/vddk/vddk.c | 14 ++++++++++---- - 2 files changed, 11 insertions(+), 6 deletions(-) - -diff --git a/plugins/vddk/nbdkit-vddk-plugin.pod b/plugins/vddk/nbdkit-vddk-plugin.pod -index ba7806d..57a039f 100644 ---- a/plugins/vddk/nbdkit-vddk-plugin.pod -+++ b/plugins/vddk/nbdkit-vddk-plugin.pod -@@ -87,8 +87,7 @@ L below). - - =item B - --Optional. This sets the path of the VMware VDDK distribution. It --must be an absolute path. -+Optional. This sets the path of the VMware VDDK distribution. - - VDDK uses this to load its own plugins, if this path is unspecified or - wrong then VDDK will work with reduced functionality. -diff --git a/plugins/vddk/vddk.c b/plugins/vddk/vddk.c -index 79bcf7f..5d7bf6d 100644 ---- a/plugins/vddk/vddk.c -+++ b/plugins/vddk/vddk.c -@@ -72,7 +72,7 @@ static int init_called = 0; /* was InitEx called */ - static char *config = NULL; /* config */ - static const char *cookie = NULL; /* cookie */ - static const char *filename = NULL; /* file */ --static const char *libdir = VDDK_LIBDIR; /* libdir */ -+static char *libdir = NULL; /* libdir */ - static int nfc_host_port = 0; /* nfchostport */ - static char *password = NULL; /* password */ - static int port = 0; /* port */ -@@ -180,6 +180,7 @@ vddk_unload (void) - if (dl) - dlclose (dl); - free (config); -+ free (libdir); - free (password); - } - -@@ -205,7 +206,11 @@ vddk_config (const char *key, const char *value) - filename = value; - } - else if (strcmp (key, "libdir") == 0) { -- libdir = value; -+ /* See FILENAMES AND PATHS in nbdkit-plugin(3). */ -+ free (libdir); -+ libdir = nbdkit_absolute_path (value); -+ if (!libdir) -+ return -1; - } - else if (strcmp (key, "nfchostport") == 0) { - if (sscanf (value, "%d", &nfc_host_port) != 1) { -@@ -296,12 +301,13 @@ vddk_config_complete (void) - /* Initialize VDDK library. */ - DEBUG_CALL ("VixDiskLib_InitEx", - "%d, %d, &debug_fn, &error_fn, &error_fn, %s, %s", -- VDDK_MAJOR, VDDK_MINOR, libdir, config ? : "NULL"); -+ VDDK_MAJOR, VDDK_MINOR, -+ libdir ? : VDDK_LIBDIR, config ? : "NULL"); - err = VixDiskLib_InitEx (VDDK_MAJOR, VDDK_MINOR, - &debug_function, /* log function */ - &error_function, /* warn function */ - &error_function, /* panic function */ -- libdir, config); -+ libdir ? : VDDK_LIBDIR, config); - if (err != VIX_OK) { - VDDK_ERROR (err, "VixDiskLib_InitEx"); - exit (EXIT_FAILURE); --- -2.18.0 - diff --git a/SOURCES/0007-vddk-Two-more-static-dlsym-variables.patch b/SOURCES/0007-vddk-Two-more-static-dlsym-variables.patch deleted file mode 100644 index a3f40fd..0000000 --- a/SOURCES/0007-vddk-Two-more-static-dlsym-variables.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 033ab68ec56dbdac091b084dee7b7f333290768a Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Wed, 25 Jul 2018 14:02:32 +0100 -Subject: [PATCH 7/8] vddk: Two more static dlsym variables. - -Fixes commit 168364eff47004e64d0880516de5744fecaa8047 -and commit 8d7f7c26eb435334d7fa35e84ceee7d266dfae4c. - -(cherry picked from commit b776d1f5e59faef659f0d6e7fbffec614d58a368) ---- - plugins/vddk/vddk.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/plugins/vddk/vddk.c b/plugins/vddk/vddk.c -index 5d7bf6d..29b48dd 100644 ---- a/plugins/vddk/vddk.c -+++ b/plugins/vddk/vddk.c -@@ -51,10 +51,10 @@ - static char *(*VixDiskLib_GetErrorText) (VixError err, const char *unused); - static void (*VixDiskLib_FreeErrorText) (char *text); - static VixError (*VixDiskLib_InitEx) (uint32_t major, uint32_t minor, VixDiskLibGenericLogFunc *log_function, VixDiskLibGenericLogFunc *warn_function, VixDiskLibGenericLogFunc *panic_function, const char *lib_dir, const char *config_file); --void (*VixDiskLib_Exit) (void); -+static void (*VixDiskLib_Exit) (void); - static VixError (*VixDiskLib_ConnectEx) (const VixDiskLibConnectParams *params, char read_only, const char *snapshot_ref, const char *transport_modes, VixDiskLibConnection *connection); - static VixError (*VixDiskLib_Open) (const VixDiskLibConnection connection, const char *path, uint32_t flags, VixDiskLibHandle *handle); --const char *(*VixDiskLib_GetTransportMode) (VixDiskLibHandle handle); -+static const char *(*VixDiskLib_GetTransportMode) (VixDiskLibHandle handle); - static VixError (*VixDiskLib_Close) (VixDiskLibHandle handle); - static VixError (*VixDiskLib_Disconnect) (VixDiskLibConnection connection); - static VixError (*VixDiskLib_GetInfo) (VixDiskLibHandle handle, VixDiskLibInfo **info); --- -2.18.0 - diff --git a/SOURCES/0008-vddk-Add-a-very-simple-test.patch b/SOURCES/0008-vddk-Add-a-very-simple-test.patch deleted file mode 100644 index d2106f4..0000000 --- a/SOURCES/0008-vddk-Add-a-very-simple-test.patch +++ /dev/null @@ -1,179 +0,0 @@ -From 585abf15b46b0c36c4b696cbe925fbefbd22d90a Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Wed, 25 Jul 2018 14:09:58 +0100 -Subject: [PATCH 8/8] vddk: Add a very simple test. - -We cannot do anything like a real test without the proprietary -library. However by making a dummy library which contains some stub -functions we can test --dump-plugin output. - -(cherry picked from commit 70f7227ecc9b7c8d628987cb12ca7541bf485d66) ---- - tests/Makefile.am | 21 ++++++++++++++++ - tests/dummy-vddk.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++ - tests/test-vddk.sh | 45 +++++++++++++++++++++++++++++++++ - 3 files changed, 128 insertions(+) - create mode 100644 tests/dummy-vddk.c - create mode 100755 tests/test-vddk.sh - -diff --git a/tests/Makefile.am b/tests/Makefile.am -index 53b2d8a..d65bde5 100644 ---- a/tests/Makefile.am -+++ b/tests/Makefile.am -@@ -67,6 +67,7 @@ EXTRA_DIST = \ - test-start.sh \ - test-random-sock.sh \ - test-tls.sh \ -+ test-vddk.sh \ - test-version.sh \ - test-version-filter.sh \ - test-version-plugin.sh -@@ -319,6 +320,26 @@ test_streaming_SOURCES = test-streaming.c test.h - test_streaming_CFLAGS = $(WARNINGS_CFLAGS) $(LIBGUESTFS_CFLAGS) - test_streaming_LDADD = libtest.la $(LIBGUESTFS_LIBS) - -+# VDDK plugin test. -+# This only tests that the plugin can be loaded against a -+# dummy VDDK library, it is not a detailed test. -+ -+# check_LTLIBRARIES won't build a shared library (see automake manual). -+# So we have to do this and add a dependency. -+noinst_LTLIBRARIES += libvixDiskLib.la -+TESTS += test-vddk.sh -+ -+libvixDiskLib_la_SOURCES = \ -+ dummy-vddk.c -+libvixDiskLib_la_CPPFLAGS = \ -+ -I$(top_srcdir)/plugins/vddk -+libvixDiskLib_la_CXXFLAGS = \ -+ $(WARNINGS_CFLAGS) -+# For use of the -rpath option, see: -+# https://lists.gnu.org/archive/html/libtool/2007-07/msg00067.html -+libvixDiskLib_la_LDFLAGS = \ -+ -shared -version-number 6:0:0 -rpath /nowhere -+ - # xz plugin test. - if HAVE_LIBLZMA - if HAVE_GUESTFISH -diff --git a/tests/dummy-vddk.c b/tests/dummy-vddk.c -new file mode 100644 -index 0000000..e9069c9 ---- /dev/null -+++ b/tests/dummy-vddk.c -@@ -0,0 +1,62 @@ -+/* nbdkit -+ * Copyright (C) 2018 Red Hat Inc. -+ * All rights reserved. -+ * -+ * Redistribution and use in source and binary forms, with or without -+ * modification, are permitted provided that the following conditions are -+ * met: -+ * -+ * * Redistributions of source code must retain the above copyright -+ * notice, this list of conditions and the following disclaimer. -+ * -+ * * Redistributions in binary form must reproduce the above copyright -+ * notice, this list of conditions and the following disclaimer in the -+ * documentation and/or other materials provided with the distribution. -+ * -+ * * Neither the name of Red Hat nor the names of its contributors may be -+ * used to endorse or promote products derived from this software without -+ * specific prior written permission. -+ * -+ * THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND -+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -+ * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR -+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT -+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -+ * SUCH DAMAGE. -+ */ -+ -+/* This file pretends to be libvixDiskLib.so.6. -+ * -+ * In fact because we don't check the result from dlsym and because we -+ * only call a few APIs in the --dump-plugin path there are only a few -+ * stub functions needed. -+ */ -+ -+#include -+#include -+#include -+ -+#include "vddk-structs.h" -+ -+VixError -+VixDiskLib_InitEx (uint32_t major, uint32_t minor, -+ VixDiskLibGenericLogFunc *log_function, -+ VixDiskLibGenericLogFunc *warn_function, -+ VixDiskLibGenericLogFunc *panic_function, -+ const char *lib_dir, const char *config_file) -+{ -+ /* Do nothing, only exit with no error. */ -+ return VIX_OK; -+} -+ -+void -+VixDiskLib_Exit (void) -+{ -+ /* Do nothing. */ -+} -diff --git a/tests/test-vddk.sh b/tests/test-vddk.sh -new file mode 100755 -index 0000000..5ccfff1 ---- /dev/null -+++ b/tests/test-vddk.sh -@@ -0,0 +1,45 @@ -+#!/bin/bash - -+# nbdkit -+# Copyright (C) 2018 Red Hat Inc. -+# All rights reserved. -+# -+# Redistribution and use in source and binary forms, with or without -+# modification, are permitted provided that the following conditions are -+# met: -+# -+# * Redistributions of source code must retain the above copyright -+# notice, this list of conditions and the following disclaimer. -+# -+# * Redistributions in binary form must reproduce the above copyright -+# notice, this list of conditions and the following disclaimer in the -+# documentation and/or other materials provided with the distribution. -+# -+# * Neither the name of Red Hat nor the names of its contributors may be -+# used to endorse or promote products derived from this software without -+# specific prior written permission. -+# -+# THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND -+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR -+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -+# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT -+# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -+# SUCH DAMAGE. -+ -+set -x -+set -e -+ -+rm -f test-vddk.out -+ -+LD_LIBRARY_PATH=.libs:$LD_LIBRARY_PATH \ -+nbdkit vddk --dump-plugin > test-vddk.out -+cat test-vddk.out -+ -+grep ^vddk_default_libdir= test-vddk.out -+ -+rm test-vddk.out --- -2.18.0 - diff --git a/SOURCES/0009-python-Try-harder-to-print-the-full-traceback-on-err.patch b/SOURCES/0009-python-Try-harder-to-print-the-full-traceback-on-err.patch deleted file mode 100644 index f9ee353..0000000 --- a/SOURCES/0009-python-Try-harder-to-print-the-full-traceback-on-err.patch +++ /dev/null @@ -1,229 +0,0 @@ -From 107a0d0ca210858d35bbda10e699274b12efa978 Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Wed, 8 Aug 2018 13:50:23 +0100 -Subject: [PATCH] python: Try harder to print the full traceback on error. -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -The tracebacks are compressed into a single line because we're using -PyObject_Str, but they are just about usable if not very readable. -For example you would see an error like this: - -nbdkit: error: ./python-exception.py: config_complete: error: ['Traceback (most recent call last):\n', ' File "./python-exception.py", line 54, in config_complete\n raise_error1()\n', ' File "./python-exception.py", line 48, in raise_error1\n raise_error2()\n', ' File "./python-exception.py", line 45, in raise_error2\n raise RuntimeError("this is the test string")\n', 'RuntimeError: this is the test string\n'] - -which can be read by manually unfolding the exception in an editor as: - -nbdkit: error: ./python-exception.py: config_complete: error: -Traceback (most recent call last): - File "./python-exception.py", line 54, in config_complete - raise_error1() - File "./python-exception.py", line 48, in raise_error1 - raise_error2() - File "./python-exception.py", line 45, in raise_error2 - raise RuntimeError("this is the test string") -RuntimeError: this is the test string - -This also fixes the Python exception test: - -(1) It originally was not testing anything. Adding ‘set -e’ fixes -that. - -(2) The valgrind test is always broken because of Python itself. -Skip the test under valgrind. - -(3) This now tests both simple exceptions and full tracebacks. - -Tested with Python 2.7.15 & 3.6.6. - -(cherry picked from commit 72c0d64a47db642cafa89884f2ee554bd0b8e822) ---- - plugins/python/python.c | 93 +++++++++++++++++++++++++++++++++++------- - tests/python-exception.py | 20 ++++++++- - tests/test-python-exception.sh | 20 ++++++++- - 3 files changed, 117 insertions(+), 16 deletions(-) - -diff --git a/plugins/python/python.c b/plugins/python/python.c -index 7eb91d7..ef1a2cf 100644 ---- a/plugins/python/python.c -+++ b/plugins/python/python.c -@@ -129,27 +129,92 @@ python_to_string (PyObject *str) - return NULL; - } - -+/* This is the fallback in case we cannot get the full traceback. */ -+static void -+print_python_error (const char *callback, PyObject *error) -+{ -+ PyObject *error_str; -+ char *error_cstr = NULL; -+ -+ error_str = PyObject_Str (error); -+ error_cstr = python_to_string (error_str); -+ nbdkit_error ("%s: %s: error: %s", -+ script, callback, -+ error_cstr ? error_cstr : ""); -+ Py_DECREF (error_str); -+ free (error_cstr); -+} -+ -+/* Convert the Python traceback to a string and call nbdkit_error. -+ * https://stackoverflow.com/a/15907460/7126113 -+ */ -+static int -+print_python_traceback (const char *callback, -+ PyObject *type, PyObject *error, PyObject *traceback) -+{ -+ PyObject *module_name, *traceback_module, *format_exception_fn, *rv, -+ *traceback_str; -+ char *traceback_cstr; -+ -+#ifdef HAVE_PYSTRING_FROMSTRING -+ module_name = PyString_FromString ("traceback"); -+#else -+ module_name = PyUnicode_FromString ("traceback"); -+#endif -+ traceback_module = PyImport_Import (module_name); -+ Py_DECREF (module_name); -+ -+ /* couldn't 'import traceback' */ -+ if (traceback_module == NULL) -+ return -1; -+ -+ format_exception_fn = PyObject_GetAttrString (traceback_module, -+ "format_exception"); -+ if (format_exception_fn == NULL) -+ return -1; -+ if (!PyCallable_Check (format_exception_fn)) -+ return -1; -+ -+ rv = PyObject_CallFunctionObjArgs (format_exception_fn, -+ type, error, traceback, NULL); -+ traceback_str = PyObject_Str (rv); -+ Py_DECREF (rv); -+ traceback_cstr = python_to_string (traceback_str); -+ if (traceback_cstr == NULL) { -+ Py_DECREF (traceback_str); -+ return -1; -+ } -+ -+ nbdkit_error ("%s: %s: error: %s", -+ script, callback, -+ traceback_cstr); -+ Py_DECREF (traceback_str); -+ free (traceback_cstr); -+ -+ /* This means we succeeded in calling nbdkit_error. */ -+ return 0; -+} -+ - static int - check_python_failure (const char *callback) - { - if (PyErr_Occurred ()) { -- PyObject *type, *error, *traceback, *error_str; -- char *error_cstr; -+ PyObject *type, *error, *traceback; - -- /* Convert the Python exception to a string. -- * https://stackoverflow.com/a/1418703 -- * But forget about the traceback, it's very hard to print. -- * https://stackoverflow.com/q/1796510 -- */ - PyErr_Fetch (&type, &error, &traceback); - PyErr_NormalizeException (&type, &error, &traceback); -- error_str = PyObject_Str (error); -- error_cstr = python_to_string (error_str); -- nbdkit_error ("%s: %s: error: %s", -- script, callback, -- error_cstr ? error_cstr : ""); -- Py_DECREF (error_str); -- free (error_cstr); -+ -+ /* Try to print the full traceback. */ -+ if (print_python_traceback (callback, type, error, traceback) == -1) { -+ /* Couldn't do that, so fall back to converting the Python error -+ * to a string. -+ */ -+ print_python_error (callback, error); -+ } -+ -+ /* In all cases this returns -1 to indicate that a Python error -+ * occurred. -+ */ - return -1; - } - return 0; -diff --git a/tests/python-exception.py b/tests/python-exception.py -index 1debf51..739057f 100644 ---- a/tests/python-exception.py -+++ b/tests/python-exception.py -@@ -32,10 +32,28 @@ - - # A dummy python plugin which just raises an exception in config_complete. - -+test = "simple" - --def config_complete(): -+def config(k, v): -+ global test -+ if k == "test": -+ test = v -+ else: -+ raise RuntimeError("unknown config parameter") -+ -+def raise_error2(): - raise RuntimeError("this is the test string") - -+def raise_error1(): -+ raise_error2() -+ -+def config_complete(): -+ if test == "simple": -+ raise RuntimeError("this is the test string") -+ elif test == "traceback": -+ raise_error1() -+ else: -+ raise RuntimeError("unknown test") - - def open(readonly): - return 1 -diff --git a/tests/test-python-exception.sh b/tests/test-python-exception.sh -index 83999af..fd94827 100755 ---- a/tests/test-python-exception.sh -+++ b/tests/test-python-exception.sh -@@ -31,12 +31,30 @@ - # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - # SUCH DAMAGE. - -+set -e -+set -x -+ -+# Python language leaks like a sieve as well as a lot of worrying -+# "Conditional jump or move depends on uninitialised value(s)". -+if test -n "$NBDKIT_VALGRIND"; then -+ echo "$0: skipping Python test under valgrind." -+ exit 77 -+fi -+ - output=test-python-exception.out - - rm -f $output - --nbdkit -f -v python ./python-exception.py > $output 2>&1 ||: -+nbdkit -f -v python ./python-exception.py test=simple > $output 2>&1 ||: -+cat $output - - grep 'this is the test string' $output - -+nbdkit -f -v python ./python-exception.py test=traceback > $output 2>&1 ||: -+cat $output -+ -+grep 'raise_error1' $output -+grep 'raise_error2' $output -+grep 'this is the test string' $output -+ - rm $output --- -1.8.3.1 - diff --git a/SOURCES/nbdkit-1.2.6.tar.gz.sig b/SOURCES/nbdkit-1.2.6.tar.gz.sig deleted file mode 100644 index d492f09..0000000 --- a/SOURCES/nbdkit-1.2.6.tar.gz.sig +++ /dev/null @@ -1,16 +0,0 @@ ------BEGIN PGP SIGNATURE----- - -iQIcBAABAgAGBQJbYeqOAAoJEJFzj3Pht2igbjcP/it0ILmJWsxH3Db3EJc0RYts -drPv214wBWPDgaV0SuJPPoEUYWgieSQuRPlWxIsKhoricVOXLcuKfzjFWF4t3DAz -2mynu5xUzb6ZVSQq+/XlAwerMt6bLPw8O6J0slHJcbTOxi6bEFS/VAl7/EqJBBIY -UkJkaEk27LX42azjMGRB4ehPJRNSM85+UEwwFuL+Ghzn9zJO2yo0+ejXVe/w7Rya -qaCw4EpBjMhL/j0kh5fJ2k30oMnjYRnivJZmPRQXfCAx+kWZZ7FqewP62+9bUkM3 -eNSW0FYSaLoPm5KIlH1U3IihodRUaOCIvxCoKiW8elTsI5H+/KQ48votM2a46RTW -Fdeof02szUq4xxmRzs+lTt+2Fbfw8McRXYrkiElAY9lMwbLLkikkYoTYdvf8ogfA -VP7e4UrSgXhAxAXKyd7ULhT9dCeJmWEdTf+o27A9SHnPaRGntXE8imZW2/OymQr0 -3zmmh2aeuyD461H9gg5nuVomfLIf74rweYG4AoBPE+vAVh9Rc71RuYq1K5JCqHGH -eECvgxPISkO59Kpo+G172fzFaAsjka6jJql7q9ZqjQqAMu9yHmB6sS5ShLcPNsFO -Fe7MRox9g7C55zT5REYWTn0RU3516jOtQUYjJwODDJHNcz57a8WXMLFFjKk2OpML -l7Xh/lY952epnfW3KPWK -=KgNI ------END PGP SIGNATURE----- diff --git a/SOURCES/nbdkit-1.8.0.tar.gz.sig b/SOURCES/nbdkit-1.8.0.tar.gz.sig new file mode 100644 index 0000000..6389648 --- /dev/null +++ b/SOURCES/nbdkit-1.8.0.tar.gz.sig @@ -0,0 +1,16 @@ +-----BEGIN PGP SIGNATURE----- + +iQIcBAABAgAGBQJb6eXmAAoJEJFzj3Pht2ig3noP/j1WW7G+X3lvqMMm9tx4RnY3 +7y9U9Ze2LAbM+SLtu7gh47N4zbYMtCa5Ws9gLpJb51ViC4olBGzZfGwGqZO0EoGz +seOWEK/XakdRTfiE8O9Cn0bjPlMTA8OzGaAPMLPKUMOSqBcT6oomJLggKHU0nEpm +CchcnAnsxEVn6porKJPyHAfIkpGCRzccTCpCSTkTg/jzPv9O1bMue4kwhT4nV3ui +YPPfEmfkNu9GdVB4P3MZzYFROoxarONUp0MifoFNEaBvztNjTRLCiXrqPSNRkhzN +9041NVwkXZgX1r9jEJxm6NEaFj9rrJoUcvGefoNIc376E0XTaO+3MUr1HqtFKCki +954k4FtV6Yb6gqzSOAfCevikv/HapKYLhC7sY4MyimnHSwk7ZZfN52qgm7oYdIbM +GuRYDtNQzulESWnh99zzfMFLDo9SPPAjqmNguJ/a924FJl0k1U+vxNcsFhUyeLF2 +94SSIB9eLGzphSZWqCRfipV89C8qJka6ExCmslBUsPk7HxsObzDTo3BIdxJ52LUN +1fiwB75C64k3NEXuAc9vX0xled9exEliTcyDOWMhxam8HT/hoVFlZ5aFmk3Xtgiv +o0gKb51vpJnJym8YorebFXKqzWXFZze3nnadGM8QErfwlFvSCVmebzu8qesPN6Tt +/22YLADVHl3N6yVZzvkQ +=d9cL +-----END PGP SIGNATURE----- diff --git a/SPECS/nbdkit.spec b/SPECS/nbdkit.spec index 3966fbd..ab0258c 100644 --- a/SPECS/nbdkit.spec +++ b/SPECS/nbdkit.spec @@ -23,11 +23,11 @@ %global patches_touch_autotools 1 # The source directory. -%global source_directory 1.2-stable +%global source_directory 1.8-stable Name: nbdkit -Version: 1.2.6 -Release: 1%{?dist}.2 +Version: 1.8.0 +Release: 1%{?dist} Summary: NBD server License: BSD @@ -41,16 +41,10 @@ Source2: libguestfs.keyring %endif # Patches come from: -# https://github.com/libguestfs/nbdkit/tree/rhel-7.6 -Patch1: 0001-vddk-Remove-vimapiver-parameter.patch -Patch2: 0002-vddk-Remove-compile-time-dependency-on-VDDK-library.patch -Patch3: 0003-vddk-Add-comment-about-my-experiment-with-PrepareFor.patch -Patch4: 0004-vddk-Make-dlsym-variables-static.patch -Patch5: 0005-vddk-Improve-error-message-if-the-proprietary-librar.patch -Patch6: 0006-vddk-If-relative-libdir-parameter-is-passed-make-it-.patch -Patch7: 0007-vddk-Two-more-static-dlsym-variables.patch -Patch8: 0008-vddk-Add-a-very-simple-test.patch -Patch9: 0009-python-Try-harder-to-print-the-full-traceback-on-err.patch +# https://github.com/libguestfs/nbdkit/tree/rhel-7.7 + +# Patches. +Patch0001: 0001-partitioning-Rename-crc32-to-efi_crc32-to-avoid-conf.patch %if 0%{patches_touch_autotools} BuildRequires: autoconf, automake, libtool @@ -137,36 +131,27 @@ Obsoletes: %{name}-plugin-streaming < 1.1.19-1 This package contains some basic plugins for %{name} which have only trivial dependencies. -* nbdkit-file-plugin - - A file serving plugin. +nbdkit-data-plugin Serve small amounts of data from the command line. -* nbdkit-memory-plugin +nbdkit-file-plugin The normal file plugin for serving files. - A virtual memory plugin. +nbdkit-memory-plugin A virtual memory plugin. -* nbdkit-nbd-plugin +nbdkit-nbd-plugin An NBD forwarding plugin. - An NBD forwarding plugin. +nbdkit-null-plugin A null (bitbucket) plugin. - It provides an NBD server that forwards all traffic as a client to - another existing NBD server. A primary usage of this setup is to - alter the set of features available to the ultimate end client, - without having to change the original server (for example, to - convert between oldstyle and newtyle, or to add TLS support where - the original server lacks it). +nbdkit-pattern-plugin Fixed test pattern. -* nbdkit-null-plugin +nbdkit-partitioning-plugin Create virtual disks from partitions. - A null (bitbucket) plugin. +nbdkit-random-plugin Random content plugin for testing. -* nbdkit-split-plugin +nbdkit-split-plugin Concatenate one or more files. - Concatenate one or more files into a single virtual disk. +nbdkit-streaming-plugin A streaming file serving plugin. -* nbdkit-streaming-plugin - - A streaming file serving plugin. +nbdkit-zero-plugin Zero-length plugin for testing. %package example-plugins @@ -255,9 +240,42 @@ autoreconf -i # Simplify the test suite so it doesn't require qemu. sed -i -e '/^if HAVE_LIBGUESTFS/,/^endif HAVE_LIBGUESTFS/d' tests/Makefile.am sed -i -e '/^if HAVE_GUESTFISH/,/^endif HAVE_GUESTFISH/d' tests/Makefile.am -autoreconf -i +automake %endif +# Ancient qemu-io in RHEL 7 doesn't support -f FORMAT option. However +# we can just omit it and the tests still work fine. +for f in tests/*.sh; do + sed -i -e 's/qemu-io -f raw/qemu-io/g' \ + -e 's/qemu-io -r -f raw/qemu-io -r/g' $f +done + +# Disable numerous tests which cannot work with ancient gnutls or +# qemu-img on RHEL 7. +for f in tests/test-cache.sh \ + tests/test-cow.sh \ + tests/test-data-7E.sh \ + tests/test-data-file.sh \ + tests/test-data-raw.sh \ + tests/test-floppy.sh \ + tests/test-fua.sh \ + tests/test-iso.sh \ + tests/test-log.sh \ + tests/test-memory-largest-for-qemu.sh \ + tests/test-offset2.sh \ + tests/test-parallel-file.sh \ + tests/test-parallel-nbd.sh \ + tests/test-partitioning2.sh \ + tests/test-partitioning3.sh \ + tests/test-pattern.sh \ + tests/test-pattern-largest-for-qemu.sh \ + tests/test-truncate1.sh \ + tests/test-truncate2.sh ; do + rm $f + touch $f + chmod +x $f +done + # Patch doesn't set permissions correctly. XXX chmod +x tests/test-vddk.sh @@ -274,6 +292,7 @@ cp -a . "$copy" mv "$copy" python3 %configure --disable-static --with-tls-priority=NORMAL \ + --disable-lua \ --disable-perl \ --disable-ocaml \ --disable-ruby \ @@ -287,7 +306,7 @@ make %{?_smp_mflags} %if 0%{?have_python3} pushd python3 export PYTHON=%{_bindir}/python3 -%configure --disable-static --disable-perl --disable-ocaml --disable-ruby +%configure --disable-static --disable-lua --disable-perl --disable-ocaml --disable-ruby # Verify that it picked the correct version of Python # to avoid RHBZ#1404631 happening again silently. grep '^PYTHON_VERSION = 3' Makefile @@ -322,6 +341,19 @@ rm $RPM_BUILD_ROOT%{_libdir}/%{name}/plugins/nbdkit-vddk-plugin.so rm $RPM_BUILD_ROOT%{_mandir}/man1/nbdkit-vddk-plugin.1* %endif +# Remove bash-completion (if it was built) because we don't want to +# support it. +rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/bash_completion.d + +# Remove some basic plugins which we don't want to support. We may +# add these back later if there is customer demand. +rm $RPM_BUILD_ROOT%{_libdir}/%{name}/plugins/nbdkit-floppy-plugin.so +rm $RPM_BUILD_ROOT%{_mandir}/man1/nbdkit-floppy-plugin.1* +rm $RPM_BUILD_ROOT%{_libdir}/%{name}/plugins/nbdkit-iso-plugin.so +rm $RPM_BUILD_ROOT%{_mandir}/man1/nbdkit-iso-plugin.1* +rm $RPM_BUILD_ROOT%{_libdir}/%{name}/plugins/nbdkit-sh-plugin.so +rm $RPM_BUILD_ROOT%{_mandir}/man3/nbdkit-sh-plugin.3* + %check # Workaround for broken libvirt (RHBZ#1138604). @@ -350,18 +382,28 @@ make check -j1 || { %files basic-plugins %doc README %license LICENSE +%{_libdir}/%{name}/plugins/nbdkit-data-plugin.so %{_libdir}/%{name}/plugins/nbdkit-file-plugin.so %{_libdir}/%{name}/plugins/nbdkit-memory-plugin.so %{_libdir}/%{name}/plugins/nbdkit-nbd-plugin.so %{_libdir}/%{name}/plugins/nbdkit-null-plugin.so +%{_libdir}/%{name}/plugins/nbdkit-partitioning-plugin.so +%{_libdir}/%{name}/plugins/nbdkit-pattern-plugin.so +%{_libdir}/%{name}/plugins/nbdkit-random-plugin.so %{_libdir}/%{name}/plugins/nbdkit-split-plugin.so %{_libdir}/%{name}/plugins/nbdkit-streaming-plugin.so +%{_libdir}/%{name}/plugins/nbdkit-zero-plugin.so +%{_mandir}/man1/nbdkit-data-plugin.1* %{_mandir}/man1/nbdkit-file-plugin.1* %{_mandir}/man1/nbdkit-memory-plugin.1* %{_mandir}/man1/nbdkit-nbd-plugin.1* %{_mandir}/man1/nbdkit-null-plugin.1* +%{_mandir}/man1/nbdkit-partitioning-plugin.1* +%{_mandir}/man1/nbdkit-pattern-plugin.1* +%{_mandir}/man1/nbdkit-random-plugin.1* %{_mandir}/man1/nbdkit-split-plugin.1* %{_mandir}/man1/nbdkit-streaming-plugin.1* +%{_mandir}/man1/nbdkit-zero-plugin.1* %files example-plugins @@ -403,12 +445,21 @@ make check -j1 || { %{_includedir}/nbdkit-common.h %{_includedir}/nbdkit-filter.h %{_includedir}/nbdkit-plugin.h +%{_mandir}/man1/nbdkit-captive.1* %{_mandir}/man3/nbdkit-filter.3* %{_mandir}/man3/nbdkit-plugin.3* +%{_mandir}/man1/nbdkit-probing.1* +%{_mandir}/man1/nbdkit-protocol.1* +%{_mandir}/man1/nbdkit-service.1* +%{_mandir}/man1/nbdkit-tls.1* %{_libdir}/pkgconfig/nbdkit.pc %changelog +* Tue Nov 13 2018 Richard W.M. Jones - 1.8.0-1 +- Rebase to upstream stable version 1.8.0. + resolves: rhbz#1621894 + * Thu Nov 08 2018 Richard W.M. Jones - 1.2.6-1.el7_6.2 - Enhanced Python error reporting. resolves: rhbz#1613946