From 7b3756d5ec90300972e39eeedeb2fc026b6f3c4c Mon Sep 17 00:00:00 2001 From: mulhern Date: Thu, 14 Sep 2017 15:24:07 -0400 Subject: [PATCH] Update for new devicemapper consts interface. Signed-off-by: mulhern --- src/engine/consts.rs | 15 --------------- src/engine/mod.rs | 3 +-- src/engine/sim_engine/pool.rs | 3 +-- src/engine/strat_engine/blockdevmgr.rs | 3 +-- src/engine/strat_engine/device.rs | 4 +--- src/engine/strat_engine/filesystem.rs | 4 ++-- src/engine/strat_engine/metadata.rs | 4 +--- src/engine/strat_engine/thinpool.rs | 5 ++--- 8 files changed, 9 insertions(+), 32 deletions(-) delete mode 100644 src/engine/consts.rs diff --git a/src/engine/consts.rs b/src/engine/consts.rs deleted file mode 100644 index a06cdcccd5f..00000000000 --- a/src/engine/consts.rs +++ /dev/null @@ -1,15 +0,0 @@ -// This Source Code Form is subject to the terms of the Mozilla Public -// License, v. 2.0. If a copy of the MPL was not distributed with this -// file, You can obtain one at http://mozilla.org/MPL/2.0/. - -#[allow(non_upper_case_globals)] -#[allow(non_snake_case)] -pub mod IEC { - pub const Ki: u64 = 1024; - pub const Mi: u64 = 1024 * Ki; - pub const Gi: u64 = 1024 * Mi; - pub const Ti: u64 = 1024 * Gi; - pub const Pi: u64 = 1024 * Ti; - pub const Ei: u64 = 1024 * Pi; - // Ei is the maximum IEC unit expressible in u64. -} diff --git a/src/engine/mod.rs b/src/engine/mod.rs index 7067734776b..f8025fd569a 100644 --- a/src/engine/mod.rs +++ b/src/engine/mod.rs @@ -2,7 +2,7 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. -pub use self::consts::IEC; +pub use devicemapper::{IEC, SECTOR_SIZE}; pub use self::engine::Dev; pub use self::engine::Engine; @@ -28,7 +28,6 @@ mod macros; // strat_engine is public so that integration tests can access its internals. pub mod strat_engine; -mod consts; #[allow(module_inception)] pub mod engine; mod errors; diff --git a/src/engine/sim_engine/pool.rs b/src/engine/sim_engine/pool.rs index de53aedf5dc..85334196a43 100644 --- a/src/engine/sim_engine/pool.rs +++ b/src/engine/sim_engine/pool.rs @@ -13,9 +13,8 @@ use std::vec::Vec; use uuid::Uuid; -use devicemapper::Sectors; +use devicemapper::{IEC, Sectors}; -use super::super::consts::IEC; use super::super::engine::{Filesystem, HasName, HasUuid, Pool}; use super::super::errors::{EngineError, EngineResult, ErrorEnum}; use super::super::structures::Table; diff --git a/src/engine/strat_engine/blockdevmgr.rs b/src/engine/strat_engine/blockdevmgr.rs index 5da04b4fc65..95d39f5ab7b 100644 --- a/src/engine/strat_engine/blockdevmgr.rs +++ b/src/engine/strat_engine/blockdevmgr.rs @@ -12,9 +12,8 @@ use chrono::{DateTime, Duration, Utc}; use rand::{thread_rng, sample}; use uuid::Uuid; -use devicemapper::{Bytes, Device, Sectors, Segment}; +use devicemapper::{Bytes, Device, IEC, Sectors, Segment}; -use super::super::consts::IEC; use super::super::errors::{EngineError, EngineResult, ErrorEnum}; use super::super::types::{DevUuid, PoolUuid}; diff --git a/src/engine/strat_engine/device.rs b/src/engine/strat_engine/device.rs index 59ff1fdd130..4bd4d2b9468 100644 --- a/src/engine/strat_engine/device.rs +++ b/src/engine/strat_engine/device.rs @@ -14,10 +14,8 @@ use std::path::Path; use nix::sys::stat::{S_IFBLK, S_IFMT}; -use devicemapper::consts::SECTOR_SIZE; -use devicemapper::{Bytes, Device, Sectors}; +use devicemapper::{Bytes, Device, IEC, SECTOR_SIZE, Sectors}; -use super::super::consts::IEC; use super::super::errors::{EngineResult, EngineError, ErrorEnum}; ioctl!(read blkgetsize64 with 0x12, 114; u64); diff --git a/src/engine/strat_engine/filesystem.rs b/src/engine/strat_engine/filesystem.rs index 402895d6a35..3770b4d2d91 100644 --- a/src/engine/strat_engine/filesystem.rs +++ b/src/engine/strat_engine/filesystem.rs @@ -5,8 +5,8 @@ use std::path::{Path, PathBuf}; use std::process::Command; -use devicemapper::{Bytes, DmDevice, DM, Sectors, ThinDev, ThinDevId, ThinStatus, ThinPoolDev}; -use devicemapper::consts::{IEC, SECTOR_SIZE}; +use devicemapper::{Bytes, DmDevice, DM, IEC, SECTOR_SIZE, Sectors, ThinDev, ThinDevId, ThinStatus, + ThinPoolDev}; use nix::sys::statvfs::statvfs; use nix::sys::statvfs::vfs::Statvfs; diff --git a/src/engine/strat_engine/metadata.rs b/src/engine/strat_engine/metadata.rs index c87ca19f703..dc40632e1ec 100644 --- a/src/engine/strat_engine/metadata.rs +++ b/src/engine/strat_engine/metadata.rs @@ -10,10 +10,8 @@ use chrono::{DateTime, Utc}; use crc::crc32; use uuid::Uuid; -use devicemapper::{Bytes, Sectors}; -use devicemapper::consts::SECTOR_SIZE; +use devicemapper::{Bytes, IEC, SECTOR_SIZE, Sectors}; -use super::super::consts::IEC; use super::super::errors::{EngineResult, EngineError, ErrorEnum}; use super::super::types::{DevUuid, PoolUuid}; diff --git a/src/engine/strat_engine/thinpool.rs b/src/engine/strat_engine/thinpool.rs index d8764eb7f7c..13591b5a947 100644 --- a/src/engine/strat_engine/thinpool.rs +++ b/src/engine/strat_engine/thinpool.rs @@ -10,11 +10,10 @@ use std::process::Command; use uuid::Uuid; use devicemapper as dm; -use devicemapper::{DM, DataBlocks, DmDevice, DmError, LinearDev, MetaBlocks, Sectors, Segment, - ThinDev, ThinDevId, ThinPoolDev, ThinPoolWorkingStatus}; +use devicemapper::{DM, DataBlocks, DmDevice, DmError, IEC, LinearDev, MetaBlocks, Sectors, + Segment, ThinDev, ThinDevId, ThinPoolDev, ThinPoolWorkingStatus}; use devicemapper::ErrorEnum::CheckFailed; -use super::super::consts::IEC; use super::super::engine::{Filesystem, HasName}; use super::super::errors::{EngineError, EngineResult, ErrorEnum}; use super::super::structures::Table;