Skip to content

Commit

Permalink
doc: trd: storage: update policy trait
Browse files Browse the repository at this point in the history
The policy is generally the same but the specific implementation is
different.
  • Loading branch information
bradjc committed Jun 11, 2024
1 parent 18bce19 commit c6900e2
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions doc/reference/trd-storage-permissions.md
Original file line number Diff line number Diff line change
Expand Up @@ -288,20 +288,24 @@ examples of how storage permissions may be specified.
The core kernel allows individual boards to configure how permissions are
assigned to applications. At runtime, the kernel needs to know what permissions
each executing process has. To facilitate this, Tock uses the
`ProcessStoragePermissionsPolicy` process policy. Each process, when created,
will have a reference to a policy that specifies the storage permissions for
`ProcessStandardStoragePermissionsPolicy` process policy. Each process, when created,
will store a `StoragePermissions` object that specifies the storage permissions for
that process.


```rust
/// Generic trait for implementing a policy on how applications should be
/// assigned storage permissions.
pub trait ProcessStoragePermissionsPolicy {
pub trait ProcessStandardStoragePermissionsPolicy<C: Chip> {
/// Return the storage permissions for the specified `process`.
fn get_permissions(&self, process: &dyn Process) -> &'static dyn StoragePermissions;
fn get_permissions(&self, process: &ProcessStandard<C>) -> StoragePermissions;
}
```

This trait is specific to the `ProcessStandard` implementation of `Process` to
enable policies to use TBF headers when assigning permissions.

Several examples of policies are in the `capsules/system` crate.


8 Storage Examples
-------------------------------
Expand Down

0 comments on commit c6900e2

Please sign in to comment.