From b8f883be5bea4600f59cd40e7713a6524cf58154 Mon Sep 17 00:00:00 2001 From: Koichi Date: Sun, 31 Aug 2025 18:55:55 +0900 Subject: [PATCH 01/18] add storage device trait Signed-off-by: Koichi --- awkernel_lib/src/lib.rs | 1 + awkernel_lib/src/storage.rs | 220 ++++++++++++++++++++++++++++++++++++ 2 files changed, 221 insertions(+) create mode 100644 awkernel_lib/src/storage.rs diff --git a/awkernel_lib/src/lib.rs b/awkernel_lib/src/lib.rs index 37be10fb9..76af7c2eb 100644 --- a/awkernel_lib/src/lib.rs +++ b/awkernel_lib/src/lib.rs @@ -26,6 +26,7 @@ pub mod mmio; pub mod net; pub mod priority_queue; pub mod sanity; +pub mod storage; pub mod sync; pub mod time; pub mod timer; diff --git a/awkernel_lib/src/storage.rs b/awkernel_lib/src/storage.rs new file mode 100644 index 000000000..dfd4c1e3b --- /dev/null +++ b/awkernel_lib/src/storage.rs @@ -0,0 +1,220 @@ +use crate::sync::{mcs::MCSNode, mutex::Mutex, rwlock::RwLock}; +use alloc::{ + borrow::Cow, + collections::{btree_map::Entry, BTreeMap}, + sync::Arc, + vec::Vec, +}; + +#[derive(Debug)] +pub enum StorageManagerError { + InvalidDeviceID, + InvalidTransferID, + DeviceError(StorageDevError), + NotYetImplemented, + PoolNotInitialized, +} + +#[derive(Debug)] +pub enum StorageDevError { + IoError, + InvalidCommand, + DeviceNotReady, + InvalidBlock, + BufferTooSmall, + NotSupported, +} + +#[derive(Debug)] +pub struct StorageStatus { + pub device_id: u64, + pub device_name: Cow<'static, str>, + pub device_type: StorageDeviceType, + pub irqs: Vec, + pub block_size: usize, + pub num_blocks: u64, +} + +#[derive(Debug, Clone, Copy)] +pub enum StorageDeviceType { + NVMe, + SATA, + USB, + VirtIO, + Memory, +} + +pub trait StorageDevice: Send + Sync { + fn device_id(&self) -> u64; + + fn device_name(&self) -> Cow<'static, str>; + + fn device_short_name(&self) -> Cow<'static, str>; + + fn device_type(&self) -> StorageDeviceType; + + fn irqs(&self) -> Vec; + + fn interrupt(&self, irq: u16) -> Result<(), StorageDevError>; + + fn block_size(&self) -> usize; + + /// Get the total number of blocks + fn num_blocks(&self) -> u64; + + fn read_blocks(&self, buf: &mut [u8], transfer_id: u16) -> Result<(), StorageDevError>; + + fn write_blocks(&self, buf: &[u8], transfer_id: u16) -> Result<(), StorageDevError>; + + fn flush(&self, _transfer_id: u16) -> Result<(), StorageDevError> { + Ok(()) + } +} + +static STORAGE_MANAGER: RwLock = RwLock::new(StorageManager { + devices: BTreeMap::new(), + device_id: 0, +}); + +static IRQ_WAKERS: Mutex> = Mutex::new(BTreeMap::new()); + +struct DeviceInfo { + device: Arc, + namespace_id: Option, +} + +pub struct StorageManager { + devices: BTreeMap, + device_id: u64, +} + +enum IRQWaker { + Waker(core::task::Waker), + Interrupted, +} + +/// Add a storage device to the manager +pub fn add_storage_device(device: Arc, namespace_id: Option) -> u64 +where + T: StorageDevice + Send + Sync + 'static, +{ + let mut manager = STORAGE_MANAGER.write(); + + if manager.device_id == u64::MAX { + panic!("storage device id overflow"); + } + + let id = manager.device_id; + manager.device_id += 1; + + let device_info = DeviceInfo { + device: device.clone() as Arc, + namespace_id, + }; + manager.devices.insert(id, device_info); + + id +} + +/// Get a storage device as Arc +pub fn get_storage_device(device_id: u64) -> Result, StorageManagerError> { + let manager = STORAGE_MANAGER.read(); + + let device_info = manager + .devices + .get(&device_id) + .ok_or(StorageManagerError::InvalidDeviceID)?; + + Ok(device_info.device.clone()) +} + +/// Get status information about a storage device +pub fn get_storage_status(device_id: u64) -> Result { + let manager = STORAGE_MANAGER.read(); + + let device_info = manager + .devices + .get(&device_id) + .ok_or(StorageManagerError::InvalidDeviceID)?; + + let device = &device_info.device; + + let status = StorageStatus { + device_id, + device_name: device.device_name(), + device_type: device.device_type(), + irqs: device.irqs(), + block_size: device.block_size(), + num_blocks: device.num_blocks(), + }; + + Ok(status) +} + +/// Get status information for all storage devices +pub fn get_all_storage_statuses() -> Vec { + let manager = STORAGE_MANAGER.read(); + + let mut result = Vec::new(); + + for id in manager.devices.keys() { + if let Ok(status) = get_storage_status(*id) { + result.push(status); + } + } + + result +} + +/// Service routine for storage device interrupt. +/// This routine should be called by interrupt handlers provided by device drivers. +pub fn storage_interrupt(irq: u16) { + let mut node = MCSNode::new(); + let mut w = IRQ_WAKERS.lock(&mut node); + + match w.entry(irq) { + Entry::Occupied(e) => { + if matches!(e.get(), IRQWaker::Waker(_)) { + let IRQWaker::Waker(w) = e.remove() else { + return; + }; + + w.wake(); + } + } + Entry::Vacant(e) => { + e.insert(IRQWaker::Interrupted); + } + } +} + +/// Register a waker for a storage device interrupt service. +/// +/// The old waker will be replaced. +/// The waker will be called when the storage device interrupt occurs once +/// and it will be removed after it is called. +/// +/// Returns true if the waker is registered successfully. +/// Returns false if the interrupt occurred before. +pub fn register_waker_for_storage_interrupt(irq: u16, waker: core::task::Waker) -> bool { + let mut node = MCSNode::new(); + let mut w = IRQ_WAKERS.lock(&mut node); + + let entry = w.entry(irq); + + match entry { + Entry::Occupied(mut e) => { + if matches!(e.get(), IRQWaker::Interrupted) { + e.remove(); + false + } else { + e.insert(IRQWaker::Waker(waker)); + true + } + } + Entry::Vacant(e) => { + e.insert(IRQWaker::Waker(waker)); + true + } + } +} From fc8d3e81f01abb16445e20a64da1cf7e06e5df9a Mon Sep 17 00:00:00 2001 From: Koichi Date: Sun, 31 Aug 2025 19:04:36 +0900 Subject: [PATCH 02/18] fix warings Signed-off-by: Koichi --- awkernel_lib/src/storage.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/awkernel_lib/src/storage.rs b/awkernel_lib/src/storage.rs index dfd4c1e3b..2c0ff8c11 100644 --- a/awkernel_lib/src/storage.rs +++ b/awkernel_lib/src/storage.rs @@ -80,7 +80,7 @@ static IRQ_WAKERS: Mutex> = Mutex::new(BTreeMap::new()); struct DeviceInfo { device: Arc, - namespace_id: Option, + _namespace_id: Option, } pub struct StorageManager { @@ -109,7 +109,7 @@ where let device_info = DeviceInfo { device: device.clone() as Arc, - namespace_id, + _namespace_id: namespace_id, }; manager.devices.insert(id, device_info); From 2f3a91007da29d14537bc2ddf69c9fcfc1be3c18 Mon Sep 17 00:00:00 2001 From: Koichi Date: Sun, 31 Aug 2025 19:38:23 +0900 Subject: [PATCH 03/18] add get_namespaceid, get_blocksize Signed-off-by: Koichi --- awkernel_lib/src/storage.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/awkernel_lib/src/storage.rs b/awkernel_lib/src/storage.rs index 2c0ff8c11..1c32c4199 100644 --- a/awkernel_lib/src/storage.rs +++ b/awkernel_lib/src/storage.rs @@ -93,6 +93,22 @@ enum IRQWaker { Interrupted, } +/// Get the namespace ID for a storage device +pub fn get_device_namespace(device_id: u64) -> Option { + let manager = STORAGE_MANAGER.read(); + + manager + .devices + .get(&device_id) + .and_then(|info| info.namespace_id) +} + +/// Get the block size for a storage device +pub fn get_device_block_size(device_id: u64) -> Result { + let device = get_storage_device(device_id)?; + Ok(device.block_size()) +} + /// Add a storage device to the manager pub fn add_storage_device(device: Arc, namespace_id: Option) -> u64 where From b9070f88b27b5b5d4d34dfe7c44c93ccd3a150e3 Mon Sep 17 00:00:00 2001 From: Koichi Date: Sun, 31 Aug 2025 20:50:20 +0900 Subject: [PATCH 04/18] fix namespace_id Signed-off-by: Koichi --- awkernel_lib/src/storage.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/awkernel_lib/src/storage.rs b/awkernel_lib/src/storage.rs index 1c32c4199..a85c4c234 100644 --- a/awkernel_lib/src/storage.rs +++ b/awkernel_lib/src/storage.rs @@ -80,7 +80,7 @@ static IRQ_WAKERS: Mutex> = Mutex::new(BTreeMap::new()); struct DeviceInfo { device: Arc, - _namespace_id: Option, + namespace_id: Option, } pub struct StorageManager { @@ -125,7 +125,7 @@ where let device_info = DeviceInfo { device: device.clone() as Arc, - _namespace_id: namespace_id, + namespace_id, }; manager.devices.insert(id, device_info); From c2e27fdc23941c93586b48a51d719aeda3186064 Mon Sep 17 00:00:00 2001 From: Koichi Date: Sun, 31 Aug 2025 21:05:20 +0900 Subject: [PATCH 05/18] delete unnecessary comments Signed-off-by: Koichi --- awkernel_lib/src/storage.rs | 7 ------- 1 file changed, 7 deletions(-) diff --git a/awkernel_lib/src/storage.rs b/awkernel_lib/src/storage.rs index a85c4c234..19e6edd98 100644 --- a/awkernel_lib/src/storage.rs +++ b/awkernel_lib/src/storage.rs @@ -59,7 +59,6 @@ pub trait StorageDevice: Send + Sync { fn block_size(&self) -> usize; - /// Get the total number of blocks fn num_blocks(&self) -> u64; fn read_blocks(&self, buf: &mut [u8], transfer_id: u16) -> Result<(), StorageDevError>; @@ -93,7 +92,6 @@ enum IRQWaker { Interrupted, } -/// Get the namespace ID for a storage device pub fn get_device_namespace(device_id: u64) -> Option { let manager = STORAGE_MANAGER.read(); @@ -103,13 +101,11 @@ pub fn get_device_namespace(device_id: u64) -> Option { .and_then(|info| info.namespace_id) } -/// Get the block size for a storage device pub fn get_device_block_size(device_id: u64) -> Result { let device = get_storage_device(device_id)?; Ok(device.block_size()) } -/// Add a storage device to the manager pub fn add_storage_device(device: Arc, namespace_id: Option) -> u64 where T: StorageDevice + Send + Sync + 'static, @@ -132,7 +128,6 @@ where id } -/// Get a storage device as Arc pub fn get_storage_device(device_id: u64) -> Result, StorageManagerError> { let manager = STORAGE_MANAGER.read(); @@ -144,7 +139,6 @@ pub fn get_storage_device(device_id: u64) -> Result, Stor Ok(device_info.device.clone()) } -/// Get status information about a storage device pub fn get_storage_status(device_id: u64) -> Result { let manager = STORAGE_MANAGER.read(); @@ -167,7 +161,6 @@ pub fn get_storage_status(device_id: u64) -> Result Vec { let manager = STORAGE_MANAGER.read(); From 465b13804e490355d63233899f04314de5608996 Mon Sep 17 00:00:00 2001 From: Koichi Date: Sun, 31 Aug 2025 21:18:48 +0900 Subject: [PATCH 06/18] fix add_storage_device Signed-off-by: Koichi --- awkernel_lib/src/storage.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/awkernel_lib/src/storage.rs b/awkernel_lib/src/storage.rs index 19e6edd98..de7f15f92 100644 --- a/awkernel_lib/src/storage.rs +++ b/awkernel_lib/src/storage.rs @@ -106,10 +106,10 @@ pub fn get_device_block_size(device_id: u64) -> Result(device: Arc, namespace_id: Option) -> u64 -where - T: StorageDevice + Send + Sync + 'static, -{ +pub fn add_storage_device( + device: Arc, + namespace_id: Option, +) -> u64 { let mut manager = STORAGE_MANAGER.write(); if manager.device_id == u64::MAX { From a41e62d19010918ba5ab86c3132c9de0d4394b7f Mon Sep 17 00:00:00 2001 From: Koichi Date: Sun, 31 Aug 2025 22:42:02 +0900 Subject: [PATCH 07/18] separate trait and manager Signed-off-by: Koichi --- awkernel_lib/src/storage.rs | 48 ++-------------------- awkernel_lib/src/storage/storage_device.rs | 46 +++++++++++++++++++++ 2 files changed, 49 insertions(+), 45 deletions(-) create mode 100644 awkernel_lib/src/storage/storage_device.rs diff --git a/awkernel_lib/src/storage.rs b/awkernel_lib/src/storage.rs index de7f15f92..994c4e2bf 100644 --- a/awkernel_lib/src/storage.rs +++ b/awkernel_lib/src/storage.rs @@ -5,6 +5,9 @@ use alloc::{ sync::Arc, vec::Vec, }; +use storage_device::{StorageDevError, StorageDevice, StorageDeviceType}; + +pub mod storage_device; #[derive(Debug)] pub enum StorageManagerError { @@ -15,16 +18,6 @@ pub enum StorageManagerError { PoolNotInitialized, } -#[derive(Debug)] -pub enum StorageDevError { - IoError, - InvalidCommand, - DeviceNotReady, - InvalidBlock, - BufferTooSmall, - NotSupported, -} - #[derive(Debug)] pub struct StorageStatus { pub device_id: u64, @@ -35,41 +28,6 @@ pub struct StorageStatus { pub num_blocks: u64, } -#[derive(Debug, Clone, Copy)] -pub enum StorageDeviceType { - NVMe, - SATA, - USB, - VirtIO, - Memory, -} - -pub trait StorageDevice: Send + Sync { - fn device_id(&self) -> u64; - - fn device_name(&self) -> Cow<'static, str>; - - fn device_short_name(&self) -> Cow<'static, str>; - - fn device_type(&self) -> StorageDeviceType; - - fn irqs(&self) -> Vec; - - fn interrupt(&self, irq: u16) -> Result<(), StorageDevError>; - - fn block_size(&self) -> usize; - - fn num_blocks(&self) -> u64; - - fn read_blocks(&self, buf: &mut [u8], transfer_id: u16) -> Result<(), StorageDevError>; - - fn write_blocks(&self, buf: &[u8], transfer_id: u16) -> Result<(), StorageDevError>; - - fn flush(&self, _transfer_id: u16) -> Result<(), StorageDevError> { - Ok(()) - } -} - static STORAGE_MANAGER: RwLock = RwLock::new(StorageManager { devices: BTreeMap::new(), device_id: 0, diff --git a/awkernel_lib/src/storage/storage_device.rs b/awkernel_lib/src/storage/storage_device.rs new file mode 100644 index 000000000..905d941a9 --- /dev/null +++ b/awkernel_lib/src/storage/storage_device.rs @@ -0,0 +1,46 @@ +use alloc::{borrow::Cow, vec::Vec}; + +#[derive(Debug, Clone, Copy)] +pub enum StorageDeviceType { + NVMe, + SATA, + USB, + VirtIO, + Memory, +} + +#[derive(Debug)] +pub enum StorageDevError { + IoError, + InvalidCommand, + DeviceNotReady, + InvalidBlock, + BufferTooSmall, + NotSupported, +} + +pub trait StorageDevice: Send + Sync { + fn device_id(&self) -> u64; + + fn device_name(&self) -> Cow<'static, str>; + + fn device_short_name(&self) -> Cow<'static, str>; + + fn device_type(&self) -> StorageDeviceType; + + fn irqs(&self) -> Vec; + + fn interrupt(&self, irq: u16) -> Result<(), StorageDevError>; + + fn block_size(&self) -> usize; + + fn num_blocks(&self) -> u64; + + fn read_blocks(&self, buf: &mut [u8], transfer_id: u16) -> Result<(), StorageDevError>; + + fn write_blocks(&self, buf: &[u8], transfer_id: u16) -> Result<(), StorageDevError>; + + fn flush(&self, _transfer_id: u16) -> Result<(), StorageDevError> { + Ok(()) + } +} From 5040a1e6d183868bd39a342c8bbe1d13982e4f07 Mon Sep 17 00:00:00 2001 From: Koichi Date: Sun, 31 Aug 2025 22:44:15 +0900 Subject: [PATCH 08/18] separate trait and amanger Signed-off-by: Koichi --- awkernel_lib/src/storage.rs | 230 +-------------------- awkernel_lib/src/storage/storage_device.rs | 46 +++++ 2 files changed, 47 insertions(+), 229 deletions(-) create mode 100644 awkernel_lib/src/storage/storage_device.rs diff --git a/awkernel_lib/src/storage.rs b/awkernel_lib/src/storage.rs index de7f15f92..dfde592dc 100644 --- a/awkernel_lib/src/storage.rs +++ b/awkernel_lib/src/storage.rs @@ -1,229 +1 @@ -use crate::sync::{mcs::MCSNode, mutex::Mutex, rwlock::RwLock}; -use alloc::{ - borrow::Cow, - collections::{btree_map::Entry, BTreeMap}, - sync::Arc, - vec::Vec, -}; - -#[derive(Debug)] -pub enum StorageManagerError { - InvalidDeviceID, - InvalidTransferID, - DeviceError(StorageDevError), - NotYetImplemented, - PoolNotInitialized, -} - -#[derive(Debug)] -pub enum StorageDevError { - IoError, - InvalidCommand, - DeviceNotReady, - InvalidBlock, - BufferTooSmall, - NotSupported, -} - -#[derive(Debug)] -pub struct StorageStatus { - pub device_id: u64, - pub device_name: Cow<'static, str>, - pub device_type: StorageDeviceType, - pub irqs: Vec, - pub block_size: usize, - pub num_blocks: u64, -} - -#[derive(Debug, Clone, Copy)] -pub enum StorageDeviceType { - NVMe, - SATA, - USB, - VirtIO, - Memory, -} - -pub trait StorageDevice: Send + Sync { - fn device_id(&self) -> u64; - - fn device_name(&self) -> Cow<'static, str>; - - fn device_short_name(&self) -> Cow<'static, str>; - - fn device_type(&self) -> StorageDeviceType; - - fn irqs(&self) -> Vec; - - fn interrupt(&self, irq: u16) -> Result<(), StorageDevError>; - - fn block_size(&self) -> usize; - - fn num_blocks(&self) -> u64; - - fn read_blocks(&self, buf: &mut [u8], transfer_id: u16) -> Result<(), StorageDevError>; - - fn write_blocks(&self, buf: &[u8], transfer_id: u16) -> Result<(), StorageDevError>; - - fn flush(&self, _transfer_id: u16) -> Result<(), StorageDevError> { - Ok(()) - } -} - -static STORAGE_MANAGER: RwLock = RwLock::new(StorageManager { - devices: BTreeMap::new(), - device_id: 0, -}); - -static IRQ_WAKERS: Mutex> = Mutex::new(BTreeMap::new()); - -struct DeviceInfo { - device: Arc, - namespace_id: Option, -} - -pub struct StorageManager { - devices: BTreeMap, - device_id: u64, -} - -enum IRQWaker { - Waker(core::task::Waker), - Interrupted, -} - -pub fn get_device_namespace(device_id: u64) -> Option { - let manager = STORAGE_MANAGER.read(); - - manager - .devices - .get(&device_id) - .and_then(|info| info.namespace_id) -} - -pub fn get_device_block_size(device_id: u64) -> Result { - let device = get_storage_device(device_id)?; - Ok(device.block_size()) -} - -pub fn add_storage_device( - device: Arc, - namespace_id: Option, -) -> u64 { - let mut manager = STORAGE_MANAGER.write(); - - if manager.device_id == u64::MAX { - panic!("storage device id overflow"); - } - - let id = manager.device_id; - manager.device_id += 1; - - let device_info = DeviceInfo { - device: device.clone() as Arc, - namespace_id, - }; - manager.devices.insert(id, device_info); - - id -} - -pub fn get_storage_device(device_id: u64) -> Result, StorageManagerError> { - let manager = STORAGE_MANAGER.read(); - - let device_info = manager - .devices - .get(&device_id) - .ok_or(StorageManagerError::InvalidDeviceID)?; - - Ok(device_info.device.clone()) -} - -pub fn get_storage_status(device_id: u64) -> Result { - let manager = STORAGE_MANAGER.read(); - - let device_info = manager - .devices - .get(&device_id) - .ok_or(StorageManagerError::InvalidDeviceID)?; - - let device = &device_info.device; - - let status = StorageStatus { - device_id, - device_name: device.device_name(), - device_type: device.device_type(), - irqs: device.irqs(), - block_size: device.block_size(), - num_blocks: device.num_blocks(), - }; - - Ok(status) -} - -pub fn get_all_storage_statuses() -> Vec { - let manager = STORAGE_MANAGER.read(); - - let mut result = Vec::new(); - - for id in manager.devices.keys() { - if let Ok(status) = get_storage_status(*id) { - result.push(status); - } - } - - result -} - -/// Service routine for storage device interrupt. -/// This routine should be called by interrupt handlers provided by device drivers. -pub fn storage_interrupt(irq: u16) { - let mut node = MCSNode::new(); - let mut w = IRQ_WAKERS.lock(&mut node); - - match w.entry(irq) { - Entry::Occupied(e) => { - if matches!(e.get(), IRQWaker::Waker(_)) { - let IRQWaker::Waker(w) = e.remove() else { - return; - }; - - w.wake(); - } - } - Entry::Vacant(e) => { - e.insert(IRQWaker::Interrupted); - } - } -} - -/// Register a waker for a storage device interrupt service. -/// -/// The old waker will be replaced. -/// The waker will be called when the storage device interrupt occurs once -/// and it will be removed after it is called. -/// -/// Returns true if the waker is registered successfully. -/// Returns false if the interrupt occurred before. -pub fn register_waker_for_storage_interrupt(irq: u16, waker: core::task::Waker) -> bool { - let mut node = MCSNode::new(); - let mut w = IRQ_WAKERS.lock(&mut node); - - let entry = w.entry(irq); - - match entry { - Entry::Occupied(mut e) => { - if matches!(e.get(), IRQWaker::Interrupted) { - e.remove(); - false - } else { - e.insert(IRQWaker::Waker(waker)); - true - } - } - Entry::Vacant(e) => { - e.insert(IRQWaker::Waker(waker)); - true - } - } -} +pub mod storage_device; diff --git a/awkernel_lib/src/storage/storage_device.rs b/awkernel_lib/src/storage/storage_device.rs new file mode 100644 index 000000000..905d941a9 --- /dev/null +++ b/awkernel_lib/src/storage/storage_device.rs @@ -0,0 +1,46 @@ +use alloc::{borrow::Cow, vec::Vec}; + +#[derive(Debug, Clone, Copy)] +pub enum StorageDeviceType { + NVMe, + SATA, + USB, + VirtIO, + Memory, +} + +#[derive(Debug)] +pub enum StorageDevError { + IoError, + InvalidCommand, + DeviceNotReady, + InvalidBlock, + BufferTooSmall, + NotSupported, +} + +pub trait StorageDevice: Send + Sync { + fn device_id(&self) -> u64; + + fn device_name(&self) -> Cow<'static, str>; + + fn device_short_name(&self) -> Cow<'static, str>; + + fn device_type(&self) -> StorageDeviceType; + + fn irqs(&self) -> Vec; + + fn interrupt(&self, irq: u16) -> Result<(), StorageDevError>; + + fn block_size(&self) -> usize; + + fn num_blocks(&self) -> u64; + + fn read_blocks(&self, buf: &mut [u8], transfer_id: u16) -> Result<(), StorageDevError>; + + fn write_blocks(&self, buf: &[u8], transfer_id: u16) -> Result<(), StorageDevError>; + + fn flush(&self, _transfer_id: u16) -> Result<(), StorageDevError> { + Ok(()) + } +} From 18b1b4bf537acef3dca3926a680f25375894d98b Mon Sep 17 00:00:00 2001 From: Koichi Date: Sun, 31 Aug 2025 22:54:23 +0900 Subject: [PATCH 09/18] fix order Signed-off-by: Koichi --- awkernel_lib/src/storage.rs | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/awkernel_lib/src/storage.rs b/awkernel_lib/src/storage.rs index 994c4e2bf..b8f7aabfc 100644 --- a/awkernel_lib/src/storage.rs +++ b/awkernel_lib/src/storage.rs @@ -50,20 +50,6 @@ enum IRQWaker { Interrupted, } -pub fn get_device_namespace(device_id: u64) -> Option { - let manager = STORAGE_MANAGER.read(); - - manager - .devices - .get(&device_id) - .and_then(|info| info.namespace_id) -} - -pub fn get_device_block_size(device_id: u64) -> Result { - let device = get_storage_device(device_id)?; - Ok(device.block_size()) -} - pub fn add_storage_device( device: Arc, namespace_id: Option, @@ -133,6 +119,20 @@ pub fn get_all_storage_statuses() -> Vec { result } +pub fn get_device_namespace(device_id: u64) -> Option { + let manager = STORAGE_MANAGER.read(); + + manager + .devices + .get(&device_id) + .and_then(|info| info.namespace_id) +} + +pub fn get_device_block_size(device_id: u64) -> Result { + let device = get_storage_device(device_id)?; + Ok(device.block_size()) +} + /// Service routine for storage device interrupt. /// This routine should be called by interrupt handlers provided by device drivers. pub fn storage_interrupt(irq: u16) { From eed4d1529538e809bb038872410076f2d6c20443 Mon Sep 17 00:00:00 2001 From: Koichi Date: Sun, 31 Aug 2025 23:06:55 +0900 Subject: [PATCH 10/18] fix get_device_block_size Signed-off-by: Koichi --- awkernel_lib/src/storage.rs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/awkernel_lib/src/storage.rs b/awkernel_lib/src/storage.rs index b8f7aabfc..db36ee2f8 100644 --- a/awkernel_lib/src/storage.rs +++ b/awkernel_lib/src/storage.rs @@ -64,7 +64,7 @@ pub fn add_storage_device( manager.device_id += 1; let device_info = DeviceInfo { - device: device.clone() as Arc, + device, namespace_id, }; manager.devices.insert(id, device_info); @@ -72,7 +72,7 @@ pub fn add_storage_device( id } -pub fn get_storage_device(device_id: u64) -> Result, StorageManagerError> { +pub fn get_device_block_size(device_id: u64) -> Result { let manager = STORAGE_MANAGER.read(); let device_info = manager @@ -80,7 +80,7 @@ pub fn get_storage_device(device_id: u64) -> Result, Stor .get(&device_id) .ok_or(StorageManagerError::InvalidDeviceID)?; - Ok(device_info.device.clone()) + Ok(device_info.device.block_size()) } pub fn get_storage_status(device_id: u64) -> Result { @@ -128,11 +128,6 @@ pub fn get_device_namespace(device_id: u64) -> Option { .and_then(|info| info.namespace_id) } -pub fn get_device_block_size(device_id: u64) -> Result { - let device = get_storage_device(device_id)?; - Ok(device.block_size()) -} - /// Service routine for storage device interrupt. /// This routine should be called by interrupt handlers provided by device drivers. pub fn storage_interrupt(irq: u16) { From 09195a245de9de85543514be2a96dcef3d139339 Mon Sep 17 00:00:00 2001 From: Koichi Date: Sun, 31 Aug 2025 23:31:08 +0900 Subject: [PATCH 11/18] add get_storage_device Signed-off-by: Koichi --- awkernel_lib/src/storage.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/awkernel_lib/src/storage.rs b/awkernel_lib/src/storage.rs index db36ee2f8..3a2aeeab5 100644 --- a/awkernel_lib/src/storage.rs +++ b/awkernel_lib/src/storage.rs @@ -83,6 +83,17 @@ pub fn get_device_block_size(device_id: u64) -> Result Result { + let manager = STORAGE_MANAGER.read(); + + let device_info = manager + .devices + .get(&device_id) + .ok_or(StorageManagerError::InvalidDeviceID)?; + + Ok(device_info.device.block_size()) +} + pub fn get_storage_status(device_id: u64) -> Result { let manager = STORAGE_MANAGER.read(); From c093fe0f0cf33f85466ffdb8aec8184fe3a255e3 Mon Sep 17 00:00:00 2001 From: Koichi Date: Sun, 31 Aug 2025 23:31:58 +0900 Subject: [PATCH 12/18] fix Signed-off-by: Koichi --- awkernel_lib/src/storage.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/awkernel_lib/src/storage.rs b/awkernel_lib/src/storage.rs index 3a2aeeab5..691eddfdb 100644 --- a/awkernel_lib/src/storage.rs +++ b/awkernel_lib/src/storage.rs @@ -83,7 +83,7 @@ pub fn get_device_block_size(device_id: u64) -> Result Result { +pub fn get_storage_device(device_id: u64) -> Result, StorageManagerError> { let manager = STORAGE_MANAGER.read(); let device_info = manager @@ -91,7 +91,7 @@ pub fn get_device_block_size(device_id: u64) -> Result Result { From 717106c97141ea85d11f194e2d2d3e3526e5e316 Mon Sep 17 00:00:00 2001 From: Koichi Date: Sun, 31 Aug 2025 23:53:08 +0900 Subject: [PATCH 13/18] delete device_info Signed-off-by: Koichi --- awkernel_lib/src/storage.rs | 32 ++++++---------------- awkernel_lib/src/storage/storage_device.rs | 4 +++ 2 files changed, 13 insertions(+), 23 deletions(-) diff --git a/awkernel_lib/src/storage.rs b/awkernel_lib/src/storage.rs index 691eddfdb..0c440d532 100644 --- a/awkernel_lib/src/storage.rs +++ b/awkernel_lib/src/storage.rs @@ -35,13 +35,8 @@ static STORAGE_MANAGER: RwLock = RwLock::new(StorageManager { static IRQ_WAKERS: Mutex> = Mutex::new(BTreeMap::new()); -struct DeviceInfo { - device: Arc, - namespace_id: Option, -} - pub struct StorageManager { - devices: BTreeMap, + devices: BTreeMap>, device_id: u64, } @@ -50,10 +45,7 @@ enum IRQWaker { Interrupted, } -pub fn add_storage_device( - device: Arc, - namespace_id: Option, -) -> u64 { +pub fn add_storage_device(device: Arc) -> u64 { let mut manager = STORAGE_MANAGER.write(); if manager.device_id == u64::MAX { @@ -63,11 +55,7 @@ pub fn add_storage_device( let id = manager.device_id; manager.device_id += 1; - let device_info = DeviceInfo { - device, - namespace_id, - }; - manager.devices.insert(id, device_info); + manager.devices.insert(id, device); id } @@ -75,35 +63,33 @@ pub fn add_storage_device( pub fn get_device_block_size(device_id: u64) -> Result { let manager = STORAGE_MANAGER.read(); - let device_info = manager + let device = manager .devices .get(&device_id) .ok_or(StorageManagerError::InvalidDeviceID)?; - Ok(device_info.device.block_size()) + Ok(device.block_size()) } pub fn get_storage_device(device_id: u64) -> Result, StorageManagerError> { let manager = STORAGE_MANAGER.read(); - let device_info = manager + let device = manager .devices .get(&device_id) .ok_or(StorageManagerError::InvalidDeviceID)?; - Ok(device_info.device.clone()) + Ok(device.clone()) } pub fn get_storage_status(device_id: u64) -> Result { let manager = STORAGE_MANAGER.read(); - let device_info = manager + let device = manager .devices .get(&device_id) .ok_or(StorageManagerError::InvalidDeviceID)?; - let device = &device_info.device; - let status = StorageStatus { device_id, device_name: device.device_name(), @@ -136,7 +122,7 @@ pub fn get_device_namespace(device_id: u64) -> Option { manager .devices .get(&device_id) - .and_then(|info| info.namespace_id) + .and_then(|device| device.get_namespace_id()) } /// Service routine for storage device interrupt. diff --git a/awkernel_lib/src/storage/storage_device.rs b/awkernel_lib/src/storage/storage_device.rs index 905d941a9..182794164 100644 --- a/awkernel_lib/src/storage/storage_device.rs +++ b/awkernel_lib/src/storage/storage_device.rs @@ -43,4 +43,8 @@ pub trait StorageDevice: Send + Sync { fn flush(&self, _transfer_id: u16) -> Result<(), StorageDevError> { Ok(()) } + + fn get_namespace_id(&self) -> Option { + None + } } From 8e0cc6dd449888609839b5ef4ad85ed248dbe3ec Mon Sep 17 00:00:00 2001 From: Koichi Date: Mon, 1 Sep 2025 00:02:28 +0900 Subject: [PATCH 14/18] replace and_then Signed-off-by: Koichi --- awkernel_lib/src/storage.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/awkernel_lib/src/storage.rs b/awkernel_lib/src/storage.rs index 0c440d532..6bd5732dc 100644 --- a/awkernel_lib/src/storage.rs +++ b/awkernel_lib/src/storage.rs @@ -119,10 +119,8 @@ pub fn get_all_storage_statuses() -> Vec { pub fn get_device_namespace(device_id: u64) -> Option { let manager = STORAGE_MANAGER.read(); - manager - .devices - .get(&device_id) - .and_then(|device| device.get_namespace_id()) + let device = manager.devices.get(&device_id)?; + device.get_namespace_id() } /// Service routine for storage device interrupt. From 24c5b68b9881f729184dc3488ce818b0b580225a Mon Sep 17 00:00:00 2001 From: Koichi Date: Mon, 1 Sep 2025 12:30:54 +0900 Subject: [PATCH 15/18] add interrupt handler tasks Signed-off-by: Koichi --- applications/awkernel_services/src/lib.rs | 10 +- .../awkernel_services/src/storage_service.rs | 152 ++++++++++++++++++ awkernel_lib/src/storage.rs | 68 ++++++++ 3 files changed, 229 insertions(+), 1 deletion(-) create mode 100644 applications/awkernel_services/src/storage_service.rs diff --git a/applications/awkernel_services/src/lib.rs b/applications/awkernel_services/src/lib.rs index 900163ffb..294d10a6c 100644 --- a/applications/awkernel_services/src/lib.rs +++ b/applications/awkernel_services/src/lib.rs @@ -7,8 +7,9 @@ mod network_service; use core::time::Duration; -const NETWORK_SERVICE_NAME: &str = "[Awkernel] network service"; const BUFFERED_LOGGER_NAME: &str = "[Awkernel] buffered logger service"; +const NETWORK_SERVICE_NAME: &str = "[Awkernel] network service"; +const STORAGE_SERVICE_NAME: &str = "[Awkernel] storage service"; const DISPLAY_SERVICE_NAME: &str = "[Awkernel] display service"; pub async fn run() { @@ -26,6 +27,13 @@ pub async fn run() { ) .await; + awkernel_async_lib::spawn( + STORAGE_SERVICE_NAME.into(), + storage_service::run(), + awkernel_async_lib::scheduler::SchedulerType::PrioritizedFIFO(0), + ) + .await; + awkernel_async_lib::spawn( DISPLAY_SERVICE_NAME.into(), awkernel_display::run(), diff --git a/applications/awkernel_services/src/storage_service.rs b/applications/awkernel_services/src/storage_service.rs new file mode 100644 index 000000000..de4d2cecf --- /dev/null +++ b/applications/awkernel_services/src/storage_service.rs @@ -0,0 +1,152 @@ +use core::{future::Future, task::Poll}; + +use alloc::{collections::BTreeMap, format}; +use awkernel_async_lib::{ + future::FutureExt, pubsub, scheduler::SchedulerType, select_biased, session_types::*, +}; + +const STORAGE_SERVICE_RENDEZVOUS: &str = "/awkernel/storage_service"; + +type ProtoInterruptHandler = Recv<(), Send<(), Eps>>; +type ChanProtoInterruptHandlerDual = Chan<(), ::Dual>; + +pub async fn run() { + log::info!("Starting {}.", crate::STORAGE_SERVICE_NAME); + + let mut _ch_irq_handlers = BTreeMap::new(); + + for storage_status in awkernel_lib::storage::get_all_storage_statuses() { + log::info!("Initializing interrupt handlers for {}.", storage_status.device_name); + + spawn_handlers(storage_status, &mut _ch_irq_handlers).await; + } + + let subscriber = pubsub::create_subscriber::<(&'static str, u64)>( + STORAGE_SERVICE_RENDEZVOUS.into(), + pubsub::Attribute { + queue_size: 8, + flow_control: true, + transient_local: false, + lifespan: pubsub::Lifespan::Permanent, + }, + ) + .unwrap(); + + loop { + let data = subscriber.recv().await; + + match data.data { + // Storage devices don't support runtime up/down like network devices + // Following the OpenBSD model: storage devices are operational once attached + ("up", _id) | ("down", _id) => { + log::warn!("Storage devices don't support runtime up/down operations"); + } + ("shutdown", _id) => { + // On shutdown, properly close all interrupt handler channels + while let Some((_irq, ch)) = _ch_irq_handlers.pop_first() { + let ch = ch.send(()).await; + let (ch, _) = ch.recv().await; + ch.close(); + } + break; + } + _ => (), + } + } +} + +async fn spawn_handlers( + storage_status: awkernel_lib::storage::StorageStatus, + ch_irq_handlers: &mut BTreeMap, +) { + for irq in storage_status.irqs { + // Check if we already have a handler for this IRQ + // Multiple devices might share the same IRQ (e.g., NVMe controller and its namespaces) + if ch_irq_handlers.contains_key(&irq) { + continue; + } + + let (server, client) = session_channel::(); + ch_irq_handlers.insert(irq, client); + + let name = format!( + "{}:{}: IRQ = {irq}", + crate::STORAGE_SERVICE_NAME, + storage_status.device_name, + ); + + awkernel_async_lib::spawn( + name.into(), + interrupt_handler(storage_status.device_id, irq, server), + SchedulerType::FIFO, + ) + .await; + } +} + +// Interrupt handlers. + +struct StorageInterrupt { + irq: u16, + wait: bool, +} + +impl Future for StorageInterrupt { + type Output = (); + + fn poll( + self: core::pin::Pin<&mut Self>, + cx: &mut core::task::Context<'_>, + ) -> core::task::Poll { + let m = self.get_mut(); + + if !m.wait { + return Poll::Ready(()); + } + + m.wait = false; + + if awkernel_lib::storage::register_waker_for_storage_interrupt(m.irq, cx.waker().clone()) { + Poll::Pending + } else { + Poll::Ready(()) + } + } +} + +async fn interrupt_handler(interface_id: u64, irq: u16, ch: Chan<(), ProtoInterruptHandler>) { + let mut ch = ch.recv().boxed().fuse(); + + loop { + let mut empty = async {}.boxed().fuse(); + + select_biased! { + (ch, _) = ch => { + let ch = ch.send(()).await; + ch.close(); + return; + }, + _ = empty => {}, + } + + if awkernel_lib::storage::handle_storage_interrupt(interface_id, irq) { + awkernel_async_lib::r#yield().await; + continue; + } + + // Wait interrupts. + let mut irq_wait = StorageInterrupt { irq, wait: true }.fuse(); + + select_biased! { + (ch, _) = ch => { + let ch = ch.send(()).await; + ch.close(); + return; + }, + _ = irq_wait => {}, + } + + awkernel_lib::storage::handle_storage_interrupt(interface_id, irq); + awkernel_async_lib::r#yield().await; + } +} diff --git a/awkernel_lib/src/storage.rs b/awkernel_lib/src/storage.rs index 6bd5732dc..935e57554 100644 --- a/awkernel_lib/src/storage.rs +++ b/awkernel_lib/src/storage.rs @@ -175,3 +175,71 @@ pub fn register_waker_for_storage_interrupt(irq: u16, waker: core::task::Waker) } } } + +pub fn handle_storage_interrupt(device_id: u64, irq: u16) -> bool { + let manager = STORAGE_MANAGER.read(); + + let Some(device_info) = manager.devices.get(&device_id) else { + return false; + }; + + let _ = device_info.device.interrupt(irq); + + drop(manager); + + // TODO: Wake tasks waiting for completion + + false +} + +struct TransferCompletionFuture { + transfer_id: u16, + poll_count: u32, +} + +impl TransferCompletionFuture { + fn new(transfer_id: u16) -> Self { + Self { + transfer_id, + poll_count: 0, + } + } +} + +impl Future for TransferCompletionFuture { + type Output = Result<(), StorageManagerError>; + + fn poll(mut self: Pin<&mut Self>, cx: &mut Context) -> Poll { + self.poll_count += 1; + + // Register waker first - this ensures the interrupt handler can wake us + // if the transfer completes after we check + transfer_set_waker(self.transfer_id, Some(cx.waker().clone()))?; + + let completed = transfer_is_completed(self.transfer_id)?; + + if completed { + let status = transfer_get_status(self.transfer_id)?; + if status == 0 { + Poll::Ready(Ok(())) + } else { + Poll::Ready(Err(StorageManagerError::DeviceError( + StorageDevError::IoError, + ))) + } + } else { + let is_poll = transfer_is_poll_mode(self.transfer_id)?; + if is_poll { + let timeout_ms = transfer_get_timeout_ms(self.transfer_id)?; + if self.poll_count > timeout_ms { + transfer_mark_completed(self.transfer_id, 1)?; + return Poll::Ready(Err(StorageManagerError::DeviceError( + StorageDevError::IoError, + ))); + } + } + + Poll::Pending + } + } +} From cadc27351d1da292729a9e909b9bc76caf482282 Mon Sep 17 00:00:00 2001 From: Koichi Date: Mon, 1 Sep 2025 13:12:17 +0900 Subject: [PATCH 16/18] fix Signed-off-by: Koichi --- applications/awkernel_services/src/lib.rs | 1 + .../awkernel_services/src/storage_service.rs | 9 ++- awkernel_lib/src/storage.rs | 56 +------------------ 3 files changed, 9 insertions(+), 57 deletions(-) diff --git a/applications/awkernel_services/src/lib.rs b/applications/awkernel_services/src/lib.rs index 294d10a6c..e9b80dbbd 100644 --- a/applications/awkernel_services/src/lib.rs +++ b/applications/awkernel_services/src/lib.rs @@ -4,6 +4,7 @@ extern crate alloc; mod buffered_logger; mod network_service; +mod storage_service; use core::time::Duration; diff --git a/applications/awkernel_services/src/storage_service.rs b/applications/awkernel_services/src/storage_service.rs index de4d2cecf..60dba8d07 100644 --- a/applications/awkernel_services/src/storage_service.rs +++ b/applications/awkernel_services/src/storage_service.rs @@ -16,8 +16,11 @@ pub async fn run() { let mut _ch_irq_handlers = BTreeMap::new(); for storage_status in awkernel_lib::storage::get_all_storage_statuses() { - log::info!("Initializing interrupt handlers for {}.", storage_status.device_name); - + log::info!( + "Initializing interrupt handlers for {}.", + storage_status.device_name + ); + spawn_handlers(storage_status, &mut _ch_irq_handlers).await; } @@ -78,7 +81,7 @@ async fn spawn_handlers( awkernel_async_lib::spawn( name.into(), interrupt_handler(storage_status.device_id, irq, server), - SchedulerType::FIFO, + SchedulerType::PrioritizedFIFO(0), ) .await; } diff --git a/awkernel_lib/src/storage.rs b/awkernel_lib/src/storage.rs index 935e57554..f222c1dcb 100644 --- a/awkernel_lib/src/storage.rs +++ b/awkernel_lib/src/storage.rs @@ -179,11 +179,11 @@ pub fn register_waker_for_storage_interrupt(irq: u16, waker: core::task::Waker) pub fn handle_storage_interrupt(device_id: u64, irq: u16) -> bool { let manager = STORAGE_MANAGER.read(); - let Some(device_info) = manager.devices.get(&device_id) else { + let Some(device) = manager.devices.get(&device_id) else { return false; }; - let _ = device_info.device.interrupt(irq); + let _ = device.interrupt(irq); drop(manager); @@ -191,55 +191,3 @@ pub fn handle_storage_interrupt(device_id: u64, irq: u16) -> bool { false } - -struct TransferCompletionFuture { - transfer_id: u16, - poll_count: u32, -} - -impl TransferCompletionFuture { - fn new(transfer_id: u16) -> Self { - Self { - transfer_id, - poll_count: 0, - } - } -} - -impl Future for TransferCompletionFuture { - type Output = Result<(), StorageManagerError>; - - fn poll(mut self: Pin<&mut Self>, cx: &mut Context) -> Poll { - self.poll_count += 1; - - // Register waker first - this ensures the interrupt handler can wake us - // if the transfer completes after we check - transfer_set_waker(self.transfer_id, Some(cx.waker().clone()))?; - - let completed = transfer_is_completed(self.transfer_id)?; - - if completed { - let status = transfer_get_status(self.transfer_id)?; - if status == 0 { - Poll::Ready(Ok(())) - } else { - Poll::Ready(Err(StorageManagerError::DeviceError( - StorageDevError::IoError, - ))) - } - } else { - let is_poll = transfer_is_poll_mode(self.transfer_id)?; - if is_poll { - let timeout_ms = transfer_get_timeout_ms(self.transfer_id)?; - if self.poll_count > timeout_ms { - transfer_mark_completed(self.transfer_id, 1)?; - return Poll::Ready(Err(StorageManagerError::DeviceError( - StorageDevError::IoError, - ))); - } - } - - Poll::Pending - } - } -} From ce736cd439751bfc17875bb2755fd4f575692e2b Mon Sep 17 00:00:00 2001 From: Koichi Date: Tue, 2 Sep 2025 17:18:48 +0900 Subject: [PATCH 17/18] fix Signed-off-by: Koichi --- .../awkernel_services/src/storage_service.rs | 43 +------------------ 1 file changed, 2 insertions(+), 41 deletions(-) diff --git a/applications/awkernel_services/src/storage_service.rs b/applications/awkernel_services/src/storage_service.rs index 60dba8d07..6deb78ef8 100644 --- a/applications/awkernel_services/src/storage_service.rs +++ b/applications/awkernel_services/src/storage_service.rs @@ -13,48 +13,10 @@ type ChanProtoInterruptHandlerDual = Chan<(), pub async fn run() { log::info!("Starting {}.", crate::STORAGE_SERVICE_NAME); - let mut _ch_irq_handlers = BTreeMap::new(); + let mut ch_irq_handlers = BTreeMap::new(); for storage_status in awkernel_lib::storage::get_all_storage_statuses() { - log::info!( - "Initializing interrupt handlers for {}.", - storage_status.device_name - ); - - spawn_handlers(storage_status, &mut _ch_irq_handlers).await; - } - - let subscriber = pubsub::create_subscriber::<(&'static str, u64)>( - STORAGE_SERVICE_RENDEZVOUS.into(), - pubsub::Attribute { - queue_size: 8, - flow_control: true, - transient_local: false, - lifespan: pubsub::Lifespan::Permanent, - }, - ) - .unwrap(); - - loop { - let data = subscriber.recv().await; - - match data.data { - // Storage devices don't support runtime up/down like network devices - // Following the OpenBSD model: storage devices are operational once attached - ("up", _id) | ("down", _id) => { - log::warn!("Storage devices don't support runtime up/down operations"); - } - ("shutdown", _id) => { - // On shutdown, properly close all interrupt handler channels - while let Some((_irq, ch)) = _ch_irq_handlers.pop_first() { - let ch = ch.send(()).await; - let (ch, _) = ch.recv().await; - ch.close(); - } - break; - } - _ => (), - } + spawn_handlers(storage_status, &mut ch_irq_handlers).await; } } @@ -64,7 +26,6 @@ async fn spawn_handlers( ) { for irq in storage_status.irqs { // Check if we already have a handler for this IRQ - // Multiple devices might share the same IRQ (e.g., NVMe controller and its namespaces) if ch_irq_handlers.contains_key(&irq) { continue; } From f90ba9f2c76bf97096a1ac900b26b64dbdf0d316 Mon Sep 17 00:00:00 2001 From: Koichi Date: Tue, 2 Sep 2025 18:44:27 +0900 Subject: [PATCH 18/18] delete unnecessary Signed-off-by: Koichi --- applications/awkernel_services/src/storage_service.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/applications/awkernel_services/src/storage_service.rs b/applications/awkernel_services/src/storage_service.rs index 6deb78ef8..6f5c2f648 100644 --- a/applications/awkernel_services/src/storage_service.rs +++ b/applications/awkernel_services/src/storage_service.rs @@ -2,11 +2,9 @@ use core::{future::Future, task::Poll}; use alloc::{collections::BTreeMap, format}; use awkernel_async_lib::{ - future::FutureExt, pubsub, scheduler::SchedulerType, select_biased, session_types::*, + future::FutureExt, scheduler::SchedulerType, select_biased, session_types::*, }; -const STORAGE_SERVICE_RENDEZVOUS: &str = "/awkernel/storage_service"; - type ProtoInterruptHandler = Recv<(), Send<(), Eps>>; type ChanProtoInterruptHandlerDual = Chan<(), ::Dual>;