1//! Filesystem operations.
2
3mod abs;
4#[cfg(not(target_os = "redox"))]
5mod at;
6mod constants;
7#[cfg(linux_kernel)]
8mod copy_file_range;
9#[cfg(not(any(target_os = "espidf", target_os = "redox")))]
10#[cfg(not(target_os = "haiku"))] // Haiku needs <https://github.com/rust-lang/rust/pull/112371>
11mod cwd;
12#[cfg(all(feature = "alloc", not(any(target_os = "espidf", target_os = "redox"))))]
13mod dir;
14#[cfg(not(any(
15 apple,
16 netbsdlike,
17 solarish,
18 target_os = "dragonfly",
19 target_os = "espidf",
20 target_os = "haiku",
21 target_os = "redox",
22)))]
23mod fadvise;
24pub(crate) mod fcntl;
25#[cfg(apple)]
26mod fcntl_apple;
27#[cfg(apple)]
28mod fcopyfile;
29pub(crate) mod fd;
30mod file_type;
31#[cfg(apple)]
32mod getpath;
33#[cfg(not(target_os = "wasi"))] // WASI doesn't have get[gpu]id.
34mod id;
35#[cfg(not(target_os = "wasi"))]
36mod ioctl;
37#[cfg(not(any(
38 target_os = "espidf",
39 target_os = "haiku",
40 target_os = "redox",
41 target_os = "wasi"
42)))]
43mod makedev;
44#[cfg(any(linux_kernel, target_os = "freebsd"))]
45mod memfd_create;
46#[cfg(linux_kernel)]
47#[cfg(feature = "fs")]
48mod mount;
49#[cfg(linux_kernel)]
50mod openat2;
51#[cfg(linux_kernel)]
52mod raw_dir;
53mod seek_from;
54#[cfg(target_os = "linux")]
55mod sendfile;
56#[cfg(linux_kernel)]
57mod statx;
58#[cfg(not(any(target_os = "espidf", target_os = "redox", target_os = "wasi")))]
59mod sync;
60#[cfg(any(apple, linux_kernel))]
61mod xattr;
62
63#[cfg(linux_kernel)]
64pub use crate::backend::fs::inotify;
65pub use abs::*;
66#[cfg(not(target_os = "redox"))]
67pub use at::*;
68pub use constants::*;
69#[cfg(linux_kernel)]
70pub use copy_file_range::copy_file_range;
71#[cfg(not(any(target_os = "espidf", target_os = "redox")))]
72#[cfg(not(target_os = "haiku"))] // Haiku needs <https://github.com/rust-lang/rust/pull/112371>
73pub use cwd::*;
74#[cfg(all(feature = "alloc", not(any(target_os = "espidf", target_os = "redox"))))]
75pub use dir::{Dir, DirEntry};
76#[cfg(not(any(
77 apple,
78 netbsdlike,
79 solarish,
80 target_os = "dragonfly",
81 target_os = "espidf",
82 target_os = "haiku",
83 target_os = "redox",
84)))]
85pub use fadvise::{fadvise, Advice};
86pub use fcntl::*;
87#[cfg(apple)]
88pub use fcntl_apple::*;
89#[cfg(apple)]
90pub use fcopyfile::*;
91pub use fd::*;
92pub use file_type::FileType;
93#[cfg(apple)]
94pub use getpath::getpath;
95#[cfg(not(target_os = "wasi"))]
96pub use id::*;
97#[cfg(not(target_os = "wasi"))]
98pub use ioctl::*;
99#[cfg(not(any(
100 target_os = "espidf",
101 target_os = "haiku",
102 target_os = "redox",
103 target_os = "wasi"
104)))]
105pub use makedev::*;
106#[cfg(any(linux_kernel, target_os = "freebsd"))]
107pub use memfd_create::{memfd_create, MemfdFlags};
108#[cfg(linux_kernel)]
109#[cfg(feature = "fs")]
110pub use mount::*;
111#[cfg(linux_kernel)]
112pub use openat2::openat2;
113#[cfg(linux_kernel)]
114pub use raw_dir::{RawDir, RawDirEntry};
115pub use seek_from::SeekFrom;
116#[cfg(target_os = "linux")]
117pub use sendfile::sendfile;
118#[cfg(linux_kernel)]
119pub use statx::{statx, Statx, StatxFlags, StatxTimestamp};
120#[cfg(not(any(target_os = "espidf", target_os = "redox", target_os = "wasi")))]
121pub use sync::sync;
122#[cfg(any(apple, linux_kernel))]
123pub use xattr::*;
124
125/// Re-export types common to POSIX-ish platforms.
126#[cfg(feature = "std")]
127#[cfg(unix)]
128pub use std::os::unix::fs::{DirEntryExt, FileExt, FileTypeExt, MetadataExt, OpenOptionsExt};
129#[cfg(feature = "std")]
130#[cfg(all(wasi_ext, target_os = "wasi"))]
131pub use std::os::wasi::fs::{DirEntryExt, FileExt, FileTypeExt, MetadataExt, OpenOptionsExt};
132