Skip to content
This repository has been archived by the owner on Mar 7, 2021. It is now read-only.

Commit

Permalink
impl SysctlStorage for &T where T: SysctlStorage
Browse files Browse the repository at this point in the history
  • Loading branch information
geofft authored and alex committed Aug 19, 2019
1 parent 64178fb commit 6e3fa4a
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/sysctl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,19 @@ fn trim_whitespace(mut data: &[u8]) -> &[u8] {
data
}

impl<T> SysctlStorage for &T
where
T: SysctlStorage,
{
fn store_value(&self, data: &[u8]) -> (usize, error::KernelResult<()>) {
(*self).store_value(data)
}

fn read_value(&self, data: &mut UserSlicePtrWriter) -> (usize, error::KernelResult<()>) {
(*self).read_value(data)
}
}

impl SysctlStorage for atomic::AtomicBool {
fn store_value(&self, data: &[u8]) -> (usize, error::KernelResult<()>) {
let result = match trim_whitespace(data) {
Expand Down

0 comments on commit 6e3fa4a

Please sign in to comment.