Struct kernel::miscdev::Registration
source · [−]pub struct Registration<T: Operations> { /* private fields */ }
Expand description
A registration of a miscellaneous device.
Invariants
Context
is always initialised when registered
is true
, and not initialised otherwise.
Implementations
sourceimpl<T: Operations> Registration<T>
impl<T: Operations> Registration<T>
sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new Registration
but does not register it yet.
It is allowed to move.
sourcepub fn new_pinned(
name: Arguments<'_>,
open_data: T::OpenData
) -> Result<Pin<Box<Self>>>
pub fn new_pinned(
name: Arguments<'_>,
open_data: T::OpenData
) -> Result<Pin<Box<Self>>>
Registers a miscellaneous device.
Returns a pinned heap-allocated representation of the registration.
sourcepub fn register(
self: Pin<&mut Self>,
name: Arguments<'_>,
open_data: T::OpenData
) -> Result
pub fn register(
self: Pin<&mut Self>,
name: Arguments<'_>,
open_data: T::OpenData
) -> Result
Registers a miscellaneous device with the rest of the kernel.
It must be pinned because the memory block that represents the registration is self-referential.
sourcepub fn register_with_options(
self: Pin<&mut Self>,
name: Arguments<'_>,
open_data: T::OpenData,
opts: &Options<'_>
) -> Result
pub fn register_with_options(
self: Pin<&mut Self>,
name: Arguments<'_>,
open_data: T::OpenData,
opts: &Options<'_>
) -> Result
Registers a miscellaneous device with the rest of the kernel. Additional optional settings
are provided via the opts
parameter.
It must be pinned because the memory block that represents the registration is self-referential.
Trait Implementations
sourceimpl<T: Operations> Default for Registration<T>
impl<T: Operations> Default for Registration<T>
sourceimpl<T: Operations> Drop for Registration<T>
impl<T: Operations> Drop for Registration<T>
sourceimpl<T: Operations> OpenAdapter<<T as Operations>::OpenData> for Registration<T>
impl<T: Operations> OpenAdapter<<T as Operations>::OpenData> for Registration<T>
sourceunsafe fn convert(_inode: *mut inode, file: *mut file) -> *const T::OpenData
unsafe fn convert(_inode: *mut inode, file: *mut file) -> *const T::OpenData
Converts untyped data stored in [
struct inode
] and [struct file
] (when [struct file_operations::open
] is called) into the given type. For example, for miscdev
devices, a pointer to the registered [struct miscdev
] is stored in [struct file::private_data
]. Read moreimpl<T: Operations> Send for Registration<T>where
T::OpenData: Send,
impl<T: Operations> Sync for Registration<T>
Auto Trait Implementations
impl<T> RefUnwindSafe for Registration<T>where
<T as Operations>::OpenData: RefUnwindSafe,
impl<T> !Unpin for Registration<T>
impl<T> UnwindSafe for Registration<T>where
<T as Operations>::OpenData: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more