drivers/scsi/st.h

Source file repositories/reference/linux-study-clean/drivers/scsi/st.h

File Facts

System
Linux kernel
Corpus path
drivers/scsi/st.h
Extension
.h
Size
7555 bytes
Lines
253
Domain
Driver Families
Bucket
drivers/scsi
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

struct st_cmdstatus {
	int midlevel_result;
	struct scsi_sense_hdr sense_hdr;
	int have_sense;
	int residual;
	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;
	struct bio *bio;
};

/* The tape buffer descriptor. */
struct st_buffer {
	unsigned char cleared;  /* internal buffer cleared after open? */
	unsigned short do_dio;  /* direct i/o set up? */
	int buffer_size;
	int buffer_blocks;
	int buffer_bytes;
	int read_pointer;
	int writing;
	int syscall_result;
	struct st_request *last_SRpnt;
	struct st_cmdstatus cmdstat;
	struct page **reserved_pages;
	int reserved_page_order;
	struct page **mapped_pages;
	struct rq_map_data map_data;
	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 */
	unsigned short frp_segs;	/* number of buffer segments */
};

/* The tape mode definition */
struct st_modedef {
	unsigned char defined;
	unsigned char sysv;	/* SYS V semantics? */
	unsigned char do_async_writes;
	unsigned char do_buffer_writes;
	unsigned char do_read_ahead;
	unsigned char defaults_for_writes;
	unsigned char default_compression;	/* 0 = don't touch, etc */
	short default_density;	/* Forced density, -1 = no value */
	int default_blksize;	/* Forced blocksize, -1 = no value */
	struct scsi_tape *tape;
	struct device *devs[2];  /* Auto-rewind and non-rewind devices */
	struct cdev *cdevs[2];  /* Auto-rewind and non-rewind devices */
};

/* Number of modes can be changed by changing ST_NBR_MODE_BITS. The maximum
   number of modes is 16 (ST_NBR_MODE_BITS 4) */
#define ST_NBR_MODE_BITS 2
#define ST_NBR_MODES (1 << ST_NBR_MODE_BITS)
#define ST_MODE_SHIFT (7 - ST_NBR_MODE_BITS)
#define ST_MODE_MASK ((ST_NBR_MODES - 1) << ST_MODE_SHIFT)

#define ST_MAX_TAPES (1 << (20 - (ST_NBR_MODE_BITS + 1)))
#define ST_MAX_TAPE_ENTRIES  (ST_MAX_TAPES << (ST_NBR_MODE_BITS + 1))

/* The status related to each partition */
struct st_partstat {
	unsigned char rw;
	unsigned char eof;
	unsigned char at_sm;
	unsigned char last_block_valid;
	u32 last_block_visited;
	int drv_block;		/* The block where the drive head is */
	int drv_file;
};

/* Tape statistics */
struct scsi_tape_stats {
	atomic64_t read_byte_cnt;  /* bytes read */
	atomic64_t write_byte_cnt; /* bytes written */
	atomic64_t in_flight;      /* Number of I/Os in flight */
	atomic64_t read_cnt;       /* Count of read requests */
	atomic64_t write_cnt;      /* Count of write requests */

Annotation

Implementation Notes