rustix/fs/
mod.rs

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(all(feature = "alloc", not(any(target_os = "espidf", target_os = "redox"))))]
10mod dir;
11#[cfg(not(any(
12    apple,
13    netbsdlike,
14    target_os = "dragonfly",
15    target_os = "espidf",
16    target_os = "haiku",
17    target_os = "horizon",
18    target_os = "redox",
19    target_os = "solaris",
20    target_os = "vita",
21)))]
22mod fadvise;
23pub(crate) mod fcntl;
24#[cfg(apple)]
25mod fcntl_apple;
26#[cfg(apple)]
27mod fcopyfile;
28pub(crate) mod fd;
29#[cfg(all(apple, feature = "alloc"))]
30mod getpath;
31#[cfg(not(target_os = "wasi"))] // WASI doesn't have get[gpu]id.
32mod id;
33#[cfg(linux_raw_dep)]
34pub mod inotify;
35#[cfg(linux_kernel)]
36mod ioctl;
37#[cfg(not(any(
38    target_os = "espidf",
39    target_os = "haiku",
40    target_os = "horizon",
41    target_os = "vita",
42    target_os = "wasi"
43)))]
44mod makedev;
45#[cfg(any(linux_kernel, target_os = "freebsd"))]
46mod memfd_create;
47#[cfg(linux_raw_dep)]
48mod openat2;
49#[cfg(linux_kernel)]
50mod raw_dir;
51mod seek_from;
52#[cfg(target_os = "linux")]
53mod sendfile;
54#[cfg(not(any(target_os = "espidf", target_os = "redox")))]
55mod special;
56#[cfg(linux_kernel)]
57mod statx;
58#[cfg(not(any(
59    target_os = "espidf",
60    target_os = "horizon",
61    target_os = "redox",
62    target_os = "vita",
63    target_os = "wasi"
64)))]
65mod sync;
66#[cfg(any(apple, linux_kernel, target_os = "hurd"))]
67mod xattr;
68
69pub use abs::*;
70#[cfg(not(target_os = "redox"))]
71pub use at::*;
72pub use constants::*;
73#[cfg(linux_kernel)]
74pub use copy_file_range::copy_file_range;
75#[cfg(all(feature = "alloc", not(any(target_os = "espidf", target_os = "redox"))))]
76pub use dir::{Dir, DirEntry};
77#[cfg(not(any(
78    apple,
79    netbsdlike,
80    target_os = "dragonfly",
81    target_os = "espidf",
82    target_os = "haiku",
83    target_os = "horizon",
84    target_os = "redox",
85    target_os = "solaris",
86    target_os = "vita",
87)))]
88pub use fadvise::fadvise;
89pub use fcntl::*;
90#[cfg(apple)]
91pub use fcntl_apple::*;
92#[cfg(apple)]
93pub use fcopyfile::*;
94pub use fd::*;
95#[cfg(all(apple, feature = "alloc"))]
96pub use getpath::getpath;
97#[cfg(not(target_os = "wasi"))]
98pub use id::*;
99#[cfg(linux_kernel)]
100pub use ioctl::*;
101#[cfg(not(any(
102    target_os = "espidf",
103    target_os = "haiku",
104    target_os = "horizon",
105    target_os = "vita",
106    target_os = "wasi"
107)))]
108pub use makedev::*;
109#[cfg(any(linux_kernel, target_os = "freebsd"))]
110pub use memfd_create::memfd_create;
111#[cfg(linux_raw_dep)]
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(not(any(target_os = "espidf", target_os = "redox")))]
119pub use special::*;
120#[cfg(linux_kernel)]
121pub use statx::*;
122#[cfg(not(any(
123    target_os = "espidf",
124    target_os = "horizon",
125    target_os = "redox",
126    target_os = "vita",
127    target_os = "wasi"
128)))]
129pub use sync::sync;
130#[cfg(any(apple, linux_kernel, target_os = "hurd"))]
131pub use xattr::*;
132
133/// Re-export types common to POSIX-ish platforms.
134#[cfg(feature = "std")]
135#[cfg(unix)]
136pub use std::os::unix::fs::{DirEntryExt, FileExt, FileTypeExt, MetadataExt, OpenOptionsExt};
137#[cfg(feature = "std")]
138#[cfg(all(wasi_ext, target_os = "wasi"))]
139pub use std::os::wasi::fs::{DirEntryExt, FileExt, FileTypeExt, MetadataExt, OpenOptionsExt};