tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: linux_sg.c modification for SCSI Test Unit Ready command



On Sun, Mar 16, 2008 at 11:28:09AM -0500, Tracy Di Marco White wrote:
> 
> In message <16137.1205684629%menelos.com@localhost>, Tracy Di Marco White 
> writes:
> >
> >I've needed to add emulation for the SCSI Test Unit Ready command
> >to my backup server, so I could run Sony's tape diagnostics.
> >It's fairly simple, but is it the correct flag to use for that?
> >The patch below is what I'm using on my 4.0 backup server.
> >
> >-Tracy
> 
> Once more with -u
> 
> Index: linux_sg.c
> ===================================================================
> RCS file: /cvsroot/src/sys/compat/linux/common/linux_sg.c,v
> retrieving revision 1.8
> diff -u -r1.8 linux_sg.c
> --- linux_sg.c        13 Sep 2006 00:51:12 -0000      1.8
> +++ linux_sg.c        16 Mar 2008 16:26:12 -0000
> @@ -107,11 +107,17 @@
>               (void)memset(&req, 0, sizeof(req));
>               switch (lreq.dxfer_direction) {
>               case SG_DXFER_TO_DEV:
> +                     /* e.g. a SCSI WRITE command */
>                       req.flags = SCCMD_WRITE;
>                       break;
>               case SG_DXFER_FROM_DEV:
> +                      /* e.g. a SCSI READ command */
>                       req.flags = SCCMD_READ;
>                       break;
> +             case SG_DXFER_NONE:
> +                     /* e.g. a SCSI Test Unit Ready command */
> +                     req.flags = SCCMD_ESCAPE;

I don't think that's correct. I think you want "0", not SCCMD_ESCAPE. At 
least that's what scsictl tur uses as best I can tell.

I think you are correct, though, to add something for SG_DXFER_NONE. :-)

> +                     break;
>               default:
>                       DPRINTF(("unknown direction %d\n",
>                               lreq.dxfer_direction));

Attachment: pgp2eeSKWf584.pgp
Description: PGP signature



Home | Main Index | Thread Index | Old Index