safa_abi/io.rs
1#[derive(Debug, Clone, Copy, PartialEq, Eq)]
2#[repr(u8)]
3pub enum InodeType {
4 File,
5 Directory,
6 Device,
7}
8
9// Keep in sync with kernel implementition in kernel::vfs::expose::FileAttr
10// The ABI version cannot be used directely in the kernel implementition
11#[derive(Clone, Debug, PartialEq, Eq)]
12#[repr(C)]
13pub struct FileAttr {
14 pub kind: InodeType,
15 pub size: usize,
16}
17
18// Keep in sync with kernel implementition in kernel::vfs::expose::DirEntry
19// The ABI version cannot be used directely in the kernel implementition
20#[derive(Clone, Debug, PartialEq, Eq)]
21#[repr(C)]
22pub struct DirEntry {
23 pub attrs: FileAttr,
24 pub name_length: usize,
25 pub name: [u8; Self::MAX_NAME_LEN],
26}
27
28impl DirEntry {
29 pub const MAX_NAME_LEN: usize = 128;
30}