Skip to content

Commit

Permalink
crates/sel4-microkit: Rename ProtectionDomain -> Child
Browse files Browse the repository at this point in the history
Signed-off-by: Nick Spinale <nick@nickspinale.com>
  • Loading branch information
nspin committed Jul 1, 2024
1 parent 08ee65b commit 1827d09
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions crates/sel4-microkit/base/src/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@ impl fmt::Display for IrqAckError {

/// A handle to a child protection domain, identified by a child protection domain index.
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct ProtectionDomain {
pub struct Child {
index: usize,
}

impl ProtectionDomain {
impl Child {
pub const fn new(index: usize) -> Self {
Self { index }
}
Expand Down
10 changes: 5 additions & 5 deletions crates/sel4-microkit/base/src/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use core::fmt;
use crate::{
defer::{DeferredAction, PreparedDeferredAction},
ipc::{self, Event},
pd_is_passive, Channel, MessageInfo, ProtectionDomain,
pd_is_passive, Channel, Child, MessageInfo,
};

pub use core::convert::Infallible;
Expand Down Expand Up @@ -39,10 +39,10 @@ pub trait Handler {

fn fault(
&mut self,
pd: ProtectionDomain,
child: Child,
msg_info: MessageInfo,
) -> Result<Option<MessageInfo>, Self::Error> {
panic!("unexpected fault from protection domain {pd:?} with msg_info={msg_info:?}")
panic!("unexpected fault from protection domain {child:?} with msg_info={msg_info:?}")
}

/// An advanced feature for use by protection domains which seek to coalesce syscalls when
Expand Down Expand Up @@ -81,8 +81,8 @@ pub trait Handler {
Event::Protected(channel, msg_info) => {
reply_tag = Some(self.protected(channel, msg_info)?);
}
Event::Fault(pd, msg_info) => {
reply_tag = self.fault(pd, msg_info)?;
Event::Fault(child, msg_info) => {
reply_tag = self.fault(child, msg_info)?;
}
};

Expand Down
6 changes: 3 additions & 3 deletions crates/sel4-microkit/base/src/ipc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use crate::MessageInfo;

use crate::{defer::PreparedDeferredAction, Channel, ProtectionDomain};
use crate::{defer::PreparedDeferredAction, Channel, Child};

const INPUT_CAP: sel4::cap::Endpoint = sel4::Cap::from_bits(1);
const REPLY_CAP: sel4::cap::Reply = sel4::Cap::from_bits(4);
Expand All @@ -29,7 +29,7 @@ fn strip_flag(badge: sel4::Badge, bit: usize) -> Option<sel4::Word> {
pub enum Event {
Notified(NotifiedEvent),
Protected(Channel, MessageInfo),
Fault(ProtectionDomain, MessageInfo),
Fault(Child, MessageInfo),
}

impl Event {
Expand All @@ -41,7 +41,7 @@ impl Event {
)
} else if let Some(pd_index) = strip_flag(badge, PD_BADGE_BIT) {
Self::Fault(
ProtectionDomain::new(pd_index.try_into().unwrap()),
Child::new(pd_index.try_into().unwrap()),
MessageInfo::from_inner(tag),
)
} else {
Expand Down
2 changes: 1 addition & 1 deletion crates/sel4-microkit/base/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ mod symbols;
#[doc(hidden)]
pub mod ipc;

pub use channel::{Channel, IrqAckError, ProtectionDomain};
pub use channel::{Channel, Child, IrqAckError};
pub use defer::{DeferredAction, DeferredActionInterface, DeferredActionSlot};
pub use handler::{Handler, Infallible, Never, NullHandler};
pub use message::{
Expand Down

0 comments on commit 1827d09

Please sign in to comment.