Trait linux_io::fd::ioctl::IoctlReq

source ·
pub unsafe trait IoctlReq<'a, Device: IoDevice> {
    type ExtArg
       where Self: 'a;
    type TempMem;
    type RawArg: AsRawV;
    type Result
       where Self: 'a;

    // Required methods
    fn prepare_ioctl_args(
        &self,
        arg: &Self::ExtArg,
        temp_mem: &mut MaybeUninit<Self::TempMem>,
    ) -> (ulong, Self::RawArg);
    fn prepare_ioctl_result(
        &self,
        raw: int,
        arg: &Self::ExtArg,
        temp_mem: &MaybeUninit<Self::TempMem>,
    ) -> Self::Result;
}
Expand description

Represents a particular request that can be issue with the ioctl system call.

Safety: Implementers must ensure that they only generate valid combinations of ioctl request and raw argument.

Required Associated Types§

source

type ExtArg where Self: 'a

The type that the caller will provide when using this ioctl command.

Use () for requests that don’t need a caller-provided argument, such as those which only return some data.

source

type TempMem

The type of some temporary memory that the request needs to do its work.

For a request that only returns data, this will typically describe the layout of the returned data, which the kernel will then populate. For requests that don’t need this, use ().

source

type RawArg: AsRawV

The type of argument that will be passed to the raw system call.

source

type Result where Self: 'a

The type of the result of the fcntl call.

Required Methods§

source

fn prepare_ioctl_args( &self, arg: &Self::ExtArg, temp_mem: &mut MaybeUninit<Self::TempMem>, ) -> (ulong, Self::RawArg)

Prepare the cmd and arg values for a ioctl system call.

The arg parameter is the argument provided by the caller of the super::File::ioctl function. temp_mem is a reference to uninitialized memory of appropriate size and alignment for Self::TempMem, which the implementer can either leave uninitialized for the kernel to populate or pre-initialize with data the kernel will expect to find there.

source

fn prepare_ioctl_result( &self, raw: int, arg: &Self::ExtArg, temp_mem: &MaybeUninit<Self::TempMem>, ) -> Self::Result

Prepare a raw successful result from a ioctl call to be returned.

Implementors§

source§

impl<'a, Device, Arg, Result> IoctlReq<'a, Device> for IoctlReqWrite<Device, Arg, Result>
where *const Arg: AsRawV, Arg: 'a, Result: 'a + FromIoctlResult<int>, Device: 'a + IoDevice,

§

type ExtArg = &'a Arg

§

type TempMem = ()

§

type RawArg = *const Arg

§

type Result = Result

source§

impl<'a, Device, Arg, Result> IoctlReq<'a, Device> for IoctlReqWriteVal<Device, Arg, Result>
where Arg: 'a + AsRawV, Result: 'a + FromIoctlResult<int>, Device: 'a + IoDevice,

§

type ExtArg = Arg

§

type TempMem = ()

§

type RawArg = Arg

§

type Result = Result

source§

impl<'a, Device, Result> IoctlReq<'a, Device> for IoctlReqNoArgs<Device, Result>
where Result: 'a + FromIoctlResult<int>, Device: 'a + IoDevice,

§

type ExtArg = ()

§

type TempMem = ()

§

type RawArg = ()

§

type Result = Result

source§

impl<'a, Device, Result> IoctlReq<'a, Device> for IoctlReqRead<Device, Result>
where *mut Result: AsRawV, Result: 'a + Copy, Device: 'a + IoDevice,

§

type ExtArg = ()

§

type TempMem = Result

§

type RawArg = *mut Result

§

type Result = Result