DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

sdi_xname(D3sdi)


sdi_xname -- get name of addressed SDI controller

Synopsis

   #include <sys/types.h>
   #include <sys/sdi.h>
   #include <sys/ddi.h>
   

void sdi_xname(int hbaflag, struct scsi_ad *addr, char *name);

Description

sdi_xname( ) decodes a device number into a character string so that the device number can be displayed with the cmn_err(D3) function.

Arguments


hbaflag
Initialize to HBA_EXT_ADDRESS for drivers that understand extended SCSI addressing, or to 0 for drivers that only understand conventional SCSI addressing.

addr
Pointer to the scsi_ad(D4sdi) device address structure.

name
String that contains the device name.

Return values

None.

Usage

sdi_xname( ) calls the HBA's getinfo(D2sdi) routine to get the controller name, which is copied into the name parameter. The returned string should be SDI_NAMELEN in length. Access to the controller name can only be used for display; the driver should not attempt to decode the string for other uses.

The string returned is HA # TC #, with the controller number of the host adapter card and the target controller ID filled in.

Context and synchronization

Non-blockable context.

Hardware applicability

All

Version applicability

sdi: 4

Differences between versions

SDI versions prior to SDI version 4 use the sdi_name( ) function, which cannot be used with extended SCSI addresses, rather than sdi_xname( ). The syntax is:
   void sdi_name(struct scsi_ad *addr, char *name);

References

scsi_ad(D4sdi)

``Extended SCSI addressing scheme'' in HDK Technical Reference

Examples

This example is a sample print( ) routine in a disk target driver. The arguments to the cmn_err(D3) function are the device number and a string to display (on the system console). This example uses the sdi_xname( ) function, but similar coding is used for the sdi_name( ) function.
   diskprint(dev, str)
   dev_t dev;
   char *str;
   {
      char name[SDI_NAMELEN]; /* Character array for device name */
      struct scsi_ad addr;    /* SCSI address structure          */
   

/* Fill in SCSI device address based on device number */ addr.sa_major = emajor(dev); addr.sa_minor = eminor(dev); addr.sa_lun = LUN(eminor(dev));

/* Call sdi_name with the address of the SCSI address * structure and a pointer to the character array. */ sdi_name(&addr, name);

/* Print the error message */ cmn_err(CE_WARN, "%s, Unit %d, Partition %d: %s", name, addr.sa_lun, eminor(dev) & V_NUMPAR, str); }


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