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