drivers/s390/char/tape.h

Source file repositories/reference/linux-study-clean/drivers/s390/char/tape.h

File Facts

System
Linux kernel
Corpus path
drivers/s390/char/tape.h
Extension
.h
Size
10405 bytes
Lines
380
Domain
Driver Families
Bucket
drivers/s390
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 tape_request {
	struct list_head list;		/* list head for request queueing. */
	struct tape_device *device;	/* tape device of this request */
	struct ccw1 *cpaddr;		/* address of the channel program. */
	void *cpdata;			/* pointer to ccw data. */
	enum tape_request_status status;/* status of this request */
	int options;			/* options for execution. */
	int retries;			/* retry counter for error recovery. */
	int rescnt;			/* residual count from devstat. */
	struct timer_list timer;	/* timer for std_assign_timeout(). */
	struct irb irb;			/* device status */

	/* Callback for delivering final status. */
	void (*callback)(struct tape_request *, void *);
	void *callback_data;

	enum tape_op op;
	int rc;
};

/* Function type for magnetic tape commands */
typedef int (*tape_mtop_fn)(struct tape_device *, int);

/* Size of the array containing the mtops for a discipline */
#define TAPE_NR_MTOPS (MTMKPART+1)

/* Tape Discipline */
struct tape_discipline {
	struct module *owner;
	int  (*setup_device)(struct tape_device *);
	void (*cleanup_device)(struct tape_device *);
	int (*irq)(struct tape_device *, struct tape_request *, struct irb *);
	struct tape_request *(*read_block)(struct tape_device *);
	struct tape_request *(*write_block)(struct tape_device *);
	void (*process_eov)(struct tape_device*);
	/* Array of tape commands with TAPE_NR_MTOPS entries */
	tape_mtop_fn *mtop_array;
};

/*
 * The discipline irq function either returns an error code (<0) which
 * means that the request has failed with an error or one of the following:
 */
#define TAPE_IO_SUCCESS		0	/* request successful */
#define TAPE_IO_PENDING		1	/* request still running */
#define TAPE_IO_RETRY		2	/* retry to current request */
#define TAPE_IO_STOP		3	/* stop the running request */
#define TAPE_IO_LONG_BUSY	4	/* delay the running request */

/* Char Frontend Data */
struct tape_char_data {
	struct idal_buffer **ibs;	/* idal buffer array for user char data */
	int block_size;			/*   of size block_size. */
};

/* Tape Info */
struct tape_device {
	/* entry in tape_device_list */
	struct list_head		node;

	int				cdev_id;
	struct ccw_device *		cdev;
	struct tape_class_device *	nt;
	struct tape_class_device *	rt;

	/* Device mutex to serialize tape commands. */
	struct mutex			mutex;

	/* Device discipline information. */
	struct tape_discipline *	discipline;

	/* Generic status flags */
	long				tape_generic_status;

	/* Device state information. */
	wait_queue_head_t		state_change_wq;
	enum tape_state			tape_state;
	enum tape_medium_state		medium_state;
	unsigned char *			modeset_byte;

	/* Reference count. */
	atomic_t			ref_count;

	/* Request queue. */
	struct list_head		req_queue;

	/* Request wait queue. */
	wait_queue_head_t		wait_queue;

	/* Each tape device has (currently) two minor numbers. */

Annotation

Implementation Notes