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

Get rid of _helper from the Rust names of helpers #239

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,15 @@ pub trait KernelModule: Sized + Sync {
}

extern "C" {
fn bug_helper() -> !;
#[link_name="bug_helper"]
#[allow(improper_style)]
fn BUG() -> !;
}

#[panic_handler]
fn panic(_info: &PanicInfo) -> ! {
unsafe {
bug_helper();
BUG();
}
}

Expand Down
5 changes: 3 additions & 2 deletions src/user_ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ use crate::c_types;
use crate::error;

extern "C" {
fn access_ok_helper(addr: *const c_types::c_void, len: c_types::c_ulong) -> c_types::c_int;
#[link_name="access_ok_helper"]
fn access_ok(addr: *const c_types::c_void, len: c_types::c_ulong) -> c_types::c_int;
}

/// A reference to an area in userspace memory, which can be either
Expand Down Expand Up @@ -55,7 +56,7 @@ impl UserSlicePtr {
ptr: *mut c_types::c_void,
length: usize,
) -> error::KernelResult<UserSlicePtr> {
if access_ok_helper(ptr, length as c_types::c_ulong) == 0 {
if access_ok(ptr, length as c_types::c_ulong) == 0 {
return Err(error::Error::EFAULT);
}
Ok(UserSlicePtr(ptr, length))
Expand Down