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(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    target_os = "vita",
23)))]
24mod fadvise;
25pub(crate) mod fcntl;
26#[cfg(apple)]
27mod fcntl_apple;
28#[cfg(apple)]
29mod fcopyfile;
30pub(crate) mod fd;
31#[cfg(apple)]
32mod getpath;
33#[cfg(not(target_os = "wasi"))] // WASI doesn't have get[gpu]id.
34mod id;
35#[cfg(linux_kernel)]
36mod ioctl;
37#[cfg(not(any(
38    target_os = "espidf",
39    target_os = "haiku",
40    target_os = "redox",
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_kernel)]
48#[cfg(feature = "fs")]
49mod mount;
50#[cfg(linux_kernel)]
51mod openat2;
52#[cfg(linux_kernel)]
53mod raw_dir;
54mod seek_from;
55#[cfg(target_os = "linux")]
56mod sendfile;
57#[cfg(linux_kernel)]
58mod statx;
59#[cfg(not(any(
60    target_os = "espidf",
61    target_os = "redox",
62    target_os = "vita",
63    target_os = "wasi"
64)))]
65mod sync;
66#[cfg(any(apple, linux_kernel))]
67mod xattr;
68
69#[cfg(linux_kernel)]
70pub use crate::backend::fs::inotify;
71pub use abs::*;
72#[cfg(not(target_os = "redox"))]
73pub use at::*;
74pub use constants::*;
75#[cfg(linux_kernel)]
76pub use copy_file_range::copy_file_range;
77#[cfg(not(any(target_os = "espidf", target_os = "redox")))]
78#[cfg(not(target_os = "haiku"))] // Haiku needs <https://github.com/rust-lang/rust/pull/112371>
79pub use cwd::*;
80#[cfg(all(feature = "alloc", not(any(target_os = "espidf", target_os = "redox"))))]
81pub use dir::{Dir, DirEntry};
82#[cfg(not(any(
83    apple,
84    netbsdlike,
85    solarish,
86    target_os = "dragonfly",
87    target_os = "espidf",
88    target_os = "haiku",
89    target_os = "redox",
90    target_os = "vita",
91)))]
92pub use fadvise::fadvise;
93pub use fcntl::*;
94#[cfg(apple)]
95pub use fcntl_apple::*;
96#[cfg(apple)]
97pub use fcopyfile::*;
98pub use fd::*;
99#[cfg(apple)]
100pub use getpath::getpath;
101#[cfg(not(target_os = "wasi"))]
102pub use id::*;
103#[cfg(linux_kernel)]
104pub use ioctl::*;
105#[cfg(not(any(
106    target_os = "espidf",
107    target_os = "haiku",
108    target_os = "redox",
109    target_os = "vita",
110    target_os = "wasi"
111)))]
112pub use makedev::*;
113#[cfg(any(linux_kernel, target_os = "freebsd"))]
114pub use memfd_create::memfd_create;
115#[cfg(linux_kernel)]
116#[cfg(feature = "fs")]
117pub use mount::*;
118#[cfg(linux_kernel)]
119pub use openat2::openat2;
120#[cfg(linux_kernel)]
121pub use raw_dir::{RawDir, RawDirEntry};
122pub use seek_from::SeekFrom;
123#[cfg(target_os = "linux")]
124pub use sendfile::sendfile;
125#[cfg(linux_kernel)]
126pub use statx::statx;
127#[cfg(not(any(
128    target_os = "espidf",
129    target_os = "redox",
130    target_os = "vita",
131    target_os = "wasi"
132)))]
133pub use sync::sync;
134#[cfg(any(apple, linux_kernel))]
135pub use xattr::*;
136
137/// Re-export types common to POSIX-ish platforms.
138#[cfg(feature = "std")]
139#[cfg(unix)]
140pub use std::os::unix::fs::{DirEntryExt, FileExt, FileTypeExt, MetadataExt, OpenOptionsExt};
141#[cfg(feature = "std")]
142#[cfg(all(wasi_ext, target_os = "wasi"))]
143pub use std::os::wasi::fs::{DirEntryExt, FileExt, FileTypeExt, MetadataExt, OpenOptionsExt};