Kernel Functions for Drivers ddiremovingpower(9F)
NAME
ddiremovingpower - check whether DISUSPEND might result
in power being removed from a device
SYNOPSIS
#include
#include
int ddiremovingpower(devinfot *dip);
INTERFACE LEVEL
Solaris DI specific (Solaris DI)
DESCRIPTION
The ddiremovingpower() function indicates whether a
currently pending call into a driver's detach(9E) entry
point with a command of DISUSPEND is likely to result in
power being removed from the device.
ddiremovingpower() can return true and power still not be
removed from the device due to a failure to suspend and
power off the system.
PARAMETERS
The ddiremovingpower() function supports the following
parameter:
dip pointer to the device's devinfo structure
RETURN VALUES
The ddiremovingpower() function returns:
1 Power might be removed by the framework as a result of
the pending DISUSPEND call.
0 Power will not be removed by the framework as a result
of the pending DISUSPEND call.
EXAMPLES
Example 1 Protecting a Tape from Abrupt Power Removal
A tape driver that has hardware that would damage the tape
if power is removed might include this code in its
detach(9E) code:
SunOS 5.11 Last change: 14 March 2001 1
Kernel Functions for Drivers ddiremovingpower(9F)
int
xxdetach(devinfot *dip, ddidetachcmdt cmd)
{
...
case DISUSPEND:
/*
* We do not allow DISUSPEND if power will be removed and
* we have a device that damages tape when power is removed
* We do support DISUSPEND for Device Reconfiguration,
* however.
*/
if (ddiremovingpower(dip) && xxdamagestape(dip))
return (DIFAILURE);
...
ATRIBUTES
See attributes(5) for descriptions of the following attri-
butes:
ATRIBUTE TYPE ATRIBUTE VALUE
Interface Stability Committed
SEE ALSO
attributes(5), cpr(7), attach(9E), detach(9E)
Writing Device Drivers
SunOS 5.11 Last change: 14 March 2001 2
|