Added doc-comment for `hugetlb::HugePage`

Fortune for mapped-file's current commit: Future small blessing − 末小吉
master
Avril 2 years ago
parent 13165dfbe5
commit 0a146fb14a
Signed by: flanchan
GPG Key ID: 284488987C31F630

@ -2,7 +2,7 @@
name = "mapped-file"
description = "Construct a memory mapping over any file object"
keywords = ["unix", "mmap", "generic", "file", "fd"]
version = "0.0.1"
version = "0.0.2"
edition = "2021"
repository="https://github.com/notflan/mapped-file"
license="MIT"

@ -167,7 +167,7 @@ impl NamedMemoryFile
Ok(Self(name, MemoryFile(managed)))
}
pub fn with_hugetlb(name: impl AsRef<str>, hugetlb: MapHugeFlag) -> io::Result<Self>
pub fn with_hugetlb(name: impl AsRef<str>, hugetlb: MapHugeFlag) -> io::Result<Self>
{
let name: Box<CStr> = alloc_cstring(name.as_ref()).into();
let memfd = MemoryFile(unsafe { create_raw(&name, DEFAULT_FLAGS | (hugetlb.get_mask() as c_uint)) }

@ -140,6 +140,12 @@ impl From<MapHugeFlag> for c_int
}
}
/// Provides an arbitrary huge-page size and mapping flag for that size.
///
/// Can store or create a `MAP_HUGE_*` flag for use with `mmap()`, (`MappedFile`) or `memfd_create()` (`file::MemoryFile::with_hugetlb()`)
///
/// # Usage
/// Main usage is for generating a `MapHugeFlag` via `compute_huge()`. This function may fail (rarely), so a `TryInto` impl exists for `MapHugeFlag` as well.
#[derive(Default, Clone, Copy)]
pub enum HugePage {
/// A staticly presented `MAP_HUGE_*` flag. See `MapHugeFlag` for details.

Loading…
Cancel
Save