Skip to content

Commit

Permalink
load_done() in DBS now reports a Result<(), ProcessLoadError>
Browse files Browse the repository at this point in the history
  • Loading branch information
viswajith-g committed Feb 12, 2025
1 parent 296189e commit 51fb059
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
3 changes: 2 additions & 1 deletion capsules/extra/src/app_loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ use core::cmp;

use kernel::dynamic_binary_storage;
use kernel::grant::{AllowRoCount, AllowRwCount, Grant, UpcallCount};
use kernel::process::ProcessLoadError;
use kernel::processbuffer::ReadableProcessBuffer;
use kernel::syscall::{CommandReturn, SyscallDriver};
use kernel::utilities::cells::{OptionalCell, TakeCell};
Expand Down Expand Up @@ -231,7 +232,7 @@ impl kernel::dynamic_binary_storage::DynamicBinaryStoreClient for AppLoader<'_>

impl kernel::dynamic_binary_storage::DynamicProcessLoadClient for AppLoader<'_> {
/// Let the requesting app know we are done loading the new process
fn load_done(&self) {
fn load_done(&self, _result: Result<(), ProcessLoadError>) {
self.current_process.map(|processid| {
let _ = self.apps.enter(processid, move |_app, kernel_data| {
// Signal the app.
Expand Down
15 changes: 5 additions & 10 deletions kernel/src/dynamic_binary_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,9 @@ pub trait DynamicBinaryStore {
/// in flash to store said process.
///
/// Return value:
/// - `Ok((length, wait_for_setup))`: If there is a place to load the
/// - `Ok(length)`: If there is a place to load the
/// process, the function will return `Ok()` with the size of the region
/// to store the process, and whether the process loader is waiting to set
/// up. This usually happens when we have to write a post pad app. The
/// client app is unable to write new app data until the process loader
/// finishes writing the padding app. So if tihs flag is set, then the
/// client app has to wait until the setup_done subscribe callback is
/// received.
/// to store the process.
/// - `Err(ErrorCode)`: If there is nowhere to store the process a suitable
/// `ErrorCode` will be returned.
fn setup(&self, app_length: usize) -> Result<usize, ErrorCode>;
Expand Down Expand Up @@ -118,7 +113,7 @@ pub trait DynamicProcessLoad {
/// The callback for dynamic binary flashing.
pub trait DynamicProcessLoadClient {
/// The new app has been loaded.
fn load_done(&self);
fn load_done(&self, result: Result<(), ProcessLoadError>);
}

/// Dynamic process loading machine.
Expand Down Expand Up @@ -437,7 +432,7 @@ impl<C: Chip + 'static, D: ProcessStandardDebug + 'static> ProcessLoadingAsyncCl
match result {
Ok(()) => {
self.load_client.map(|client| {
client.load_done();
client.load_done(result);
});
}
Err(_e) => {
Expand All @@ -449,7 +444,7 @@ impl<C: Chip + 'static, D: ProcessStandardDebug + 'static> ProcessLoadingAsyncCl
}

fn process_loading_finished(&self) {
debug!("Process Loaded");
unimplemented!();
}
}

Expand Down

0 comments on commit 51fb059

Please sign in to comment.