1 //! Filesystem operations. 2 3 mod abs; 4 #[cfg(not(target_os = "redox"))] 5 mod at; 6 mod constants; 7 #[cfg(any(target_os = "android", target_os = "linux"))] 8 mod copy_file_range; 9 #[cfg(not(target_os = "redox"))] 10 mod cwd; 11 #[cfg(not(target_os = "redox"))] 12 mod 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 )))] 24 mod fadvise; 25 pub(crate) mod fcntl; 26 #[cfg(any(target_os = "ios", target_os = "macos"))] 27 mod fcntl_darwin; 28 #[cfg(any(target_os = "ios", target_os = "macos"))] 29 mod fcopyfile; 30 pub(crate) mod fd; 31 mod file_type; 32 #[cfg(any(target_os = "ios", target_os = "macos"))] 33 mod 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 )))] 47 mod makedev; 48 #[cfg(any(target_os = "android", target_os = "freebsd", target_os = "linux"))] 49 mod memfd_create; 50 #[cfg(any(target_os = "android", target_os = "linux"))] 51 mod mount; 52 #[cfg(any(target_os = "android", target_os = "linux"))] 53 mod openat2; 54 #[cfg(any(target_os = "android", target_os = "linux"))] 55 mod raw_dir; 56 #[cfg(target_os = "linux")] 57 mod sendfile; 58 #[cfg(any(target_os = "android", target_os = "linux"))] 59 mod 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 )))] 69 pub 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 )))] 77 pub use abs::statvfs; 78 #[cfg(not(any(target_os = "illumos", target_os = "redox", target_os = "solaris")))] 79 pub use at::accessat; 80 #[cfg(any(target_os = "ios", target_os = "macos"))] 81 pub use at::fclonefileat; 82 #[cfg(not(any( 83 target_os = "ios", 84 target_os = "macos", 85 target_os = "redox", 86 target_os = "wasi", 87 )))] 88 pub use at::mknodat; 89 #[cfg(any(target_os = "android", target_os = "linux"))] 90 pub use at::renameat_with; 91 #[cfg(not(any(target_os = "redox", target_os = "wasi")))] 92 pub use at::{chmodat, chownat}; 93 #[cfg(not(target_os = "redox"))] 94 pub 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"))] 99 pub use constants::CloneFlags; 100 /// `copyfile_flags_t` 101 #[cfg(any(target_os = "ios", target_os = "macos"))] 102 pub use constants::CopyfileFlags; 103 pub use constants::{Access, FdFlags, Mode, Nsecs, OFlags, Secs, Timespec}; 104 #[cfg(not(target_os = "redox"))] 105 pub use constants::{AtFlags, Dev}; 106 #[cfg(any(target_os = "android", target_os = "linux"))] 107 pub use constants::{MountFlags, MountPropagationFlags, RenameFlags, ResolveFlags}; 108 #[cfg(any(target_os = "android", target_os = "linux"))] 109 pub use copy_file_range::copy_file_range; 110 #[cfg(not(target_os = "redox"))] 111 pub use cwd::cwd; 112 #[cfg(not(target_os = "redox"))] 113 pub 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 )))] 125 pub use fadvise::{fadvise, Advice}; 126 #[cfg(not(target_os = "wasi"))] 127 pub 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 ))] 134 pub use fcntl::{fcntl_add_seals, fcntl_get_seals, SealFlags}; 135 pub use fcntl::{fcntl_getfd, fcntl_getfl, fcntl_setfd, fcntl_setfl}; 136 #[cfg(any(target_os = "ios", target_os = "macos"))] 137 pub use fcntl_darwin::{fcntl_fullfsync, fcntl_rdadvise}; 138 #[cfg(any(target_os = "ios", target_os = "macos"))] 139 pub 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 )))] 150 pub 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 )))] 160 pub use fd::{fallocate, FallocateFlags}; 161 #[cfg(not(target_os = "wasi"))] 162 pub use fd::{fchmod, fchown}; 163 #[cfg(not(any(target_os = "solaris", target_os = "wasi")))] 164 pub use fd::{flock, FlockOperation}; 165 pub 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 )))] 174 pub 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 )))] 182 pub use fd::{fstatvfs, StatVfs, StatVfsMountFlags}; 183 #[cfg(any(target_os = "android", target_os = "linux"))] 184 pub use fd::{FsWord, NFS_SUPER_MAGIC, PROC_SUPER_MAGIC}; 185 pub use file_type::FileType; 186 #[cfg(any(target_os = "ios", target_os = "macos"))] 187 pub 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 )))] 201 pub use makedev::{major, makedev, minor}; 202 #[cfg(any(target_os = "android", target_os = "freebsd", target_os = "linux"))] 203 pub use memfd_create::{memfd_create, MemfdFlags}; 204 #[cfg(any(target_os = "android", target_os = "linux"))] 205 pub use mount::{bind_mount, change_mount, mount, move_mount, recursive_bind_mount, remount}; 206 #[cfg(any(target_os = "android", target_os = "linux"))] 207 pub use openat2::openat2; 208 #[cfg(any(target_os = "android", target_os = "linux"))] 209 pub use raw_dir::{RawDir, RawDirEntry}; 210 #[cfg(target_os = "linux")] 211 pub use sendfile::sendfile; 212 #[cfg(any(target_os = "android", target_os = "linux"))] 213 pub use statx::{statx, Statx, StatxFlags, StatxTimestamp}; 214 215 /// Re-export types common to POSIX-ish platforms. 216 #[cfg(feature = "std")] 217 #[cfg(unix)] 218 pub use std::os::unix::fs::{DirEntryExt, FileExt, FileTypeExt, MetadataExt, OpenOptionsExt}; 219 #[cfg(feature = "std")] 220 #[cfg(target_os = "wasi")] 221 pub use std::os::wasi::fs::{DirEntryExt, FileExt, FileTypeExt, MetadataExt, OpenOptionsExt}; 222