MyWebUniversity.com Home Page
 



OpenSolaris man pages main menu


Kernel Functions for Drivers                       scsiprobe(9F)



NAME
     scsiprobe - utility for probing a scsi device

SYNOPSIS
     #include 



     int scsiprobe(struct scsidevice *devp, int (*waitfunc);


INTERFACE LEVEL
     Solaris DI specific (Solaris DI).

PARAMETERS
     devp         Pointer to a scsidevice(9S) structure


     waitfunc     NULFUNC or SLEPFUNC


DESCRIPTION
     scsiprobe() determines whether a target/lun is present  and
     sets up the scsidevice structure with inquiry data.


     scsiprobe() uses the SCSI Inquiry command to  test  if  the
     device exists. It can retry the Inquiry command as appropri-
     ate. If scsiprobe() is successful, it will  allocate  space
     for the scsiinquiry structure and assign the address to the
     sdinq member of the scsidevice(9S) structure. scsiprobe()
     will then fill in this scsiinquiry(9S) structure and return
     SCSIPROBEXISTS.  If  scsiprobe()  is   unsuccessful,   it
     returns   SCSIPROBENOMEM   in  spite  of  callback  set  to
     SLEPFUNC.


     scsiunprobe(9F) is used to undo the effect of scsiprobe().


     If the target is a non-CS device, SCSIPROBENONCS will  be
     returned.


     waitfunc indicates what the  allocator  routines  should  do
     when resources are not available; the valid values are:

     NULFUNC      Do   not   wait   for    resources.    Return
                    SCSIPROBENOMEM or SCSIPROBEFAILURE






SunOS 5.11          Last change: 26 Feb 2002                    1






Kernel Functions for Drivers                       scsiprobe(9F)



     SLEPFUNC     Wait indefinitely for resources.


RETURN VALUES
     scsiprobe() returns:

     SCSIPROBEBUSY         Device exists but is currently busy.


     SCSIPROBEXISTS       Device exists  and  inquiry  data  is
                            valid.


     SCSIPROBEFAILURE      Polled command failure.


     SCSIPROBENOMEM        No space available for structures.


     SCSIPROBENOMEMCB     No space available for structures but
                            callback request has been queued.


     SCSIPROBENONCS       Device exists but inquiry data is not
                            valid.


     SCSIPROBENORESP       Device  does  not   respond   to   an
                            INQUIRY.


CONTEXT
     scsiprobe() is normally called  from  the  target  driver's
     probe(9E)  or  attach(9E) routine. In any case, this routine
     should not be called from interrupt context, because it  can
     sleep waiting for memory to be allocated.

EXAMPLES
     Example 1  Using scsiprobe()

           switch (scsiprobe(devp, NULFUNC)) {
           default:
           case SCSIPROBENORESP:
           case SCSIPROBENONCS:
           case SCSIPROBENOMEM:
           case SCSIPROBEFAILURE:
           case SCSIPROBEBUSY:
                   break;
           case SCSIPROBEXISTS:
                   switch (devp->sdinq->inqdtype) {
                   case DTYPEDIRECT:
                           rval = DIPROBESUCES;



SunOS 5.11          Last change: 26 Feb 2002                    2






Kernel Functions for Drivers                       scsiprobe(9F)



                           break;
                   case DTYPERODIRECT:
                           rval = DIPROBESUCES;
                           break;
                   case DTYPENOTPRESENT:
                   default:
                           break;
                   }
           }
           scsiunprobe(devp);


SEE ALSO
     attach(9E),  probe(9E),  scsislave(9F),   scsiunprobe(9F),
     scsiunslave(9F), scsidevice(9S), scsiinquiry(9S)


     ANSI Small Computer System Interface-2 (SCSI-2)


     Writing Device Drivers

NOTES
     A waitfunc function other than NULFUNC  or  SLEPFUNC  is
     not supported and may have unexpected results.






























SunOS 5.11          Last change: 26 Feb 2002                    3



OpenSolaris man pages main menu

Contact us      |       About us      |       Term of use      |       Copyright © 2000-2010 MyWebUniversity.com ™