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