macro_rules! module_misc_device {
    (type: $type:ty, $($f:tt)*) => { ... };
}
Expand description

Declares a kernel module that exposes a single misc device.

The type argument should be a type which implements the FileOpener trait. Also accepts various forms of kernel metadata.

C header: include/linux/moduleparam.h

Examples

use kernel::prelude::*;

module_misc_device! {
    type: MyFile,
    name: b"my_miscdev_kernel_module",
    author: b"Rust for Linux Contributors",
    description: b"My very own misc device kernel module!",
    license: b"GPL",
}

#[derive(Default)]
struct MyFile;

#[vtable]
impl kernel::file::Operations for MyFile {}
This documentation is an old archive. Please see https://rust.docs.kernel.org instead.