Writing Device Drivers

User Space Access Functions

The user space access functions are:

ddi_copyin()

Copy data to a driver buffer

ddi_copyout()

Copy data from a driver

uiomove()

Copy kernel data using a uio structure

ureadc()

Add character to a uio structure

uwritec()

Remove a character from a uio structure

getminor()

Get minor device number.

ddi_model_convert_from()

Determine a data model type mismatch

IOC_CONVERT_FROM()

Determine whether there is a need to translate M_IOCTL contents

STRUCT_DECL()

Establish the handle to application data in a possibly differing data model

STRUCT_HANDLE()

Establish the handle to application data in a possibly differing data model

STRUCT_INIT()

Establish the handle to application data in a possibly differing data model

STRUCT_SET_HANDLE()

Establish the handle to application data in a possibly differing data model

SIZEOF_PTR()

Return the size of pointer in specified data model

SIZEOF_STRUCT()

Return the size of a structure in the specified data model

STRUCT_SIZE()

Return the size of a structure in the application data model

STRUCT_BUF()

Return a pointer to the native mode instance of the structure

STRUCT_FADDR()

Return a pointer to the specified field of a structure

STRUCT_FGET()

Return the specified field of a structure in the application data model

STRUCT_FGETP()

Return the specified pointer field of a structure in the application data model

STRUCT_FSET()

Set a specified field of a structure in the application data model

STRUCT_FSETP()

Set a specified pointer field of a structure in the application data model

Table B–6 Deprecated User Space Access Functions

Deprecated Function 

Replacement 

copyin()

ddi_copyin()

copyout()

ddi_copyout()

ddi_getminor()

getminor()