stratisd/0001-cast-stat.f_bsize-to-u64.patch
Igor Gnatenko 1c1ba69339 fix build on 32bit
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
2018-01-08 02:06:48 +01:00

61 lines
3.1 KiB
Diff

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