smb-server 0.11.0

SMB2/3 file-sharing server library with pluggable storage backends.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
//! Byte patterns and volume sizes for tests.

/// `len` bytes whose values follow their offset, and `seed`.
pub(crate) fn pattern(len: usize, seed: u8) -> Vec<u8> {
    (0..len)
        .map(|i| (i as u8).wrapping_mul(31).wrapping_add((i >> 8) as u8) ^ seed)
        .collect()
}

/// Bytes in an allocation unit of the volume of `backend`.
#[cfg(all(feature = "localfs", any(target_os = "linux", windows)))]
pub(crate) async fn allocation_unit(backend: &impl crate::backend::ShareBackend) -> u64 {
    backend.volume_info().await.unwrap().allocation_unit()
}