1 /*
2 History:
3 Started: Aug 9 by Lawrence Foard (entropy@world.std.com), to allow user
4 process control of SCSI devices.
5 Development Sponsored by Killy Corp. NY NY
6 */
7
8 /*
9 An SG device is accessed by writing "packets" to it, the replies
10 are then read using the read call. The same header is used for
11 reply, just ignore reply_len field.
12 */
13
14 struct sg_header
15 {
16 int pack_len; /* length of incoming packet <4096 (including header) */
17 int reply_len; /* maximum length <4096 of expected reply */
18 int pack_id; /* id number of packet */
19 int result; /* 0==ok, otherwise refer to errno codes */
20 unsigned int twelve_byte:1; /* Force 12 byte command length for group 6 & 7 commands */
21 unsigned int other_flags:31; /* for future use */
22 unsigned char sense_buffer[16]; /* used only by reads */
23 /* command follows then data for command */
24 };
25
26 /* ioctl's */
27 #define SG_SET_TIMEOUT 0x2201 /* set timeout *(int *)arg==timeout */
28 #define SG_GET_TIMEOUT 0x2202 /* get timeout return timeout */
29
30 #define SG_DEFAULT_TIMEOUT (60*HZ) /* 1 minute timeout */
31 #define SG_DEFAULT_RETRIES 1
32
33 #define SG_MAX_QUEUE 4 /* maximum outstanding request, arbitrary, may be
34 changed if sufficient DMA buffer room available */
35
36 #define SG_BIG_BUFF 32768