pub unsafe trait DriverLayout {
    type DriverType: Default;
    type DriverData;

    const DEVICE_DRIVER_OFFSET: usize;
}
Expand description

Trait describing the layout of a specific device driver.

This trait describes the layout of a specific driver structure, such as struct pci_driver or struct platform_driver.

§Safety

Implementors must guarantee that:

  • DriverType is repr(C),
  • DriverData is the type of the driver’s device private data.
  • DriverType embeds a valid struct device_driver at byte offset DEVICE_DRIVER_OFFSET.

Required Associated Types§

source

type DriverType: Default

The specific driver type embedding a struct device_driver.

source

type DriverData

The type of the driver’s device private data.

Required Associated Constants§

source

const DEVICE_DRIVER_OFFSET: usize

Byte offset of the embedded struct device_driver within DriverType.

This must correspond exactly to the location of the embedded struct device_driver field.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<T: Driver + 'static> DriverLayout for kernel::auxiliary::Adapter<T>

§

type DriverType = auxiliary_driver

§

type DriverData = T

source§

const DEVICE_DRIVER_OFFSET: usize = 48usize

source§

impl<T: Driver + 'static> DriverLayout for kernel::i2c::Adapter<T>

§

type DriverType = i2c_driver

§

type DriverData = T

source§

const DEVICE_DRIVER_OFFSET: usize = 48usize

source§

impl<T: Driver + 'static> DriverLayout for kernel::pci::Adapter<T>

§

type DriverType = pci_driver

§

type DriverData = T

source§

const DEVICE_DRIVER_OFFSET: usize = 104usize

source§

impl<T: Driver + 'static> DriverLayout for kernel::platform::Adapter<T>

§

type DriverType = platform_driver

§

type DriverData = T

source§

const DEVICE_DRIVER_OFFSET: usize = 40usize

source§

impl<T: Driver + 'static> DriverLayout for kernel::usb::Adapter<T>

§

type DriverType = usb_driver

§

type DriverData = T

source§

const DEVICE_DRIVER_OFFSET: usize = 112usize