pub struct DeviceFileInfo {
pub device_id: usize,
pub device_type: DeviceType,
}
Expand description
Information about device files in the filesystem
Scarlet uses a simplified device identification system based on unique device IDs rather than the traditional Unix major/minor number pairs. This provides:
- Simplified Management: Single ID instead of major/minor pair reduces complexity
- Unified Namespace: All devices share a common ID space regardless of type
- Dynamic Allocation: Device IDs can be dynamically assigned without conflicts
- Type Safety: Device type is explicitly specified alongside the ID
§Architecture
Each device in Scarlet is uniquely identified by:
device_id
: A unique identifier within the system’s device namespacedevice_type
: Explicit type classification (Character, Block, etc.)
This differs from traditional Unix systems where:
- Major numbers identify device drivers
- Minor numbers identify specific devices within a driver
§Examples
// Character device for terminal
let tty_device = DeviceFileInfo {
device_id: 1,
device_type: DeviceType::Char,
};
// Block device for storage
let disk_device = DeviceFileInfo {
device_id: 100,
device_type: DeviceType::Block,
};
Fields§
§device_id: usize
§device_type: DeviceType
Trait Implementations§
Source§impl Clone for DeviceFileInfo
impl Clone for DeviceFileInfo
Source§fn clone(&self) -> DeviceFileInfo
fn clone(&self) -> DeviceFileInfo
Returns a copy of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for DeviceFileInfo
impl Debug for DeviceFileInfo
Source§impl PartialEq for DeviceFileInfo
impl PartialEq for DeviceFileInfo
impl Copy for DeviceFileInfo
impl StructuralPartialEq for DeviceFileInfo
Auto Trait Implementations§
impl Freeze for DeviceFileInfo
impl RefUnwindSafe for DeviceFileInfo
impl Send for DeviceFileInfo
impl Sync for DeviceFileInfo
impl Unpin for DeviceFileInfo
impl UnwindSafe for DeviceFileInfo
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)