[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference turris::digital_unix

Title:DIGITAL UNIX(FORMERLY KNOWN AS DEC OSF/1)
Notice:Welcome to the Digital UNIX Conference
Moderator:SMURF::DENHAM
Created:Thu Mar 16 1995
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:10068
Total number of notes:35879

8541.0. "SCSI programming questions" by IB004::ILOPEZ () Wed Jan 22 1997 10:07

T.RTitleUserPersonal
Name
DateLines
8541.1SMURF::KNIGHTFred KnightMon Feb 10 1997 11:2925
> This programm used to work as we expected with disks inside a BA350 
> enclosure:

As it should.  If the disk isn't there, we can't talk to it.

> When the disk RZ28 or RZ29 is inside a SW300-AA with an HSZ40-CF controller, 
> if you pull out the disk , the iotcl completes OK and our programm doesn't 
> detect the disk's pull-out.

That is correct.  Remember, the HSZ40 is BETWEEN the host system and the disk.
We NEVER talk to the disk directly (we can't).  ALL communication in this
situation is done with the HSZ40.  And as you said, the HSZ40 is still there.
It's just a back end device that is missing.  So, you ask for the inquiry data
and the HSZ40 returns it.  Remember, the inquiry data is coming from the HSZ40
and NOT from the backend device (afterall, it might be a raid set of several
different types of devices).

The GET_PDRV_PTR(dev) macro is for kernel code.  For user code, the DEVIOCGET
ioctl will return the DEV_OFFLINE flag if the device isn't there.  The
DEVGETINFO ioctl returns the same flag.  You may need FNDELAY or FNONBLOCK
on the open.

Sorry, I only write low level scsi protocol code, so I don't have any examples.

	Fred
8541.2One more question ...NETRIX::"[email protected]"[email protected]Tue Feb 11 1997 12:5459
Thanks you Fred by your response.

Well trying to find documentation on how to use the DEVIOCGET ioctl, 
I found the structure defining the status:

/* Structure for DEVIOCGET ioctl - device get status command */
struct  devget  {
        short   category;               /* Category                     */
        short   bus;                    /* Bus                          */
        char    interface[DEV_SIZE];    /* Interface (string)           */
        char    device[DEV_SIZE];       /* Device (string)              */
        short   adpt_num;               /* Adapter number               */
        short   nexus_num;              /* Nexus or node on adapter no. */
        short   bus_num;                /* Bus number                   */
        short   ctlr_num;               /* Controller number            */
        short   rctlr_num;              /* Remote controller number     */
        short   slave_num;              /* Plug or line number          */
        char    dev_name[DEV_SIZE];     /* Ultrix device pneumonic      */
        short   unit_num;               /* Ultrix device unit number    */
        unsigned soft_count;            /* Driver soft error count      */
        unsigned hard_count;            /* Driver hard error count      */
        long    stat;                   /* Generic status mask          */
        long    category_stat;          /* Category specific mask       */
};


where 'stat' holds the value and looking for (DEV_OFFLINE):

/* Definitions for stat longword (stat) */
#define DEV_BOM         0x01            /* Beginning-of-medium (BOM)    */
#define DEV_EOM         0x02            /* End-of-medium (EOM)          */
#define DEV_OFFLINE     0x04            /* Offline                      */
#define DEV_WRTLCK      0x08            /* Write locked                 */
#define DEV_BLANK       0x10            /* Blank media                  */
#define DEV_WRITTEN     0x20            /* Write on last operation      */
#define DEV_CSE         0x40            /* Cleared serious exception    */
#define DEV_SOFTERR     0x80            /* Device soft error            */
#define DEV_HARDERR     0x100           /* Device hard error            */
#define DEV_DONE        0x200           /* Operation complete           */
#define DEV_RETRY       0x400           /* Retry                        */
#define DEV_ERASED      0x800           /* Erased                       */
#define DEV_RDONLY      0x1000          /* Read-only device             */

My question now where can I find the format for the DEVIOCGET ioctl, that is
the call will be:

rnt=ioctl(fd, DEVIOCGET, devget_structure)

what should be 'fd' ? /dev/rrznc ? or /dev/cam ?
what should be 'devget_structure' ? 

Thanks by your help,


Jose Ignacio L�pez
NSIS Barcelona


[Posted by WWW Notes gateway]
8541.3NABETH::alanDr. File System's Home for Wayward Inodes.Tue Feb 11 1997 13:1613
	The file descriptor needs to be one for the device on which
	you want the status.  The structure is the address of a
	devget structure.

		struct devget data ;

		if((fd = open("/dev/rmt0h", O_RDONLY)) == -1 )
			/* error handling */

		if( ioctl(fd, DEVIOCGET, &data) == -1 )
			/* more error handling */

	Adjust flags and device names as appropriate.
8541.4Thanks. It worked !NETRIX::"[email protected]"[email protected]Wed Feb 12 1997 06:1810
Hi Fred,

I've used the DEVIOCGET and I get the flag I was looking for.
I need now to test in a real HSZ40.

Thank you by your help,

Jose Ignacio
NSIS Barcelona, SPAIN
[Posted by WWW Notes gateway]