From 405f2dce509c4de4efaa06381ccb3709d5248622 Mon Sep 17 00:00:00 2001 From: Jakub Bogusz Date: Tue, 2 Jun 2020 06:37:29 +0200 Subject: [PATCH] - initial; with patches to allow build on 32-bit x86 --- vdo-types.patch | 138 +++++++++++++++++++++++++++++++++++++++++ vdo-x86.patch | 49 +++++++++++++++ vdo.spec | 159 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 346 insertions(+) create mode 100644 vdo-types.patch create mode 100644 vdo-x86.patch create mode 100644 vdo.spec diff --git a/vdo-types.patch b/vdo-types.patch new file mode 100644 index 0000000..c818a6c --- /dev/null +++ b/vdo-types.patch @@ -0,0 +1,138 @@ +--- vdo-6.2.3.91/utils/uds/fileIORegion.c.orig 2020-05-30 04:20:46.000000000 +0200 ++++ vdo-6.2.3.91/utils/uds/fileIORegion.c 2020-06-01 06:23:23.271248367 +0200 +@@ -65,7 +65,7 @@ + + if (offset + length > fior->size) { + return logErrorWithStringError(UDS_OUT_OF_RANGE, +- "range %zd-%zd not in range 0 to %zu", ++ "range %"PRId64"-%"PRId64" not in range 0 to %zu", + offset, offset + length, fior->size); + } + +--- vdo-6.2.3.91/utils/uds/indexLayout.c.orig 2020-05-30 04:20:46.000000000 +0200 ++++ vdo-6.2.3.91/utils/uds/indexLayout.c 2020-06-01 06:25:49.170457963 +0200 +@@ -955,7 +955,7 @@ + } + if (iter.nextRegion != iter.lastRegion) { + return logErrorWithStringError(UDS_UNEXPECTED_RESULT, +- "expected %ld additional regions", ++ "expected %td additional regions", + iter.lastRegion - iter.nextRegion); + } + if (iter.nextBlock != isl->indexSave.startBlock + isl->indexSave.numBlocks) { +--- vdo-6.2.3.91/utils/uds/threadsLinuxUser.c.orig 2020-05-30 04:20:46.000000000 +0200 ++++ vdo-6.2.3.91/utils/uds/threadsLinuxUser.c 2020-06-01 06:28:58.816097231 +0200 +@@ -112,7 +112,7 @@ + int joinThreads(pthread_t th) + { + int result = pthread_join(th, NULL); +- return ASSERT_WITH_ERROR_CODE((result == 0), result, "th: %zu", th); ++ return ASSERT_WITH_ERROR_CODE((result == 0), result, "th: %lu", th); + } + + /**********************************************************************/ +--- vdo-6.2.3.91/utils/uds/timeUtils.c.orig 2020-05-30 04:20:46.000000000 +0200 ++++ vdo-6.2.3.91/utils/uds/timeUtils.c 2020-06-01 06:31:48.701843548 +0200 +@@ -69,7 +69,7 @@ + if (!isValidTime(time)) { + return time; + } +- if ((reltime >= 0) && (reltime < 10 * BILLION)) { ++ if ((reltime >= 0) && (reltime < 10LL * BILLION)) { + reltime += time.tv_nsec; + while (reltime >= BILLION) { + reltime -= BILLION; +@@ -80,7 +80,7 @@ + } + // may not be accurate for times before the Epoch... + // (is the ns time positive or negative for negative time_t?) +- int64_t ns = time.tv_sec * BILLION + time.tv_nsec; ++ int64_t ns = (int64_t)time.tv_sec * BILLION + time.tv_nsec; + if ((ns < INT64_MIN / 2) || + (ns > INT64_MAX / 2) || + (reltime < INT64_MIN / 2) || +@@ -130,8 +130,8 @@ + RelTime timeDifference(AbsTime a, AbsTime b) + { + if (isValidTime(a) && isValidTime(b)) { +- int64_t ans = a.tv_sec * BILLION + a.tv_nsec; +- int64_t bns = b.tv_sec * BILLION + b.tv_nsec; ++ int64_t ans = (int64_t)a.tv_sec * BILLION + a.tv_nsec; ++ int64_t bns = (int64_t)b.tv_sec * BILLION + b.tv_nsec; + return ans - bns; + } else if (isValidTime(a)) { + return INT64_MAX; +--- vdo-6.2.3.91/utils/vdo/user/fileLayer.c.orig 2020-05-30 04:20:46.000000000 +0200 ++++ vdo-6.2.3.91/utils/vdo/user/fileLayer.c 2020-06-01 07:08:45.456501024 +0200 +@@ -291,8 +291,8 @@ + layer->blockCount = deviceBlocks; + } else if (layer->blockCount != deviceBlocks) { + result = logErrorWithStringError(VDO_PARAMETER_MISMATCH, +- "physical size %ld 4k blocks must match" +- " physical size %ld 4k blocks of %s", ++ "physical size %"PRId64" 4k blocks must match" ++ " physical size %"PRId64" 4k blocks of %s", + layer->blockCount, deviceBlocks, + layer->name); + tryCloseFile(layer->fd); +--- vdo-6.2.3.91/utils/vdo/user/vdodebugmetadata.c.orig 2020-05-30 04:20:46.000000000 +0200 ++++ vdo-6.2.3.91/utils/vdo/user/vdodebugmetadata.c 2020-06-01 07:11:47.872179460 +0200 +@@ -320,7 +320,7 @@ + result = layer->allocateIOBuffer(layer, journalBytes, + "recovery journal", &rawJournalBytes); + if (result != VDO_SUCCESS) { +- errx(1, "Could not allocate %" PRIu64" bytes for the journal", ++ errx(1, "Could not allocate %zu bytes for the journal", + journalBytes); + } + +@@ -614,14 +614,14 @@ + char *filename; + int result = ALLOCATE(MAX_PBNS, PhysicalBlockNumber, __func__, &pbns); + if (result != VDO_SUCCESS) { +- errx(1, "Could not allocate %" PRIu64 " bytes", ++ errx(1, "Could not allocate %zu bytes", + sizeof(PhysicalBlockNumber) * MAX_PBNS); + } + + result = ALLOCATE(MAX_SEARCH_LBNS, LogicalBlockNumber, __func__, + &searchLBNs); + if (result != VDO_SUCCESS) { +- errx(1, "Could not allocate %" PRIu64 " bytes", ++ errx(1, "Could not allocate %zu bytes", + sizeof(LogicalBlockNumber) * MAX_SEARCH_LBNS); + } + +--- vdo-6.2.3.91/utils/vdo/user/vdodumpmetadata.c.orig 2020-05-30 04:20:46.000000000 +0200 ++++ vdo-6.2.3.91/utils/vdo/user/vdodumpmetadata.c 2020-06-01 07:12:18.685345864 +0200 +@@ -350,7 +350,7 @@ + { + int result = ALLOCATE(MAX_LBNS, PhysicalBlockNumber, __func__, &lbns); + if (result != VDO_SUCCESS) { +- errx(1, "Could not allocate %" PRIu64 " bytes", ++ errx(1, "Could not allocate %zu bytes", + sizeof(PhysicalBlockNumber) * MAX_LBNS); + } + +--- vdo-6.2.3.91/utils/vdo/user/vdolistmetadata.c.orig 2020-05-30 04:20:46.000000000 +0200 ++++ vdo-6.2.3.91/utils/vdo/user/vdolistmetadata.c 2020-06-01 07:12:54.471818659 +0200 +@@ -115,7 +115,7 @@ + PhysicalBlockNumber startBlock, + BlockCount count) + { +- printf("%ld .. %ld: %s\n", startBlock, startBlock + count - 1, label); ++ printf("%"PRId64" .. %"PRId64": %s\n", startBlock, startBlock + count - 1, label); + } + + /**********************************************************************/ +--- vdo-6.2.3.91/utils/vdo/user/vdoregenerategeometry.c.orig 2020-05-30 04:20:46.000000000 +0200 ++++ vdo-6.2.3.91/utils/vdo/user/vdoregenerategeometry.c 2020-06-01 07:14:56.551157299 +0200 +@@ -89,7 +89,7 @@ + static int candidateCount = 0; + + static char *fileName = NULL; +-static size_t offset = 0; ++static uint64_t offset = 0; + + /** + * Explain how this command-line tool is used. diff --git a/vdo-x86.patch b/vdo-x86.patch new file mode 100644 index 0000000..6618347 --- /dev/null +++ b/vdo-x86.patch @@ -0,0 +1,49 @@ +--- vdo-6.2.3.91/utils/uds/cpu.h.orig 2020-05-30 04:20:46.000000000 +0200 ++++ vdo-6.2.3.91/utils/uds/cpu.h 2020-05-31 22:25:52.049798685 +0200 +@@ -36,7 +36,7 @@ + #define CACHE_LINE_BYTES 128 + #elif defined(__s390x__) + #define CACHE_LINE_BYTES 256 +-#elif defined(__x86_64__) || defined(__aarch64__) ++#elif defined(__x86_64__) || defined(__i386__) || defined(__aarch64__) + #define CACHE_LINE_BYTES 64 + #else + #error "unknown cache line size" +--- vdo-6.2.3.91/utils/uds/atomicDefs.h.orig 2020-05-30 04:20:46.000000000 +0200 ++++ vdo-6.2.3.91/utils/uds/atomicDefs.h 2020-05-31 22:27:07.692722226 +0200 +@@ -81,7 +81,7 @@ + **/ + static INLINE void smp_mb(void) + { +-#if defined __x86_64__ ++#if defined __x86_64__ || defined __i386__ + /* + * X86 full fence. Supposedly __sync_synchronize() will do this, but + * either the GCC documentation is a lie or GCC is broken. +@@ -112,7 +112,7 @@ + **/ + static INLINE void smp_rmb(void) + { +-#if defined __x86_64__ ++#if defined __x86_64__ || defined __i386__ + // XXX The implementation on x86 is more aggressive than necessary. + __asm__ __volatile__("lfence" : : : "memory"); + #elif defined __aarch64__ +@@ -137,7 +137,7 @@ + **/ + static INLINE void smp_wmb(void) + { +-#if defined __x86_64__ ++#if defined __x86_64__ || defined __i386__ + // XXX The implementation on x86 is more aggressive than necessary. + __asm__ __volatile__("sfence" : : : "memory"); + #elif defined __aarch64__ +@@ -171,7 +171,7 @@ + **/ + static INLINE void smp_read_barrier_depends(void) + { +-#if defined(__x86_64__) || defined(__PPC__) || defined(__s390__) \ ++#if defined(__x86_64__) || defined(__i386__) || defined(__PPC__) || defined(__s390__) \ + || defined(__aarch64__) + // Nothing needed for these architectures. + #else diff --git a/vdo.spec b/vdo.spec new file mode 100644 index 0000000..9d530da --- /dev/null +++ b/vdo.spec @@ -0,0 +1,159 @@ +Summary: Management tools for Virtual Data Optimizer +Summary(pl.UTF-8): Narzędzia do zarządzania podsystemem Virtual Data Optimizer +Name: vdo +Version: 6.2.3.91 +Release: 1 +License: GPL v2 +Group: Applications/System +#Source0Download: https://github.com/dm-vdo/vdo/releases +Source0: https://github.com/dm-vdo/vdo/archive/%{version}/%{name}-%{version}.tar.gz +# Source0-md5: a4eeab4f23938683ef3c0d0bcd2e34ad +Patch0: %{name}-x86.patch +Patch1: %{name}-types.patch +URL: http://github.com/dm-vdo/vdo +BuildRequires: device-mapper-devel +BuildRequires: libblkid-devel +BuildRequires: libuuid-devel >= 2.23 +BuildRequires: python3 >= 1:3.6 +BuildRequires: python3-devel >= 1:3.6 +BuildRequires: valgrind +BuildRequires: zlib-devel +Requires: libuuid >= 2.23 +Requires: lvm2 +Requires: python3 >= 1:3.6 +Requires: python3-PyYAML >= 3.10 +#Suggests: kernel-kvdo >= 6.2 +ExclusiveArch: %{ix86} %{x8664} x32 aarch64 ppc ppc64 s390x +BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) + +%description +Virtual Data Optimizer (VDO) is a device mapper target that delivers +block-level deduplication, compression, and thin provisioning. + +This package provides the user-space management tools for VDO. + +%description -l pl.UTF-8 +Virtual Data Optimizer (VDO) to cel device mappera zapewniający +deduplikację, kompresję i "thin provisioning" na poziomie bloków. + +Ten pakiet zawiera narzędzia przestrzeni użytkownika do zarządzania +VDO. + +%package -n bash-completion-vdo +Summary: Bash completion for VDO management commands +Summary(pl.UTF-8): Bashowe uzupełnianie parametrów poleceń do zarządzania VDO +Group: Applications/Shells +Requires: %{name} = %{version}-%{release} +Requires: bash-completion + +%description -n bash-completion-vdo +Bash completion for VDO management commands. + +%description -n bash-completion-vdo -l pl.UTF-8 +Bashowe uzupełnianie parametrów poleceń do zarządzania VDO. + +%package support +Summary: Support tools for Virtual Data Optimizer +Summary(pl.UTF-8): Narzędzia wspomagające dla podsystemu Virtual Data Optimizer +Group: Applications/System +Requires: libuuid >= 2.23 + +%description support +Virtual Data Optimizer (VDO) is a device mapper target that delivers +block-level deduplication, compression, and thin provisioning. + +This package provides the user-space support tools for VDO. + +%description support -l pl.UTF-8 +Virtual Data Optimizer (VDO) to cel device mappera zapewniający +deduplikację, kompresję i "thin provisioning" na poziomie bloków. + +Ten pakiet zawiera narzędzia wspomagające przestrzeni użytkownika dla +VDO. + +%prep +%setup -q +%patch0 -p1 +%patch1 -p1 + +%build +%{__make} \ + CC="%{__cc}" \ + OPT_FLAGS="%{rpmcflags} -fno-omit-frame-pointer" + +%install +rm -rf $RPM_BUILD_ROOT + +%{__make} install \ + DESTDIR=$RPM_BUILD_ROOT \ + INSTALLOWNER= \ + bindir=%{_bindir} \ + defaultdocdir=%{_docdir} \ + python3_sitelib=%{py3_sitescriptdir} \ + mandir=%{_mandir} \ + unitdir=%{systemdunitdir} \ + sysconfdir=%{_sysconfdir} + +%py3_comp $RPM_BUILD_ROOT%{py3_sitescriptdir} +%py3_ocomp $RPM_BUILD_ROOT%{py3_sitescriptdir} + +# packaged as %doc +%{__rm} -r $RPM_BUILD_ROOT%{_docdir}/%{name} + +%clean +rm -rf $RPM_BUILD_ROOT + +%post +%systemd_post vdo.service + +%preun +%systemd_preun vdo.service + +%postun +%systemd_postun_with_restart vdo.service + +%files +%defattr(644,root,root,755) +%doc CONTRIBUTORS.txt README.md examples/{ansible,monitor} +%attr(755,root,root) %{_bindir}/vdo +%attr(755,root,root) %{_bindir}/vdo-by-dev +%attr(755,root,root) %{_bindir}/vdostats +%attr(755,root,root) %{_bindir}/vdodmeventd +%attr(755,root,root) %{_bindir}/vdodumpconfig +%attr(755,root,root) %{_bindir}/vdoforcerebuild +%attr(755,root,root) %{_bindir}/vdoformat +%attr(755,root,root) %{_bindir}/vdosetuuid +%{py3_sitescriptdir}/%{name} +%{systemdunitdir}/vdo.service +%{systemdunitdir}/vdo-start-by-dev@.service +/lib/systemd/system-preset/97-vdo.preset +%{_sysconfdir}/udev/rules.d/69-vdo-start-by-dev.rules +%{_mandir}/man8/vdo.8* +%{_mandir}/man8/vdostats.8* +%{_mandir}/man8/vdodmeventd.8* +%{_mandir}/man8/vdodumpconfig.8* +%{_mandir}/man8/vdoforcerebuild.8* +%{_mandir}/man8/vdoformat.8* +%{_mandir}/man8/vdosetuuid.8* + +%files -n bash-completion-vdo +%defattr(644,root,root,755) +/etc/bash_completion.d/vdo +/etc/bash_completion.d/vdostats + +%files support +%defattr(644,root,root,755) +%attr(755,root,root) %{_bindir}/vdoaudit +%attr(755,root,root) %{_bindir}/vdodebugmetadata +%attr(755,root,root) %{_bindir}/vdodumpblockmap +%attr(755,root,root) %{_bindir}/vdodumpmetadata +%attr(755,root,root) %{_bindir}/vdolistmetadata +%attr(755,root,root) %{_bindir}/vdoreadonly +%attr(755,root,root) %{_bindir}/vdoregenerategeometry +%{_mandir}/man8/vdoaudit.8* +%{_mandir}/man8/vdodebugmetadata.8* +%{_mandir}/man8/vdodumpblockmap.8* +%{_mandir}/man8/vdodumpmetadata.8* +%{_mandir}/man8/vdolistmetadata.8* +%{_mandir}/man8/vdoreadonly.8* +%{_mandir}/man8/vdoregenerategeometry.8* -- 2.44.0