Skip to content

Commit 5394d9d

Browse files
committed
Move SECTOR_SIZE into core
It is there that it is used. Signed-off-by: mulhern <amulhern@redhat.com>
1 parent d753501 commit 5394d9d

5 files changed

Lines changed: 8 additions & 9 deletions

File tree

src/consts.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
// License, v. 2.0. If a copy of the MPL was not distributed with this
33
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
44

5-
/// disk sector size in bytes
6-
pub const SECTOR_SIZE: usize = 512;
7-
85
#[allow(non_upper_case_globals)]
96
#[allow(non_snake_case)]
107
/// International Electrotechnical Commission Units Standards

src/core/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ pub use self::dm_flags::{DmCookie, DmFlags};
2121
pub use self::dm_options::DmOptions;
2222
pub use self::types::{
2323
Bytes, DataBlocks, DevId, DmName, DmNameBuf, DmUuid, DmUuidBuf, MetaBlocks, Sectors,
24-
TargetType, TargetTypeBuf,
24+
TargetType, TargetTypeBuf, SECTOR_SIZE,
2525
};

src/core/types.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@ use std::ops::{Add, Deref, Div, Mul, Rem};
99

1010
use serde;
1111

12-
use crate::consts::SECTOR_SIZE;
1312
use crate::result::{DmError, DmResult};
1413

1514
use crate::core::deviceinfo::{DM_NAME_LEN, DM_UUID_LEN};
1615
use crate::core::errors::ErrorKind;
1716

17+
/// disk sector size in bytes
18+
pub const SECTOR_SIZE: usize = 512;
19+
1820
/// a kernel defined block size constant for any DM meta device
1921
/// a DM meta device may store cache device or thinpool device metadata
2022
/// defined in drivers/md/persistent-data/dm-space-map-metadata.h as

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,10 @@ pub use crate::cachedev::{
128128
CacheDev, CacheDevPerformance, CacheDevStatus, CacheDevUsage, CacheDevWorkingStatus,
129129
MAX_CACHE_BLOCK_SIZE, MIN_CACHE_BLOCK_SIZE,
130130
};
131-
pub use crate::consts::{IEC, SECTOR_SIZE};
131+
pub use crate::consts::IEC;
132132
pub use crate::core::{
133133
devnode_to_devno, Bytes, DataBlocks, DevId, Device, DmCookie, DmFlags, DmName, DmNameBuf,
134-
DmOptions, DmUuid, DmUuidBuf, MetaBlocks, Sectors, TargetType, TargetTypeBuf, DM,
134+
DmOptions, DmUuid, DmUuidBuf, MetaBlocks, Sectors, TargetType, TargetTypeBuf, DM, SECTOR_SIZE,
135135
};
136136
pub use crate::lineardev::{
137137
FlakeyTargetParams, LinearDev, LinearDevTargetParams, LinearDevTargetTable, LinearTargetParams,

src/loopbacked.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ use loopdev::{LoopControl, LoopDevice};
1212
use nix;
1313
use tempfile::{self, TempDir};
1414

15-
use crate::consts::{IEC, SECTOR_SIZE};
16-
use crate::core::{Bytes, Sectors};
15+
use crate::consts::IEC;
16+
use crate::core::{Bytes, Sectors, SECTOR_SIZE};
1717
use crate::test_lib::clean_up;
1818

1919
/// send IOCTL via blkgetsize64

0 commit comments

Comments
 (0)