STREAMS-UX Programmer's Guide (February 2007)

Modules and Drivers
Data Structures
Chapter 4
64
The following code snippet illustrates the declaration of mandatory structures for a dummy STREAMS driver
named drv:
#include <sys/types.h>
#include <sys/param.h>
#include <sys/stream.h>
#include <sys/strenv.h>
static int drv_open(), drv_close(), drv_put(), drv_srv();
static struct module_info drv_minfo = {
0, "drv", 0, 512, 65535, 8192
};
static struct qinit drv_rinit = {
drv_put, drv_srv, drv_open, drv_close, NULL, &drv_minfo, NULL
};
static struct qinit drv_winit = {
drv_put, drv_srv, NULL, NULL, NULL, &drv_minfo, NULL
};
struct streamtab drvinfo = {
&drv_rinit, &drv_winit, NULL, NULL
};
Installation Structures and Configuration Routines
This section describes statically linked modules. For more information on DLKM, refer to the “DLKM
STREAMS” on page 107 . All the kernel modules and drivers on HP-UX are required to define HP-UX specific
entry points for installing modules and drivers into the kernel. These entry points are called when a module
or driver is installed in the kernel. Entry points register the kernel module
defined in the following
structures:
streams_info_t
drv_info_t
drv_ops_t
These structures can be defined in a .c or .h file.
Module metadata
The module metadata must be defined in a separate file for every STREAMS module and driver. Refer to
the HP-UX Driver Development Guide for details.