#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u64)]
pub enum AfcOpcode {
Status = 0x00000001,
Data = 0x00000002, ReadDir = 0x00000003, ReadFile = 0x00000004, WriteFile = 0x00000005, WritePart = 0x00000006, Truncate = 0x00000007, RemovePath = 0x00000008, MakeDir = 0x00000009, GetFileInfo = 0x0000000a, GetDevInfo = 0x0000000b, WriteFileAtom = 0x0000000c, FileOpen = 0x0000000d, FileOpenRes = 0x0000000e, Read = 0x0000000f, Write = 0x00000010, FileSeek = 0x00000011, FileTell = 0x00000012, FileTellRes = 0x00000013, FileClose = 0x00000014, FileSetSize = 0x00000015, GetConInfo = 0x00000016, SetConOptions = 0x00000017, RenamePath = 0x00000018, SetFsBs = 0x00000019, SetSocketBs = 0x0000001A, FileLock = 0x0000001B, MakeLink = 0x0000001C, SetFileTime = 0x0000001E, RemovePathAndContents = 0x00000022,
}
#[repr(u64)]
#[derive(Clone, Copy, Debug)]
pub enum AfcFopenMode {
RdOnly = 0x00000001, Rw = 0x00000002, WrOnly = 0x00000003, Wr = 0x00000004, Append = 0x00000005, RdAppend = 0x00000006, }
#[repr(u64)]
#[derive(Clone, Copy, Debug)]
pub enum LinkType {
Hardlink = 0x00000001,
Symlink = 0x00000002,
}
impl TryFrom<u64> for AfcOpcode {
type Error = ();
fn try_from(value: u64) -> Result<Self, Self::Error> {
match value {
0x00000001 => Ok(Self::Status),
0x00000002 => Ok(Self::Data),
0x00000003 => Ok(Self::ReadDir),
0x00000004 => Ok(Self::ReadFile),
0x00000005 => Ok(Self::WriteFile),
0x00000006 => Ok(Self::WritePart),
0x00000007 => Ok(Self::Truncate),
0x00000008 => Ok(Self::RemovePath),
0x00000009 => Ok(Self::MakeDir),
0x0000000a => Ok(Self::GetFileInfo),
0x0000000b => Ok(Self::GetDevInfo),
0x0000000c => Ok(Self::WriteFileAtom),
0x0000000d => Ok(Self::FileOpen),
0x0000000e => Ok(Self::FileOpenRes),
0x0000000f => Ok(Self::Read),
0x00000010 => Ok(Self::Write),
0x00000011 => Ok(Self::FileSeek),
0x00000012 => Ok(Self::FileTell),
0x00000013 => Ok(Self::FileTellRes),
0x00000014 => Ok(Self::FileClose),
0x00000015 => Ok(Self::FileSetSize),
0x00000016 => Ok(Self::GetConInfo),
0x00000017 => Ok(Self::SetConOptions),
0x00000018 => Ok(Self::RenamePath),
0x00000019 => Ok(Self::SetFsBs),
0x0000001A => Ok(Self::SetSocketBs),
0x0000001B => Ok(Self::FileLock),
0x0000001C => Ok(Self::MakeLink),
0x0000001E => Ok(Self::SetFileTime),
_ => Err(()),
}
}
}