fix build on 32bit

Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
This commit is contained in:
Igor Gnatenko 2018-01-08 02:06:48 +01:00
parent adc97565a6
commit 1c1ba69339
2 changed files with 62 additions and 0 deletions

View File

@ -0,0 +1,60 @@
From fb276f9634e2a2aa935fb23e541cb2d60674f756 Mon Sep 17 00:00:00 2001
From: Igor Gnatenko <ignatenko@redhat.com>
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<u64>` 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<u64>` 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<u64>` 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<u64>` is not implemented for `u32`
Fixes: https://github.com/stratis-storage/stratisd/issues/707
Signed-off-by: Igor Gnatenko <ignatenko@redhat.com>
---
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<FilesystemSave> 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

View File

@ -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}