Specifications
D
evice Driver Programming
13-8
Screen 13-2 shows a sample wrapper for a high level (HDRV) driver.
Screen 13-2. High Level Driver Wrapper Coding Example
Screen 13-3 shows a sample wrapper for a STREAMS module. Notice that the macro def-
inition for this non-driver module does not include the argument for a halt routine. Also,
there is no need for the _load and _unload routines.
Screen 13-3. STREAMS Module Wrapper Coding Example
#include <sys/moddefs.h>
#define DRVNAME “xyz - High-Level Driver”
STATIC int xyz_load(), xyz_unload();
int xyzinit();
void xyzstart();
MOD_HDRV_WRAPPER(xyz, xyz_load, xyz_unload, NULL, DRVNAME);
.
.
.
STATIC int
xyz_load(c)
int c;
{
int status;
.
.
.
if( xyzinit()) {
return( ENODEV );
}
status = mod_drvattach( &xyz_attach_info );
if (status == -1)
return (EBUSY);
xyzstart();
return(0);
}
STATIC int
xyz_unload()
{
mod_drvdetach(&xyz_attach_info);
}
#include <sys/moddefs.h>
MOD_STR_WRAPPER(isoc, NULL, NULL, “isoc - ISC socket emulation”);