#![no_std]
pub mod dir;
pub mod file;
pub mod path;
pub use neotron_ffi::{FfiBuffer, FfiByteSlice, FfiString};
pub const MAX_FILENAME_LEN: usize = 11;
pub type Result<T> = neotron_ffi::FfiResult<T, Error>;
#[repr(C)]
pub struct Api {
pub open: extern "C" fn(path: FfiString, flags: file::Flags) -> Result<file::Handle>,
pub close: extern "C" fn(fd: file::Handle) -> Result<()>,
pub write: extern "C" fn(fd: file::Handle, buffer: FfiByteSlice) -> Result<()>,
pub read: extern "C" fn(fd: file::Handle, buffer: FfiBuffer) -> Result<usize>,
pub seek_set: extern "C" fn(fd: file::Handle, position: u64) -> Result<()>,
pub seek_cur: extern "C" fn(fd: file::Handle, offset: i64) -> Result<u64>,
pub seek_end: extern "C" fn(fd: file::Handle) -> Result<u64>,
pub rename: extern "C" fn(old_path: FfiString, new_path: FfiString) -> Result<()>,
pub ioctl: extern "C" fn(fd: file::Handle, command: u64, value: u64) -> Result<u64>,
pub opendir: extern "C" fn(path: FfiString) -> Result<dir::Handle>,
pub closedir: extern "C" fn(dir: dir::Handle) -> Result<()>,
pub readdir: extern "C" fn(dir: dir::Handle) -> Result<dir::Entry>,
pub stat: extern "C" fn(path: FfiString) -> Result<file::Stat>,
pub fstat: extern "C" fn(fd: file::Handle) -> Result<file::Stat>,
pub deletefile: extern "C" fn(path: FfiString) -> Result<()>,
pub deletedir: extern "C" fn(path: FfiString) -> Result<()>,
pub chdir: extern "C" fn(path: FfiString) -> Result<()>,
pub dchdir: extern "C" fn(dir: dir::Handle) -> Result<()>,
pub pwd: extern "C" fn(path: FfiBuffer) -> Result<usize>,
pub malloc: extern "C" fn(size: usize, alignment: usize) -> Result<*mut core::ffi::c_void>,
pub free: extern "C" fn(ptr: *mut core::ffi::c_void, size: usize, alignment: usize),
}
pub type AppStartFn = extern "C" fn(api: *const Api, argc: usize, argv: *const FfiString) -> i32;
#[repr(C)]
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum Error {
NotFound,
FileReadOnly,
EndOfFile,
Unimplemented,
InvalidArg,
BadHandle,
DeviceSpecific,
OutOfMemory,
InvalidPath,
}