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 writting "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 int flags; /* for future use */ 21 unsigned char sense_buffer[16]; /* used only by reads */ 22 /* command follows then data for command */ 23 }; 24 25 /* ioctl's */ 26 #define SG_SET_TIMEOUT 0x2201 /* set timeout *(int *)arg==timeout */ 27 #define SG_GET_TIMEOUT 0x2202 /* get timeout return timeout */ 28 29 #define SG_DEFAULT_TIMEOUT 6000 /* 1 minute timeout */ 30 #define SG_DEFAULT_RETRIES 1 31 32 #define SG_MAX_QUEUE 4 /* maximum outstanding request, arbitrary, may be 33 changed if sufficient DMA buffer room available */ 34 35 #define SG_BIG_BUFF 32768