Struct kernel::chrdev::Registration
source · [−]pub struct Registration<const N: usize> { /* private fields */ }
Expand description
Character device registration.
May contain up to a fixed number (N
) of devices. Must be pinned.
Implementations
sourceimpl<const N: usize> Registration<{ N }>
impl<const N: usize> Registration<{ N }>
sourcepub fn new(
name: &'static CStr,
minors_start: u16,
this_module: &'static ThisModule
) -> Self
pub fn new(
name: &'static CStr,
minors_start: u16,
this_module: &'static ThisModule
) -> Self
Creates a Registration
object for a character device.
This does not register the device: see Self::register()
.
This associated function is intended to be used when you need to avoid
a memory allocation, e.g. when the Registration
is a member of
a bigger structure inside your crate::Module
instance. If you
are going to pin the registration right away, call
Self::new_pinned()
instead.
sourcepub fn new_pinned(
name: &'static CStr,
minors_start: u16,
this_module: &'static ThisModule
) -> Result<Pin<Box<Self>>>
pub fn new_pinned(
name: &'static CStr,
minors_start: u16,
this_module: &'static ThisModule
) -> Result<Pin<Box<Self>>>
Creates a pinned Registration
object for a character device.
This does not register the device: see Self::register()
.
Trait Implementations
sourceimpl<const N: usize> Drop for Registration<{ N }>
impl<const N: usize> Drop for Registration<{ N }>
sourceimpl<const N: usize> OpenAdapter<()> for Registration<{ N }>
impl<const N: usize> OpenAdapter<()> for Registration<{ N }>
sourceunsafe fn convert(_inode: *mut inode, _file: *mut file) -> *const ()
unsafe fn convert(_inode: *mut inode, _file: *mut file) -> *const ()
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<const N: usize> Sync for Registration<{ N }>
Auto Trait Implementations
impl<const N: usize> RefUnwindSafe for Registration<N>
impl<const N: usize> !Send for Registration<N>
impl<const N: usize> !Unpin for Registration<N>
impl<const N: usize> UnwindSafe for Registration<N>
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