On Feb 13,  9:40am, Douglas Gilbert wrote:
> 
> Daniel,
> Does that driver take any account of Scsi_Cmnd::sc_data_direction_flag?
> All upper level drivers (including sg) in the lk 2.4 series set
> the corresponding Scsi_Request::sr_data_direction_flag .
> 
> In the case of sg in lk 2.4, it supports 2 interfaces:
>  - In the newer one (not yet used by cdrecord) the data 
>    direction flag is given explicitly. [There could be 
>    PCI bus problems if the app gets the direction wrong]. 
>  - In the older interface the internal data direction flag 
>    is deduced from the sizes of the data buffers given. 
>    There is a slight ambiguity when the write (to device)
>    buffer and the read (from device) buffer are both
>    given; a read from device data direction flag is assumed.
>    [BTW The SCSI_IOCTL_SEND_COMMAND ioctl() makes a similar
>     deduction.]
> 
> If cdrecord is sending a vendor specific command that
> writes data to the device, but sets the read buffer
> up as well and thus tricks the above logic, then we get 
> cdrecord changed. Cdrecord has a library called libscg
> that interfaces to many OSes and the generic structures
> within libscg have a data direction flag.
> 
> > The other drivers in question may or may not be able
> > to recover from the missing item in their tables, but the fact that
> > these tables are in the drivers at all implies that they work best if
> > the tables are correct.
> 
> Data direction tables shouldn't be needed in lk 2.4 .
>  
> Doug Gilbert

I was reading Documentation/scsi-generic.txt in 2.4.1.  I didn't see
anything about direction in the "new sg_header".  Is there something
newer?

| The new sg_header offered in this driver is:
| #define SG_MAX_SENSE 16
| struct sg_header
| {
|     int pack_len;    /* [o] reply_len (ie useless) ignored as input */
|     int reply_len;   /* [i] max length of expected reply (inc. sg_header) */
|     int pack_id;     /* [io] id number of packet (use ints >= 0) */
|     int result;      /* [o] 0==ok, else (+ve) Unix errno (best ignored) */
|     unsigned int twelve_byte:1;
|         /* [i] Force 12 byte command length for group 6 & 7 commands  */
|     unsigned int target_status:5;   /* [o] scsi status from target */
|     unsigned int host_status:8;     /* [o] host status (see "DID" codes) */
|     unsigned int driver_status:8;   /* [o] driver status+suggestion */               
|   
|     unsigned int other_flags:10;    /* unused */
|     unsigned char sense_buffer[SG_MAX_SENSE]; /* [o] Output in 3 cases:
|            when target_status is CHECK_CONDITION or
|            when target_status is COMMAND_TERMINATED or
|            when (driver_status & DRIVER_SENSE) is true. */
| };      /* This structure is 36 bytes long on i386 */

thanks

jeremy
-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [EMAIL PROTECTED]

Reply via email to