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