1
0
Fork 0
forked from AbleOS/ableos
ableos-idl/ableos/src/scheduler/capabilities.rs

73 lines
1.4 KiB
Rust

use alloc::vec::Vec;
use crate::file::PathRep;
pub type SoundCardID = u8;
pub type DeviceID = u8;
pub type ControllerID = u8;
#[derive(Clone, Debug, PartialEq)]
pub enum FileAccess {
All,
Some(Vec<PathRep>),
None,
}
#[derive(Clone, Debug, PartialEq)]
pub enum ControllerAccess {
All,
Some(Vec<ControllerID>),
None,
}
#[derive(Clone, Debug, PartialEq)]
pub enum SoundCardAccess {
All,
Some(Vec<SoundCardID>),
None,
}
#[derive(Clone, Debug, PartialEq)]
pub enum MouseAccess {
Yes,
No,
}
#[derive(Clone, Debug, PartialEq)]
pub enum KeyboardAccess {
Yes,
No,
}
#[derive(Clone, Debug, PartialEq)]
pub enum NetworkAccess {
Yes,
No,
}
/// A set of capabilities that a process has
#[derive(Clone, Debug, PartialEq)]
pub struct Capabilities {
pub files: FileAccess,
pub mouse: MouseAccess,
pub keyboard: KeyboardAccess,
pub controllers: ControllerAccess,
pub sound_cards: SoundCardAccess,
pub network_access: NetworkAccess,
}
impl Capabilities {
/// Generate a set of empty capabilities
pub fn empty() -> Self {
Self {
files: FileAccess::None,
mouse: MouseAccess::No,
keyboard: KeyboardAccess::No,
controllers: ControllerAccess::None,
sound_cards: SoundCardAccess::None,
network_access: NetworkAccess::No,
}
}
}