From 1c1ba693399a7d5ffd45464869a4a1964d268d15 Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Mon, 8 Jan 2018 02:06:48 +0100 Subject: [PATCH] fix build on 32bit Signed-off-by: Igor Gnatenko --- 0001-cast-stat.f_bsize-to-u64.patch | 60 +++++++++++++++++++++++++++++ stratisd.spec | 2 + 2 files changed, 62 insertions(+) create mode 100644 0001-cast-stat.f_bsize-to-u64.patch diff --git a/0001-cast-stat.f_bsize-to-u64.patch b/0001-cast-stat.f_bsize-to-u64.patch new file mode 100644 index 0000000..e1fa252 --- /dev/null +++ b/0001-cast-stat.f_bsize-to-u64.patch @@ -0,0 +1,60 @@ +From fb276f9634e2a2aa935fb23e541cb2d60674f756 Mon Sep 17 00:00:00 2001 +From: Igor Gnatenko +Date: Mon, 8 Jan 2018 01:52:33 +0100 +Subject: [PATCH] cast stat.f_bsize to u64 + +It's defined as c_ulong and compilation fails on 32bit systems with: + --> src/engine/strat_engine/thinpool/filesystem.rs:233:30 + | +233 | Ok((Bytes(stat.f_bsize * stat.f_blocks), Bytes(stat.f_bsize * (stat.f_blocks - stat.f_bfree)))) + | ^^^^^^^^^^^^^ expected u32, found u64 +error[E0308]: mismatched types + --> src/engine/strat_engine/thinpool/filesystem.rs:233:15 + | +233 | Ok((Bytes(stat.f_bsize * stat.f_blocks), Bytes(stat.f_bsize * (stat.f_blocks - stat.f_bfree)))) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected u64, found u32 +error[E0277]: the trait bound `u32: std::ops::Mul` is not satisfied + --> src/engine/strat_engine/thinpool/filesystem.rs:233:28 + | +233 | Ok((Bytes(stat.f_bsize * stat.f_blocks), Bytes(stat.f_bsize * (stat.f_blocks - stat.f_bfree)))) + | ^ no implementation for `u32 * u64` + | + = help: the trait `std::ops::Mul` is not implemented for `u32` +error[E0308]: mismatched types + --> src/engine/strat_engine/thinpool/filesystem.rs:233:67 + | +233 | Ok((Bytes(stat.f_bsize * stat.f_blocks), Bytes(stat.f_bsize * (stat.f_blocks - stat.f_bfree)))) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected u32, found u64 +error[E0308]: mismatched types + --> src/engine/strat_engine/thinpool/filesystem.rs:233:52 + | +233 | Ok((Bytes(stat.f_bsize * stat.f_blocks), Bytes(stat.f_bsize * (stat.f_blocks - stat.f_bfree)))) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected u64, found u32 +error[E0277]: the trait bound `u32: std::ops::Mul` is not satisfied + --> src/engine/strat_engine/thinpool/filesystem.rs:233:65 + | +233 | Ok((Bytes(stat.f_bsize * stat.f_blocks), Bytes(stat.f_bsize * (stat.f_blocks - stat.f_bfree)))) + | ^ no implementation for `u32 * u64` + | + = help: the trait `std::ops::Mul` is not implemented for `u32` + +Fixes: https://github.com/stratis-storage/stratisd/issues/707 +Signed-off-by: Igor Gnatenko +--- + src/engine/strat_engine/thinpool/filesystem.rs | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/engine/strat_engine/thinpool/filesystem.rs b/src/engine/strat_engine/thinpool/filesystem.rs +index d381644..97aa5d4 100644 +--- a/src/engine/strat_engine/thinpool/filesystem.rs ++++ b/src/engine/strat_engine/thinpool/filesystem.rs +@@ -230,5 +230,5 @@ impl Recordable for StratFilesystem { + pub fn fs_usage(mount_point: &Path) -> EngineResult<(Bytes, Bytes)> { + let mut stat = Statvfs::default(); + statvfs(mount_point, &mut stat)?; +- Ok((Bytes(stat.f_bsize * stat.f_blocks), Bytes(stat.f_bsize * (stat.f_blocks - stat.f_bfree)))) ++ Ok((Bytes(stat.f_bsize as u64 * stat.f_blocks), Bytes(stat.f_bsize as u64 * (stat.f_blocks - stat.f_bfree)))) + } +-- +2.15.1 + diff --git a/stratisd.spec b/stratisd.spec index 90e89ea..5f13cd4 100644 --- a/stratisd.spec +++ b/stratisd.spec @@ -19,6 +19,8 @@ Patch0003: 0003-deps-update-byteorder-to-1.patch Patch0004: 0004-deps-update-env_logger-to-0.4.patch Patch0005: 0005-deps-update-clap-to-2.patch Patch0006: 0006-deps-update-loopdev-to-0.2.patch +# https://github.com/stratis-storage/stratisd/pull/709 +Patch1001: 0001-cast-stat.f_bsize-to-u64.patch ExclusiveArch: %{rust_arches}