X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fscsi%2Fst.h;h=50f3deb1f9ed92fcaf06bcc8c62329e966db8750;hb=refs%2Fheads%2Fvserver;hp=56ca7a7850237457d1c8546b4462adf9aa2f0dd4;hpb=9213980e6a70d8473e0ffd4b39ab5b6caaba9ff5;p=linux-2.6.git diff --git a/drivers/scsi/st.h b/drivers/scsi/st.h index 56ca7a785..50f3deb1f 100644 --- a/drivers/scsi/st.h +++ b/drivers/scsi/st.h @@ -2,14 +2,35 @@ #ifndef _ST_H #define _ST_H -#ifndef _SCSI_H -#include "scsi.h" -#endif #include +#include +#include + +/* Descriptor for analyzed sense data */ +struct st_cmdstatus { + int midlevel_result; + struct scsi_sense_hdr sense_hdr; + int have_sense; + u64 uremainder64; + u8 flags; + u8 remainder_valid; + u8 fixed_format; + u8 deferred; +}; + +struct scsi_tape; + +/* scsi tape command */ +struct st_request { + unsigned char cmd[MAX_COMMAND_SIZE]; + unsigned char sense[SCSI_SENSE_BUFFERSIZE]; + int result; + struct scsi_tape *stp; + struct completion *waiting; +}; /* The tape buffer descriptor. */ -typedef struct { - unsigned char in_use; +struct st_buffer { unsigned char dma; /* DMA-able buffer */ unsigned char do_dio; /* direct i/o set up? */ int buffer_size; @@ -17,9 +38,9 @@ typedef struct { int buffer_bytes; int read_pointer; int writing; - int midlevel_result; int syscall_result; - Scsi_Request *last_SRpnt; + struct st_request *last_SRpnt; + struct st_cmdstatus cmdstat; unsigned char *b_data; unsigned short use_sg; /* zero or max number of s/g segments for this adapter */ unsigned short sg_segs; /* number of segments in s/g list */ @@ -28,7 +49,7 @@ typedef struct { unsigned int frp_sg_current; /* driver buffer length currently in s/g list */ struct st_buf_fragment *frp; /* the allocated buffer fragment list */ struct scatterlist sg[1]; /* MUST BE last item */ -} ST_buffer; +}; /* The tape buffer fragment descriptor */ struct st_buf_fragment { @@ -37,7 +58,7 @@ struct st_buf_fragment { }; /* The tape mode definition */ -typedef struct { +struct st_modedef { unsigned char defined; unsigned char sysv; /* SYS V semantics? */ unsigned char do_async_writes; @@ -48,7 +69,7 @@ typedef struct { short default_density; /* Forced density, -1 = no value */ int default_blksize; /* Forced blocksize, -1 = no value */ struct cdev *cdevs[2]; /* Auto-rewind and non-rewind devices */ -} ST_mode; +}; /* Number of modes can be changed by changing ST_NBR_MODE_BITS. The maximum number of modes is 16 (ST_NBR_MODE_BITS 4) */ @@ -61,7 +82,7 @@ typedef struct { #define ST_MAX_TAPE_ENTRIES (ST_MAX_TAPES << (ST_NBR_MODE_BITS + 1)) /* The status related to each partition */ -typedef struct { +struct st_partstat { unsigned char rw; unsigned char eof; unsigned char at_sm; @@ -69,17 +90,17 @@ typedef struct { u32 last_block_visited; int drv_block; /* The block where the drive head is */ int drv_file; -} ST_partstat; +}; #define ST_NBR_PARTITIONS 4 /* The tape drive descriptor */ -typedef struct { +struct scsi_tape { struct scsi_driver *driver; - Scsi_Device *device; + struct scsi_device *device; struct semaphore lock; /* For serialization */ struct completion wait; /* For SCSI commands */ - ST_buffer *buffer; + struct st_buffer *buffer; /* Drive characteristics */ unsigned char omit_blklims; @@ -96,7 +117,8 @@ typedef struct { unsigned char cln_sense_value; unsigned char cln_sense_mask; unsigned char use_pf; /* Set Page Format bit in all mode selects? */ - unsigned char try_dio; /* try direct i/o? */ + unsigned char try_dio; /* try direct i/o in general? */ + unsigned char try_dio_now; /* try direct i/o before next close? */ unsigned char c_algo; /* compression algorithm */ unsigned char pos_unknown; /* after reset position unknown */ int tape_type; @@ -105,14 +127,14 @@ typedef struct { unsigned long max_pfn; /* the maximum page number reachable by the HBA */ /* Mode characteristics */ - ST_mode modes[ST_NBR_MODES]; + struct st_modedef modes[ST_NBR_MODES]; int current_mode; /* Status variables */ int partition; int new_partition; int nbr_partitions; /* zero until partition support enabled */ - ST_partstat ps[ST_NBR_PARTITIONS]; + struct st_partstat ps[ST_NBR_PARTITIONS]; unsigned char dirty; unsigned char ready; unsigned char write_prot; @@ -146,7 +168,8 @@ typedef struct { unsigned char last_sense[16]; #endif struct gendisk *disk; -} Scsi_Tape; + struct kref kref; +}; /* Bit masks for use_pf */ #define USE_PF 1 @@ -194,4 +217,9 @@ typedef struct { #define EXTENDED_SENSE_START 18 +/* Masks for some conditions in the sense data */ +#define SENSE_FMK 0x80 +#define SENSE_EOM 0x40 +#define SENSE_ILI 0x20 + #endif