DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
SVR5

devinfo(D2)


devinfo -- obtain information about a device

Synopsis

   #include <sys/types.h>
   #include <sys/buf.h>
   #include <sys/conf.h>
   #include <sys/errno.h>
   #include <sys/ddi.h>
   

int prefixdevinfo(void *idata, channel_t channel, di_parm_t parm, void *valp);

Description

The driver's devinfo( ) entry point routine is called to obtain information about the device controlled by the driver.

The type of information that can be returned includes media type of the device (for example: disk, tape, cdrom); device size, and breakup control information (see the bcb(D4) structure).

Arguments


idata
For hardware drivers, pointer to the device-specific instance as returned by the CFG_ADD subfunction of the config(D2) entry point routine. For software-only drivers, idata is undefined and should not be referenced. See ``Device instance'' in HDK Technical Reference.

channel
Channel number used to select subcomponents and/or operating modes of this device instance. See ``Channel number'' in HDK Technical Reference.

parm, *valp
Type of information required from the driver. *valp is defined for each parameter. Valid values are:

DI_MEDIA (*valp is char *)
Return the media type information for the device. *valp is a pointer to a string that indicates the type of media.

DI_SIZE (*valp is devsize_t)
Return the device size. devsize_t is:
   struct {
   	daddr_t blkno;
   	ushort_t blkoff;
   };
Returns EOPNOTSUPP if the device size is unknown; otherwise, sets *valp to the device size and returns 0. If the size is effectively unlimited (such as a tape), set the size to zero.

DI_RBCBP (*valp is bcb_t *)
Return the bcb(D4) for B_READ I/O operations. Required for non-STREAMS drivers; not used for STREAMS drivers.

DI_WBCBP (*valp is bcb_t *)
Return the bcb(D4) for B_WRITE I/O operations. Required for non-STREAMS drivers; not used for STREAMS drivers.

DI_PHYS_HINT (*valp is physreq_t *)
Return physical requirements in a physreq(D4) structure. The operating system may choose to use this physreq structure to allocate STREAMS messages for the STREAM attached to this driver as if by the allocb_physreq(D3str) function, potentially saving a copy once the message reaches the driver and it calls msgphysreq(D3str). This parameter is optional for STREAMS drivers and not used in STREAMS modules or non-STREAMS drivers.

Return values

The devinfo( ) routine should return 0 for success or the appropriate error number from errnos(D5). EOPNOTSUPP should be returned if a particular parameter is not supported by the driver.

Usage

This entry point is required for all drivers that use a DDI 8 style open(D2) entry point routine. It will only be called while the device instance is open.

Context and synchronization

Blockable context. The driver can block but cannot do operations such as copyout(D3) that require access to the requesting process's address space.

Examples

See ``DDI: 8 sample driver'' in HDK code samples

Hardware applicability

All

Version applicability

ddi: 5, 5mp, 6, 6mp, 7, 7mp, 7.1, 7.1mp, 8, 8mp

Differences between versions

In DDI versions prior to version 8 is: devinfo( ) has the following syntax:
   int prefixdevinfo(dev_t dev, di_parm_t parm, void **valp);
dev is the device number.

In DDI versions prior to version 8, the supported parameters are DI_BCBP and DI_MEDIA. The DI_BCBP parameter is the same as DI_RBCBP, except that it applies to B_WRITE operations as well. The size(D2) entry point routine in earlier versions corresponds to the DI_SIZE parameter. All other parameters represent new functionality and have no equivalents in earlier DDI versions.

In DDI versions prior to version 8, devinfo( ) is a named entry point and must be defined as a global symbol.

External dependencies

For DDI 8 and later versions, drivers must declare this entry point routine in the d_devinfo member of their drvops(D4) structure.

Named entry point routines must be declared in the driver's Master(DSP/4dsp) file. The declaration for this entry point is $entry devinfo. This applies only to non-STREAMS drivers that use DDI versions prior to version 8.

References

bcb(D4), biostart(D2), do_devinfo(D3), errnos(D5)

devinfo(D2mdi), devinfo(D2sdi), devinfo(D2str)


19 June 2005
© 2005 The SCO Group, Inc. All rights reserved.
OpenServer 6 and UnixWare (SVR5) HDK - June 2005