1//! Filesystem operations. 2 3mod abs; 4#[cfg(not(target_os = "redox"))] 5mod at; 6mod constants; 7#[cfg(any(target_os = "android", target_os = "linux"))] 8mod copy_file_range; 9#[cfg(not(target_os = "redox"))] 10mod cwd; 11#[cfg(not(target_os = "redox"))] 12mod dir; 13#[cfg(not(any( 14 target_os = "dragonfly", 15 target_os = "haiku", 16 target_os = "illumos", 17 target_os = "ios", 18 target_os = "macos", 19 target_os = "netbsd", 20 target_os = "openbsd", 21 target_os = "redox", 22 target_os = "solaris", 23)))] 24mod fadvise; 25pub(crate) mod fcntl; 26#[cfg(any(target_os = "ios", target_os = "macos"))] 27mod fcntl_darwin; 28#[cfg(any(target_os = "ios", target_os = "macos"))] 29mod fcopyfile; 30pub(crate) mod fd; 31mod file_type; 32#[cfg(any(target_os = "ios", target_os = "macos"))] 33mod getpath; 34#[cfg(not(any( 35 target_os = "dragonfly", 36 target_os = "freebsd", 37 target_os = "haiku", 38 target_os = "illumos", 39 target_os = "ios", 40 target_os = "macos", 41 target_os = "netbsd", 42 target_os = "openbsd", 43 target_os = "redox", 44 target_os = "solaris", 45 target_os = "wasi", 46)))] 47mod makedev; 48#[cfg(any(target_os = "android", target_os = "freebsd", target_os = "linux"))] 49mod memfd_create; 50#[cfg(any(target_os = "android", target_os = "linux"))] 51mod mount; 52#[cfg(any(target_os = "android", target_os = "linux"))] 53mod openat2; 54#[cfg(any(target_os = "android", target_os = "linux"))] 55mod raw_dir; 56#[cfg(target_os = "linux")] 57mod sendfile; 58#[cfg(any(target_os = "android", target_os = "linux"))] 59mod statx; 60 61#[cfg(not(any( 62 target_os = "haiku", 63 target_os = "illumos", 64 target_os = "netbsd", 65 target_os = "redox", 66 target_os = "solaris", 67 target_os = "wasi", 68)))] 69pub use abs::statfs; 70#[cfg(not(any( 71 target_os = "haiku", 72 target_os = "illumos", 73 target_os = "redox", 74 target_os = "solaris", 75 target_os = "wasi", 76)))] 77pub use abs::statvfs; 78#[cfg(not(any(target_os = "illumos", target_os = "redox", target_os = "solaris")))] 79pub use at::accessat; 80#[cfg(any(target_os = "ios", target_os = "macos"))] 81pub use at::fclonefileat; 82#[cfg(not(any( 83 target_os = "ios", 84 target_os = "macos", 85 target_os = "redox", 86 target_os = "wasi", 87)))] 88pub use at::mknodat; 89#[cfg(any(target_os = "android", target_os = "linux"))] 90pub use at::renameat_with; 91#[cfg(not(any(target_os = "redox", target_os = "wasi")))] 92pub use at::{chmodat, chownat}; 93#[cfg(not(target_os = "redox"))] 94pub use at::{ 95 linkat, mkdirat, openat, readlinkat, renameat, statat, symlinkat, unlinkat, utimensat, RawMode, 96 UTIME_NOW, UTIME_OMIT, 97}; 98#[cfg(any(target_os = "ios", target_os = "macos"))] 99pub use constants::CloneFlags; 100/// `copyfile_flags_t` 101#[cfg(any(target_os = "ios", target_os = "macos"))] 102pub use constants::CopyfileFlags; 103pub use constants::{Access, FdFlags, Mode, Nsecs, OFlags, Secs, Timespec}; 104#[cfg(not(target_os = "redox"))] 105pub use constants::{AtFlags, Dev}; 106#[cfg(any(target_os = "android", target_os = "linux"))] 107pub use constants::{MountFlags, MountPropagationFlags, RenameFlags, ResolveFlags}; 108#[cfg(any(target_os = "android", target_os = "linux"))] 109pub use copy_file_range::copy_file_range; 110#[cfg(not(target_os = "redox"))] 111pub use cwd::cwd; 112#[cfg(not(target_os = "redox"))] 113pub use dir::{Dir, DirEntry}; 114#[cfg(not(any( 115 target_os = "dragonfly", 116 target_os = "haiku", 117 target_os = "illumos", 118 target_os = "ios", 119 target_os = "macos", 120 target_os = "netbsd", 121 target_os = "openbsd", 122 target_os = "redox", 123 target_os = "solaris", 124)))] 125pub use fadvise::{fadvise, Advice}; 126#[cfg(not(target_os = "wasi"))] 127pub use fcntl::fcntl_dupfd_cloexec; 128#[cfg(any( 129 target_os = "android", 130 target_os = "freebsd", 131 target_os = "fuchsia", 132 target_os = "linux", 133))] 134pub use fcntl::{fcntl_add_seals, fcntl_get_seals, SealFlags}; 135pub use fcntl::{fcntl_getfd, fcntl_getfl, fcntl_setfd, fcntl_setfl}; 136#[cfg(any(target_os = "ios", target_os = "macos"))] 137pub use fcntl_darwin::{fcntl_fullfsync, fcntl_rdadvise}; 138#[cfg(any(target_os = "ios", target_os = "macos"))] 139pub use fcopyfile::{ 140 copyfile_state_alloc, copyfile_state_free, copyfile_state_get, copyfile_state_get_copied, 141 copyfile_state_t, fcopyfile, 142}; 143#[cfg(not(any( 144 target_os = "dragonfly", 145 target_os = "haiku", 146 target_os = "ios", 147 target_os = "macos", 148 target_os = "redox", 149)))] 150pub use fd::fdatasync; 151#[cfg(not(any( 152 target_os = "aix", 153 target_os = "dragonfly", 154 target_os = "illumos", 155 target_os = "netbsd", 156 target_os = "openbsd", 157 target_os = "redox", 158 target_os = "solaris", 159)))] 160pub use fd::{fallocate, FallocateFlags}; 161#[cfg(not(target_os = "wasi"))] 162pub use fd::{fchmod, fchown}; 163#[cfg(not(any(target_os = "solaris", target_os = "wasi")))] 164pub use fd::{flock, FlockOperation}; 165pub use fd::{fstat, fsync, ftruncate, futimens, is_file_read_write, seek, tell, Stat, Timestamps}; 166#[cfg(not(any( 167 target_os = "haiku", 168 target_os = "illumos", 169 target_os = "netbsd", 170 target_os = "redox", 171 target_os = "solaris", 172 target_os = "wasi", 173)))] 174pub use fd::{fstatfs, StatFs}; 175#[cfg(not(any( 176 target_os = "haiku", 177 target_os = "illumos", 178 target_os = "redox", 179 target_os = "solaris", 180 target_os = "wasi", 181)))] 182pub use fd::{fstatvfs, StatVfs, StatVfsMountFlags}; 183#[cfg(any(target_os = "android", target_os = "linux"))] 184pub use fd::{FsWord, NFS_SUPER_MAGIC, PROC_SUPER_MAGIC}; 185pub use file_type::FileType; 186#[cfg(any(target_os = "ios", target_os = "macos"))] 187pub use getpath::getpath; 188#[cfg(not(any( 189 target_os = "dragonfly", 190 target_os = "freebsd", 191 target_os = "haiku", 192 target_os = "illumos", 193 target_os = "ios", 194 target_os = "macos", 195 target_os = "netbsd", 196 target_os = "openbsd", 197 target_os = "redox", 198 target_os = "solaris", 199 target_os = "wasi", 200)))] 201pub use makedev::{major, makedev, minor}; 202#[cfg(any(target_os = "android", target_os = "freebsd", target_os = "linux"))] 203pub use memfd_create::{memfd_create, MemfdFlags}; 204#[cfg(any(target_os = "android", target_os = "linux"))] 205pub use mount::{bind_mount, change_mount, mount, move_mount, recursive_bind_mount, remount}; 206#[cfg(any(target_os = "android", target_os = "linux"))] 207pub use openat2::openat2; 208#[cfg(any(target_os = "android", target_os = "linux"))] 209pub use raw_dir::{RawDir, RawDirEntry}; 210#[cfg(target_os = "linux")] 211pub use sendfile::sendfile; 212#[cfg(any(target_os = "android", target_os = "linux"))] 213pub use statx::{statx, Statx, StatxFlags, StatxTimestamp}; 214 215/// Re-export types common to POSIX-ish platforms. 216#[cfg(feature = "std")] 217#[cfg(unix)] 218pub use std::os::unix::fs::{DirEntryExt, FileExt, FileTypeExt, MetadataExt, OpenOptionsExt}; 219#[cfg(feature = "std")] 220#[cfg(target_os = "wasi")] 221pub use std::os::wasi::fs::{DirEntryExt, FileExt, FileTypeExt, MetadataExt, OpenOptionsExt}; 222