David E Allen wrote:
> 
> Hi, folks. I am just getting into scsi on linux, feeling like a pioneer.
> I've been writing some routines using the generic driver. Pretty handy.
> Pretty sparse on documentation... All I have is the scsi howto and the
> mfg's (IBM) scsi specs.

I have tried unsuccessfully to have the 4 year old SCSI-PROGRAMMING-HOWTO
replaced. For current sg documentation see:
http://www.torque.net/sg

> In one case, I am attempting to use "write_same" to cover an entire disk with
> zeros (9Gb disk). The command completes after (exactly) 1 min and reports no
> errs. But only a portion of the disk is zero'd. I can try it with several
> starting sectors, and it always stops after 60 sec. Seems like a timeout,
> so I did
>         if (ioctl(dev,SG_GET_TIMEOUT,&i)<0) {perror(argv[1]); exit(errno);}
> 
> Although this is not reporting an error (neither compile nor runtime), it
> is also not changing the value of 'i'. :-( Any ideas, please, on

#define SG_SET_TIMEOUT 0x2201  /* unit: jiffies (10ms on i386) */
#define SG_GET_TIMEOUT 0x2202  /* yield timeout as _return_ value */

Notice that SG_GET_TIMEOUT does not follow normal conventions but
instead returns the timeout value you are interested in. So that
line should read:
       if ((i=ioctl(dev,SG_GET_TIMEOUT,0))<0) {perror(argv[1]); exit(errno);}
 
> 1. is my job ending because of a timeout?
Perhaps since the default timeout is 60 seconds.

> 2. is there a timeout get/set that works (for the generic driver)?
Yes. In the case of SG_SET_TIMEOUT the 3rd argument is a pointer to
the "jiffy" count you want (this time following convention).
 
> PS: my main reason for using the generic driver is my SG_BIG_BUFF is 32k,
> whereas the sd driver seems limited to 4k.

If you are using a recent lk 2.2 you can send one command with 8 MBytes
of data associated with it (although I wouldn't recommend it). The size
that the sd driver sends down depends on lots of factors.


Doug Gilbert

-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [EMAIL PROTECTED]
  • timeout? David E Allen
    • Douglas Gilbert

Reply via email to