Skip to content

Commit 121705e

Browse files
committed
rust: fs: export file type from mode constants
This allows file systems modules to use these constants if needed. Signed-off-by: Wedson Almeida Filho <[email protected]>
1 parent 06e110b commit 121705e

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

rust/kernel/fs.rs

+27
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,33 @@ pub mod buffer;
1111
/// Maximum size of an inode.
1212
pub const MAX_LFS_FILESIZE: i64 = bindings::MAX_LFS_FILESIZE;
1313

14+
/// Contains constants related to Linux file modes.
15+
pub mod mode {
16+
/// A bitmask used to the file type from a mode value.
17+
pub const S_IFMT: u32 = bindings::S_IFMT;
18+
19+
/// File type constant for block devices.
20+
pub const S_IFBLK: u32 = bindings::S_IFBLK;
21+
22+
/// File type constant for char devices.
23+
pub const S_IFCHR: u32 = bindings::S_IFCHR;
24+
25+
/// File type constant for directories.
26+
pub const S_IFDIR: u32 = bindings::S_IFDIR;
27+
28+
/// File type constant for pipes.
29+
pub const S_IFIFO: u32 = bindings::S_IFIFO;
30+
31+
/// File type constant for symbolic links.
32+
pub const S_IFLNK: u32 = bindings::S_IFLNK;
33+
34+
/// File type constant for regular files.
35+
pub const S_IFREG: u32 = bindings::S_IFREG;
36+
37+
/// File type constant for sockets.
38+
pub const S_IFSOCK: u32 = bindings::S_IFSOCK;
39+
}
40+
1441
/// Read-only file systems.
1542
pub mod ro {
1643
use crate::error::{code::*, from_result, to_result, Error, Result};

0 commit comments

Comments
 (0)