cp2 0.3.0

Pure-Rust cp & rsync-style copy/sync tool for local or network files, with delta transfer and verification (Linux, macOS, Windows)
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
//! Storage-class detection (rotational HDD vs SSD/NVMe) for adaptive worker
//! tuning.
//!
//! The sync engine adapts its concurrency to the storage it writes (or
//! hashes): a single spinning disk is a serial device — parallel writers
//! cause seek thrash — while SSD/NVMe scale with concurrency. Detection is
//! best-effort: any failure or unknown filesystem (network mounts, virtual
//! filesystems, unsupported platforms) yields [`StorageClass::Unknown`], and
//! callers fall back to their SSD defaults. An explicit user override
//! (`--storage hdd|ssd`) always wins over detection.
//!
//! Detection per platform: Linux reads `/sys/dev/block/<maj>:<min>/queue/
//! rotational` (device-mapper/md/loop aggregates via `slaves/`); Windows
//! queries `IOCTL_STORAGE_QUERY_PROPERTY` (seek-penalty) on the path's
//! volume handle — no admin rights or `PowerShell` needed; macOS shells out to
//! Apple's `diskutil info` (`Solid State` field). Other platforms report
//! `Unknown`.

use std::path::Path;
use std::str::FromStr;

/// Detected storage class of a filesystem.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum StorageClass {
    /// Rotational media: seeks are expensive, keep concurrency low.
    Hdd,
    /// Non-rotational media (SSD/NVMe): parallel I/O helps.
    Ssd,
    /// Not determinable (non-Linux, network/virtual fs, missing path, ...).
    Unknown,
}

/// User preference for storage class (`--storage`).
///
/// `Auto` (the default) enables detection; `Hdd`/`Ssd` force the class,
/// skipping detection entirely.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub enum StoragePreference {
    #[default]
    Auto,
    Hdd,
    Ssd,
}

impl FromStr for StoragePreference {
    type Err = String;

    fn from_str(s: &str) -> Result<Self, Self::Err> {
        match s.trim().to_ascii_lowercase().as_str() {
            "auto" => Ok(Self::Auto),
            "hdd" => Ok(Self::Hdd),
            "ssd" => Ok(Self::Ssd),
            other => Err(format!(
                "invalid storage '{other}' (expected auto, hdd, or ssd)"
            )),
        }
    }
}

impl std::fmt::Display for StoragePreference {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        // Lowercase so the output round-trips through `FromStr` (which is how
        // the forwarded `--storage` flag is parsed on the remote side).
        match self {
            Self::Auto => f.write_str("auto"),
            Self::Hdd => f.write_str("hdd"),
            Self::Ssd => f.write_str("ssd"),
        }
    }
}

// Production never converts a detected storage class into a preference (the
// `--storage auto → resolved class` reporting path doesn't fold back into a
// preference), so this conversion only serves the round-trip tests.
#[cfg(test)]
impl From<StorageClass> for StoragePreference {
    fn from(class: StorageClass) -> Self {
        match class {
            StorageClass::Hdd => Self::Hdd,
            StorageClass::Ssd => Self::Ssd,
            StorageClass::Unknown => Self::Auto,
        }
    }
}

/// Detect the storage class backing `path` (the filesystem it lives on).
///
/// Linux: `stat` the path, decode `st_dev` into a major:minor device number,
/// and read `/sys/dev/block/<major>:<minor>/queue/rotational`. Windows: open
/// the path's volume and query the seek-penalty property. macOS: run
/// `diskutil info` and read the `Solid State` field. Other platforms always
/// report [`StorageClass::Unknown`].
#[must_use]
pub fn detect_storage(path: &Path) -> StorageClass {
    #[cfg(target_os = "linux")]
    {
        use std::os::unix::fs::MetadataExt;
        let Ok(meta) = std::fs::metadata(path) else {
            return StorageClass::Unknown;
        };
        let dev = meta.dev();
        let sys_dev =
            Path::new("/sys/dev/block").join(format!("{}:{}", dev_major(dev), dev_minor(dev)));
        classify_sysfs_device(&sys_dev)
    }
    #[cfg(target_os = "windows")]
    {
        detect_storage_windows(path)
    }
    #[cfg(target_os = "macos")]
    {
        detect_storage_macos(path)
    }
    #[cfg(not(any(target_os = "linux", target_os = "windows", target_os = "macos")))]
    {
        let _ = path;
        StorageClass::Unknown
    }
}

/// Detect the storage class on macOS via `diskutil info <path>`.
///
/// Apple's own tool reports `Solid State: Yes|No` (plus `Media Type` on
/// newer systems); parsing its fixed English output is far less risky than a
/// raw IOKit/CoreFoundation walk (APFS container chains, whole-disk parent
/// traversal, CF memory management), and the spawn happens once per sync at
/// negligible cost. Any failure → [`StorageClass::Unknown`].
#[cfg(target_os = "macos")]
fn detect_storage_macos(path: &Path) -> StorageClass {
    let output = std::process::Command::new("diskutil")
        .arg("info")
        .arg(path)
        .output();
    match output {
        Ok(out) if out.status.success() => {
            parse_diskutil_class(&String::from_utf8_lossy(&out.stdout))
                .unwrap_or(StorageClass::Unknown)
        }
        _ => StorageClass::Unknown,
    }
}

/// Parse `diskutil info` text output into a storage class.
///
/// Prefers the `Solid State: Yes|No` field (stable across macOS versions),
/// falling back to `Media Type: SSD|HDD`. Pure so it is unit-testable on any
/// platform; compiled only on macOS and in test builds.
#[cfg(any(target_os = "macos", test))]
fn parse_diskutil_class(text: &str) -> Option<StorageClass> {
    for line in text.lines() {
        if let Some(value) = line.trim().strip_prefix("Solid State:") {
            return match value.trim() {
                "Yes" => Some(StorageClass::Ssd),
                "No" => Some(StorageClass::Hdd),
                _ => None,
            };
        }
    }
    for line in text.lines() {
        if let Some(value) = line.trim().strip_prefix("Media Type:") {
            return match value.trim() {
                "SSD" => Some(StorageClass::Ssd),
                "HDD" => Some(StorageClass::Hdd),
                _ => None,
            };
        }
    }
    None
}

#[cfg(target_os = "windows")]
use windows_sys::Win32::Foundation::HANDLE;

/// Detect the storage class on Windows: resolve `path` to its volume mount
/// point (`GetVolumePathNameW` → `GetVolumeNameForVolumeMountPointW`), open
/// the volume, and query `StorageDeviceSeekPenaltyProperty`. An SSD/NVMe
/// reports no seek penalty; a spinning disk reports one. Any failure (UNC
/// path without a local volume, permissions, exotic filesystems) →
/// [`StorageClass::Unknown`].
#[cfg(target_os = "windows")]
#[allow(clippy::cast_possible_truncation)]
fn detect_storage_windows(path: &Path) -> StorageClass {
    use std::os::windows::ffi::OsStrExt;
    use windows_sys::Win32::Foundation::{CloseHandle, INVALID_HANDLE_VALUE};
    use windows_sys::Win32::Storage::FileSystem::{
        CreateFileW, FILE_SHARE_READ, FILE_SHARE_WRITE, GetVolumeNameForVolumeMountPointW,
        GetVolumePathNameW, OPEN_EXISTING,
    };

    let path_wide: Vec<u16> = path.as_os_str().encode_wide().chain(Some(0)).collect();

    // Resolve the path to its volume mount point (handles drive letters and
    // volumes mounted on folders).
    let mut mount_point = vec![0u16; 512];
    // SAFETY: `path_wide` is a NUL-terminated wide string; `mount_point`
    // points to a 512-element buffer whose length is passed as `cchBuffer`.
    let ok = unsafe {
        GetVolumePathNameW(
            path_wide.as_ptr(),
            mount_point.as_mut_ptr(),
            mount_point.len() as u32,
        )
    };
    if ok == 0 {
        return StorageClass::Unknown;
    }

    // Map the mount point to a volume GUID (`\\?\Volume{...}\`) we can open.
    let mut volume_guid = vec![0u16; 512];
    // SAFETY: `mount_point` is a NUL-terminated wide string; `volume_guid`
    // points to a 512-element buffer whose length is passed as `cchBuffer`.
    let ok = unsafe {
        GetVolumeNameForVolumeMountPointW(
            mount_point.as_ptr(),
            volume_guid.as_mut_ptr(),
            volume_guid.len() as u32,
        )
    };
    if ok == 0 {
        return StorageClass::Unknown;
    }

    // SAFETY: `volume_guid` is a NUL-terminated wide string; the remaining
    // arguments are null pointers/zeroes (no security attributes, no template).
    let handle = unsafe {
        CreateFileW(
            volume_guid.as_ptr(),
            0, // no access rights needed for the property query
            FILE_SHARE_READ | FILE_SHARE_WRITE,
            std::ptr::null(),
            OPEN_EXISTING,
            0,
            std::ptr::null_mut(),
        )
    };
    if handle == INVALID_HANDLE_VALUE {
        return StorageClass::Unknown;
    }
    let class = match query_seek_penalty(handle) {
        Some(true) => StorageClass::Hdd,
        Some(false) => StorageClass::Ssd,
        None => StorageClass::Unknown,
    };
    // SAFETY: `handle` is the valid open handle returned by `CreateFileW`
    // above (checked against `INVALID_HANDLE_VALUE`).
    unsafe { CloseHandle(handle) };
    class
}

/// Query whether the device behind `handle` incurs a seek penalty
/// (`true` = rotating disk, `false` = SSD/NVMe) via
/// `IOCTL_STORAGE_QUERY_PROPERTY` / `StorageDeviceSeekPenaltyProperty`.
#[cfg(target_os = "windows")]
#[allow(clippy::cast_possible_truncation)]
fn query_seek_penalty(handle: HANDLE) -> Option<bool> {
    use windows_sys::Win32::System::IO::DeviceIoControl;
    use windows_sys::Win32::System::Ioctl::{
        DEVICE_SEEK_PENALTY_DESCRIPTOR, IOCTL_STORAGE_QUERY_PROPERTY, PropertyStandardQuery,
        STORAGE_PROPERTY_QUERY, StorageDeviceSeekPenaltyProperty,
    };

    let query = STORAGE_PROPERTY_QUERY {
        PropertyId: StorageDeviceSeekPenaltyProperty,
        QueryType: PropertyStandardQuery,
        AdditionalParameters: [0],
    };
    let mut descriptor = DEVICE_SEEK_PENALTY_DESCRIPTOR::default();
    let mut bytes_returned = 0u32;
    // SAFETY: `query` and `descriptor` are valid objects of the exact types
    // and sizes passed as `nInBufferSize`/`nOutBufferSize`; `bytes_returned`
    // is a valid out-pointer; `handle` is an open handle from `CreateFileW`.
    let ok = unsafe {
        DeviceIoControl(
            handle,
            IOCTL_STORAGE_QUERY_PROPERTY,
            (&raw const query).cast::<core::ffi::c_void>(),
            core::mem::size_of::<STORAGE_PROPERTY_QUERY>() as u32,
            (&raw mut descriptor).cast::<core::ffi::c_void>(),
            core::mem::size_of::<DEVICE_SEEK_PENALTY_DESCRIPTOR>() as u32,
            &raw mut bytes_returned,
            std::ptr::null_mut(),
        )
    };
    if ok == 0 {
        return None;
    }
    Some(descriptor.IncursSeekPenalty)
}

/// Classify a block device from its sysfs directory
/// (`/sys/dev/block/<major>:<minor>`).
///
/// A `queue/rotational` file of `1` marks rotational media (HDD); `0` marks
/// SSD/NVMe. Aggregated devices (device-mapper, md RAID, loop) often lack
/// `queue/rotational` and expose their backing devices under `slaves/` —
/// recurse and aggregate: any rotational slave makes the aggregate an HDD.
#[cfg(target_os = "linux")]
pub(crate) fn classify_sysfs_device(sys_dev: &Path) -> StorageClass {
    if let Ok(rotational) = std::fs::read_to_string(sys_dev.join("queue/rotational")) {
        return match rotational.trim() {
            "1" => StorageClass::Hdd,
            "0" => StorageClass::Ssd,
            // An empty or unparseable value is not evidence of an SSD.
            _ => StorageClass::Unknown,
        };
    }
    let Ok(slaves) = std::fs::read_dir(sys_dev.join("slaves")) else {
        return StorageClass::Unknown;
    };
    let mut seen = false;
    for entry in slaves.flatten() {
        seen = true;
        if classify_sysfs_device(&entry.path()) == StorageClass::Hdd {
            return StorageClass::Hdd;
        }
    }
    if seen {
        StorageClass::Ssd
    } else {
        StorageClass::Unknown
    }
}

/// Decode the major number from a Linux `st_dev` (`new_encode_dev` layout).
///
/// The kernel encodes `mkdev(major, minor)` into `st_dev` with
/// `new_encode_dev`; the inverse (as used by GNU coreutils `stat`) is:
/// major = `((dev >> 8) & 0xfff) | ((dev >> 32) & !0xfff)`.
// The bit masks bound the result to 20 bits, so the u32 cast cannot truncate.
#[cfg(target_os = "linux")]
#[expect(clippy::cast_possible_truncation)]
fn dev_major(dev: u64) -> u32 {
    (((dev >> 8) & 0xfff) | ((dev >> 32) & !0xfff)) as u32
}

/// Decode the minor number from a Linux `st_dev` (`new_encode_dev` layout).
// The bit masks bound the result to 20 bits, so the u32 cast cannot truncate.
#[cfg(target_os = "linux")]
#[expect(clippy::cast_possible_truncation)]
fn dev_minor(dev: u64) -> u32 {
    ((dev & 0xff) | ((dev >> 12) & !0xff)) as u32
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn detect_storage_missing_path_is_unknown() {
        assert_eq!(
            detect_storage(Path::new("/nonexistent/cp2-storage-test")),
            StorageClass::Unknown
        );
    }

    #[test]
    fn storage_preference_parses() {
        assert_eq!(
            "auto".parse::<StoragePreference>().unwrap(),
            StoragePreference::Auto
        );
        assert_eq!(
            "HDD".parse::<StoragePreference>().unwrap(),
            StoragePreference::Hdd
        );
        assert_eq!(
            "ssd".parse::<StoragePreference>().unwrap(),
            StoragePreference::Ssd
        );
        assert!("raid".parse::<StoragePreference>().is_err());
    }

    #[test]
    fn storage_class_maps_to_preference() {
        assert_eq!(
            StoragePreference::from(StorageClass::Hdd),
            StoragePreference::Hdd
        );
        assert_eq!(
            StoragePreference::from(StorageClass::Ssd),
            StoragePreference::Ssd
        );
        assert_eq!(
            StoragePreference::from(StorageClass::Unknown),
            StoragePreference::Auto
        );
    }

    #[test]
    fn diskutil_solid_state_yes_is_ssd() {
        let out = "\
   Device Identifier:         disk3s1s1
   Device Node:               /dev/disk3s1s1
   Solid State:               Yes
   Media Type:                SSD
";
        assert_eq!(parse_diskutil_class(out), Some(StorageClass::Ssd));
    }

    #[test]
    fn diskutil_solid_state_no_is_hdd() {
        let out = "\
   Solid State:               No
";
        assert_eq!(parse_diskutil_class(out), Some(StorageClass::Hdd));
    }

    #[test]
    fn diskutil_media_type_fallback() {
        // Older diskutil variants without the Solid State field.
        assert_eq!(
            parse_diskutil_class("   Media Type:                SSD\n"),
            Some(StorageClass::Ssd)
        );
        assert_eq!(
            parse_diskutil_class("   Media Type:                HDD\n"),
            Some(StorageClass::Hdd)
        );
    }

    #[test]
    fn diskutil_solid_state_wins_over_media_type() {
        // The explicit Solid State field takes precedence.
        let out = "Solid State: No\nMedia Type: SSD\n";
        assert_eq!(parse_diskutil_class(out), Some(StorageClass::Hdd));
    }

    #[test]
    fn diskutil_unrecognized_output_is_none() {
        assert_eq!(parse_diskutil_class("diskutil: No such file"), None);
        assert_eq!(parse_diskutil_class(""), None);
        assert_eq!(parse_diskutil_class("Solid State: Maybe\n"), None);
    }

    /// Sysfs-walk tests: the `/sys/dev/block` probe is Linux-only, so these
    /// exercise `classify_sysfs_device` against tempdir fixtures.
    #[cfg(target_os = "linux")]
    mod sysfs_tests {
        use super::*;

        /// Build a fake sysfs device tree under `dir`.
        fn sysfs(dir: &std::path::Path, dev: &str) -> std::path::PathBuf {
            let root = dir.join("sys").join("dev").join("block").join(dev);
            std::fs::create_dir_all(root.join("queue")).unwrap();
            root
        }

        /// Add a `queue/rotational` file to a (possibly nested) sysfs device dir.
        fn mark_rotational(dev: &std::path::Path, value: &str) {
            std::fs::create_dir_all(dev.join("queue")).unwrap();
            std::fs::write(dev.join("queue/rotational"), value).unwrap();
        }

        /// Add a `slaves/<name>` backing device to `dev`, returning its dir.
        fn add_slave(dev: &std::path::Path, name: &str) -> std::path::PathBuf {
            let slave = dev.join("slaves").join(name);
            std::fs::create_dir_all(&slave).unwrap();
            slave
        }

        #[test]
        fn rotational_one_is_hdd() {
            let dir = tempfile::tempdir().unwrap();
            let dev = sysfs(dir.path(), "8:0");
            std::fs::write(dev.join("queue/rotational"), "1").unwrap();
            assert_eq!(classify_sysfs_device(&dev), StorageClass::Hdd);
        }

        #[test]
        fn rotational_zero_is_ssd() {
            let dir = tempfile::tempdir().unwrap();
            let dev = sysfs(dir.path(), "259:0");
            std::fs::write(dev.join("queue/rotational"), "0").unwrap();
            assert_eq!(classify_sysfs_device(&dev), StorageClass::Ssd);
        }

        #[test]
        fn unrecognized_rotational_is_unknown() {
            // An empty or unparseable value must not be misclassified as SSD.
            let dir = tempfile::tempdir().unwrap();
            let dev = sysfs(dir.path(), "8:0");
            std::fs::write(dev.join("queue/rotational"), "").unwrap();
            assert_eq!(classify_sysfs_device(&dev), StorageClass::Unknown);
        }

        #[test]
        fn rotational_trailing_newline_is_hdd() {
            let dir = tempfile::tempdir().unwrap();
            let dev = sysfs(dir.path(), "8:16");
            std::fs::write(dev.join("queue/rotational"), "1\n").unwrap();
            assert_eq!(classify_sysfs_device(&dev), StorageClass::Hdd);
        }

        #[test]
        fn missing_device_is_unknown() {
            let dir = tempfile::tempdir().unwrap();
            let dev = sysfs(dir.path(), "8:0");
            // No queue/rotational, no slaves.
            assert_eq!(classify_sysfs_device(&dev), StorageClass::Unknown);
        }

        #[test]
        fn empty_slaves_is_unknown() {
            let dir = tempfile::tempdir().unwrap();
            let dev = sysfs(dir.path(), "252:0");
            std::fs::create_dir_all(dev.join("slaves")).unwrap();
            assert_eq!(classify_sysfs_device(&dev), StorageClass::Unknown);
        }

        #[test]
        fn slaves_aggregate_rotational() {
            let dir = tempfile::tempdir().unwrap();
            let dev = sysfs(dir.path(), "252:0");
            mark_rotational(&add_slave(&dev, "sda"), "1");
            assert_eq!(classify_sysfs_device(&dev), StorageClass::Hdd);
        }

        #[test]
        fn slaves_aggregate_ssd() {
            let dir = tempfile::tempdir().unwrap();
            let dev = sysfs(dir.path(), "252:0");
            mark_rotational(&add_slave(&dev, "nvme0n1"), "0");
            assert_eq!(classify_sysfs_device(&dev), StorageClass::Ssd);
        }

        #[test]
        fn nested_slaves_aggregate() {
            // dm → loop → rotational backing: recursion must find the HDD.
            let dir = tempfile::tempdir().unwrap();
            let dev = sysfs(dir.path(), "252:1");
            mark_rotational(&add_slave(&add_slave(&dev, "loop0"), "sdb"), "1");
            assert_eq!(classify_sysfs_device(&dev), StorageClass::Hdd);
        }

        #[test]
        fn mixed_slaves_prefer_hdd() {
            let dir = tempfile::tempdir().unwrap();
            let dev = sysfs(dir.path(), "9:0");
            mark_rotational(&add_slave(&dev, "sdc"), "1");
            mark_rotational(&add_slave(&dev, "nvme1n1"), "0");
            assert_eq!(classify_sysfs_device(&dev), StorageClass::Hdd);
        }

        #[test]
        fn dev_number_decode_matches_stat() {
            use std::os::unix::fs::MetadataExt;
            // Spot-check the new_encode_dev decode against the sysfs entry the
            // kernel's own st_dev maps to. Guarded: /tmp may be on a virtual
            // filesystem (no sysfs entry), which is the Unknown case.
            let meta = std::fs::metadata("/tmp").unwrap();
            let dev = meta.dev();
            let major = dev_major(dev);
            let minor = dev_minor(dev);
            let sys_dev = Path::new("/sys/dev/block").join(format!("{major}:{minor}"));
            if sys_dev.exists() {
                // The entry existing already validates the decode (a wrong
                // major/minor would not resolve). /tmp is often on a *partition*
                // (e.g. the root disk's /dev/sda1), which has no queue/rotational
                // of its own — that lives on the parent whole disk — so it
                // legitimately classifies Unknown. Only a definite class must
                // be Hdd or Ssd; Unknown is valid here.
                let class = classify_sysfs_device(&sys_dev);
                assert!(matches!(
                    class,
                    StorageClass::Hdd | StorageClass::Ssd | StorageClass::Unknown
                ));
            }
        }
    }
}