Imported Upstream version 3.1.0
[debian/amanda] / changer-src / scsi-defs.h
1
2 /*
3  * Copyright (c) 1998 T.Hepper
4  */
5 #ifndef SCSIDEFS_H
6 #define SCSIDEFS_H
7
8 #ifndef WORDS_BIGENDIAN
9 #define LITTLE_ENDIAN_BITFIELDS
10 #endif
11
12 typedef enum { Input, Output } Direction_T; 
13 typedef unsigned char CDB_T[12];
14
15 #ifdef _AIX
16 typedef unsigned int PackedBit;
17 #define AIX_USE_GSC 1
18 #else
19 typedef unsigned char PackedBit;
20 #endif
21
22 #define INDEX_CHANGER 0
23 #define INDEX_TAPE 1
24 #define INDEX_TAPECTL 2
25
26 #define CHG_MAXDEV 32           /* Maximum number of devices handled by pDev */
27                                 /* Must be large to hold the result of ScanBus */
28
29 #define TAPETYPE 4
30 #define IMPORT 3
31 #define STORAGE 2
32 #define CHANGER 1
33
34 #define TAG_SIZE 36
35 #define MAXTRIES 100  /* How many tries until SCSI_TestUnitReady should return an ok */
36 /*
37  * Sense Key definitions
38 */
39 #define SENSE_NULL 0
40 #define SENSE_RECOVERED_ERROR 1
41 #define NOT_READY 2
42 #define SENSE_NOT_READY 2
43 #define SENSE_MEDIUM_ERROR 3
44 #define SENSE_HARDWARE_ERROR 4
45 #define HARDWARE_ERROR 4
46 #define ILLEGAL_REQUEST 5
47 #define SENSE_ILLEGAL_REQUEST 5
48 #define UNIT_ATTENTION 6
49 #define SENSE_UNIT_ATTENTION 6
50 #define SENSE_DATA_PROTECT 7
51 #define SENSE_BLANK_CHECK 8
52 #define SENSE_VENDOR_SPECIFIC 0x9
53 #define SENSE_ABORTED_COMMAND 0xb
54 #define SENSE_VOLUME_OVERFLOW 0xd
55 #define SENSE_CHG_ELEMENT_STATUS 0xe
56
57 #define MAX_RETRIES 100
58
59 #define INQUIRY_SIZE SIZEOF(SCSIInquiry_T)
60
61 /*
62  * Return values from the OS dependent part
63  * of the SCSI interface
64  *
65  * The underlaying functions must decide what to do
66  */
67 #define SCSI_ERROR -1
68 #define SCSI_OK 0
69 #define SCSI_SENSE 1
70 #define SCSI_BUSY 2
71 #define SCSI_CHECK 3
72
73
74 /*
75  *  SCSI Commands
76 */
77 #define SC_COM_TEST_UNIT_READY 0
78 #define SC_COM_REWIND 0x1
79 #define SC_COM_REQUEST_SENSE 0x3
80 #define SC_COM_IES 0x7
81 #define SC_COM_INQUIRY 0x12
82 #define SC_COM_MODE_SELECT 0x15
83 #define SC_COM_ERASE 0x19
84 #define SC_COM_MODE_SENSE 0x1A
85 #define SC_COM_UNLOAD 0x1B
86 #define SC_COM_LOCATE 0x2B
87 #define SC_COM_LOG_SELECT 0x4C
88 #define SC_COM_LOG_SENSE 0x4d
89 #define SC_MOVE_MEDIUM 0xa5
90 #define SC_COM_RES 0xb8
91 /*
92  * Define for LookupDevice
93  */
94 #define LOOKUP_NAME 1
95 #define LOOKUP_FD 2
96 #define LOOKUP_TYPE 3
97 #define LOOKUP_CONFIG 4
98 /* 
99  * Define for the return codes from SenseHandler
100  */
101 #define SENSE_ABORT -1
102 #define SENSE_IGNORE 0
103 #define SENSE_RETRY 2
104 #define SENSE_IES 3
105 #define SENSE_TAPE_NOT_ONLINE 4
106 #define SENSE_TAPE_NOT_LOADED 5
107 #define SENSE_NO 6
108 #define SENSE_TAPE_NOT_UNLOADED 7
109 #define SENSE_CHM_FULL 8
110 /*
111  * Defines for the type field in the inquiry command
112  */
113 #define TYPE_DISK 0
114 #define TYPE_TAPE 1
115 #define TYPE_PRINTER 2
116 #define TYPE_PROCESSOR 3
117 #define TYPE_WORM 4
118 #define TYPE_CDROM 5
119 #define TYPE_SCANNER 6
120 #define TYPE_OPTICAL 7
121 #define TYPE_CHANGER 8
122 #define TYPE_COMM 9
123
124 /* Defines for Tape_Status */
125 #define TAPE_ONLINE 1        /* Tape is loaded */
126 #define TAPE_BOT 2           /* Tape is at begin of tape */
127 #define TAPE_EOT 4           /* Tape is at end of tape */
128 #define TAPE_WR_PROT 8       /* Tape is write protected */
129 #define TAPE_NOT_LOADED 16   /* Tape is not loaded */
130
131 /* Defines for the function Tape_Ioctl */
132 #define IOCTL_EJECT 0
133
134 /* Defines for exit status */
135 #define WARNING 1
136 #define FATAL   2
137
138 /* macros for building scsi msb array parameter lists */
139 #ifndef B
140 #define B(s,i) ((unsigned char)(((s) >> (i)) & 0xff))
141 #endif
142 #ifndef B1
143 #define B1(s)  ((unsigned char)((s) & 0xff))
144 #endif
145 #define B2(s)                       B((s),8),   B1(s)
146 #define B3(s)            B((s),16), B((s),8),   B1(s)
147 #define B4(s) B((s),24), B((s),16), B((s),8),   B1(s)
148
149 /* macros for converting scsi msb array to binary */
150 #define V1(s)           (s)[0]
151 #define V2(s)         (((s)[0] << 8) | (s)[1])
152 #define V3(s)       (((((s)[0] << 8) | (s)[1]) << 8) | (s)[2])
153 #define V4(s)     (((((((s)[0] << 8) | (s)[1]) << 8) | (s)[2]) << 8) | (s)[3])
154 #define V5(s)   (((((((((s)[0] << 8) | (s)[1]) << 8) | (s)[2]) << 8) | (s)[3]) << 8) | (s)[4])
155 #define V6(s) (((((((((((s)[0] << 8) | (s)[1]) << 8) | (s)[2]) << 8) | (s)[3]) << 8) | (s)[4]) << 8) | (s)[5])
156
157 /* macros for converting binary into scsi msb array */
158 #define MSB1(s,v)                                                (s)[0]=B1(v)
159 #define MSB2(s,v)                                 (s)[0]=B(v,8), (s)[1]=B1(v)
160 #define MSB3(s,v)                 (s)[0]=B(v,16), (s)[1]=B(v,8), (s)[2]=B1(v)
161 #define MSB4(s,v) (s)[0]=B(v,24), (s)[1]=B(v,16), (s)[2]=B(v,8), (s)[3]=B1(v)
162
163 #define LABEL_DB_VERSION 2
164
165 #define DEBUG_INFO 9
166 #define DEBUG_ERROR 1
167 #define DEBUG_ALL 0
168
169 #define SECTION_ALL 0
170 #define SECTION_INFO 1
171 #define SECTION_SCSI 2
172 #define SECTION_MAP_BARCODE 3
173 #define SECTION_ELEMENT 4
174 #define SECTION_BARCODE 5
175 #define SECTION_TAPE 6
176 #define SECTION_MOVE 7
177 /*----------------------------------------------------------------------------*/
178 /* Some stuff for our own configurationfile */
179 typedef struct {  /* The information we can get for any drive (configuration) */
180   int   drivenum;    /* Which drive to use in the library */
181   int   start;       /* Which is the first slot we may use */
182   int   end;         /* The last slot we are allowed to use */
183   int   cleanslot;   /* Where the cleaningcartridge stays */
184   char *scsitapedev; /* Where can we send raw SCSI commands to the tape */
185   char *device;      /* Which device is associated to the drivenum */
186   char *slotfile;    /* Where we should have our memory */   
187   char *cleanfile;   /* Where we count how many cleanings we did */
188   char *timefile;    /* Where we count the time the tape was used*/
189   char *tapestatfile;/* Where can we place some drive stats */
190   char *changerident;/* Config to use for changer control, ovverride result from inquiry */
191   char *tapeident;   /* Same as above for the tape device */
192 }config_t; 
193
194 typedef struct {
195   int number_of_configs; /* How many different configurations are used */
196   int eject;             /* Do the drives need an eject-command */
197   int autoinv;           /* Do automaticly an inventory if an tape is not in the db or not active in the db */
198   int havebarcode;       /* Do we have an barcode reader installed */
199   char *debuglevel;      /* How many debug info to print */
200   unsigned char emubarcode;     /* Emulate the barcode feature,  used for keeping an inventory of the lib */
201   time_t sleep;          /* How many seconds to wait for the drive to get ready */
202   int cleanmax;          /* How many runs could be done with one cleaning tape */
203   char *device;          /* Which device is our changer */
204   char *labelfile;       /* Mapping from Barcode labels to volume labels */
205   config_t *conf;
206 }changer_t;
207
208 typedef struct {
209   char voltag[128];
210   char barcode[TAG_SIZE];
211   unsigned char valid;
212 } LabelV1_T;
213
214 typedef struct {
215   char voltag[128];              /* Tape volume label */
216   char barcode[TAG_SIZE];        /* Barcode of the tape */
217   int slot;                      /* in which slot is the tape */
218   int from;                      /* from where it comes, needed to move a tape
219                                   * back to the right slot from the drive
220                                   */
221
222   unsigned int LoadCount;       /* How many times has the tape been loaded */
223   unsigned int RecovError;      /* How many recovered errors */
224   unsigned int UnrecovError;    /* How man unrecoverd errors */
225   unsigned char valid;          /* Is this tape in the current magazin */
226 } LabelV2_T;
227
228 typedef enum {BARCODE_PUT, BARCODE_VOL, BARCODE_BARCODE, BARCODE_DUMP, RESET_VALID, FIND_SLOT, UPDATE_SLOT } MBCAction_T;
229 typedef struct {
230   LabelV2_T data;
231   MBCAction_T action;
232 } MBC_T;
233
234
235 /* ======================================================= */
236 /* RequestSense_T */
237 /* ======================================================= */
238 typedef struct  
239 {
240 #ifdef LITTLE_ENDIAN_BITFIELDS 
241     PackedBit     ErrorCode:7;                    /* Byte 0 Bits 0-6 */
242     PackedBit     Valid:1;                              /* Byte 0 Bit 7    */
243 #else 
244     PackedBit     Valid:1;                              /* Byte 0 Bit 7    */
245     PackedBit     ErrorCode:7;                    /* Byte 0 Bits 0-6 */
246 #endif
247     unsigned char SegmentNumber;                  /* Byte 1 */ 
248 #ifdef LITTLE_ENDIAN_BITFIELDS        
249     PackedBit     SenseKey:4;                     /* Byte 2 Bits 0-3 */
250     PackedBit     :1;                             /* Byte 2 Bit 4    */
251     PackedBit     RILI:1;                                /* Byte 2 Bit 5    */
252     PackedBit     REOM:1;                                /* Byte 2 Bit 6    */
253     PackedBit     Filemark:1;                           /* Byte 2 Bit 7    */
254 #else 
255     PackedBit     Filemark:1;                           /* Byte 2 Bit 7    */
256     PackedBit     REOM:1;                                /* Byte 2 Bit 6    */
257     PackedBit     RILI:1;                                /* Byte 2 Bit 5    */
258     PackedBit     :1;                             /* Byte 2 Bit 4    */ 
259     PackedBit     SenseKey:4;                     /* Byte 2 Bits 0-3 */
260 #endif
261     unsigned char Information[4];                 /* Bytes 3-6       */ 
262     unsigned char AdditionalSenseLength;          /* Byte 7          */   
263     unsigned char CommandSpecificInformation[4];  /* Bytes 8-11      */ 
264     unsigned char AdditionalSenseCode;            /* Byte 12         */
265     unsigned char AdditionalSenseCodeQualifier;   /* Byte 13         */ 
266     unsigned char Byte14;                          /* Byte 14         */ 
267     unsigned char Byte15;                           /* Byte 15         */ 
268     
269 } RequestSense_T;     
270
271 /* ======================================================= */
272 /* ExtendedRequestSense_T */
273 /* ======================================================= */
274 typedef struct  
275 {
276 #ifdef LITTLE_ENDIAN_BITFIELDS 
277     PackedBit     ErrorCode:7;                    /* Byte 0 Bits 0-6 */
278     PackedBit     Valid:1;                        /* Byte 0 Bit 7    */
279 #else 
280     PackedBit     Valid:1;                        /* Byte 0 Bit 7    */
281     PackedBit     ErrorCode:7;                    /* Byte 0 Bits 0-6 */
282 #endif
283     unsigned char SegmentNumber;                  /* Byte 1 */ 
284 #ifdef LITTLE_ENDIAN_BITFIELDS        
285     PackedBit     SenseKey:4;                     /* Byte 2 Bits 0-3 */
286     PackedBit     :1;                             /* Byte 2 Bit 4    */
287     PackedBit     RILI:1;                         /* Byte 2 Bit 5    */
288     PackedBit     REOM:1;                         /* Byte 2 Bit 6    */
289     PackedBit     Filemark:1;                     /* Byte 2 Bit 7    */
290 #else 
291     PackedBit     Filemark:1;                     /* Byte 2 Bit 7    */
292     PackedBit     REOM:1;                         /* Byte 2 Bit 6    */
293     PackedBit     RILI:1;                         /* Byte 2 Bit 5    */
294     PackedBit     :1;                             /* Byte 2 Bit 4    */ 
295     PackedBit     SenseKey:4;                     /* Byte 2 Bits 0-3 */
296 #endif
297     unsigned char Information[4];                 /* Bytes 3-6       */ 
298     unsigned char AdditionalSenseLength;          /* Byte 7          */   
299     unsigned char LogParameterPageCode;           /* Bytes 8         */ 
300     unsigned char LogParameterCode;               /* Bytes 9         */ 
301     unsigned char Byte10;                         /* Bytes 10        */ 
302     unsigned char UnderrunOverrunCounter;         /* Bytes 11        */ 
303     unsigned char AdditionalSenseCode;            /* Byte 12         */
304     unsigned char AdditionalSenseCodeQualifier;   /* Byte 13         */ 
305     unsigned char Byte14;                         /* Byte 14         */ 
306     unsigned char Byte15;                         /* Byte 15         */ 
307     unsigned char ReadWriteDataErrorCounter[3];   /* Byte 16-18      */ 
308 #ifdef LITTLE_ENDIAN_BITFIELDS        
309     PackedBit     LBOT:1;                         /* Byte 19 Bits 0 */
310     PackedBit     TNP:1;                          /* Byte 19 Bits 1 */
311     PackedBit     TME:1;                          /* Byte 19 Bits 2 */
312     PackedBit     ECO:1;                          /* Byte 19 Bits 3 */
313     PackedBit     ME:1;                           /* Byte 19 Bits 4 */
314     PackedBit     FPE:1;                          /* Byte 19 Bits 5 */
315     PackedBit     BPE:1;                          /* Byte 19 Bits 6 */
316     PackedBit     PF:1;                           /* Byte 19 Bits 7 */
317 #else 
318     PackedBit     PF:1;                           /* Byte 19 Bits 7 */
319     PackedBit     BPE:1;                          /* Byte 19 Bits 6 */
320     PackedBit     FPE:1;                          /* Byte 19 Bits 5 */
321     PackedBit     ME:1;                           /* Byte 19 Bits 4 */
322     PackedBit     ECO:1;                          /* Byte 19 Bits 3 */
323     PackedBit     TME:1;                          /* Byte 19 Bits 2 */
324     PackedBit     TNP:1;                          /* Byte 19 Bits 1 */
325     PackedBit     LBOT:1;                         /* Byte 19 Bits 0 */
326 #endif
327 #ifdef LITTLE_ENDIAN_BITFIELDS        
328     PackedBit     FE:1;                           /* Byte 20 Bits 0 */
329     PackedBit     SSE:1;                          /* Byte 20 Bits 1 */
330     PackedBit     WEI:1;                          /* Byte 20 Bits 2 */
331     PackedBit     URE:1;                          /* Byte 20 Bits 3 */
332     PackedBit     FMKE:1;                         /* Byte 20 Bits 4 */
333     PackedBit     WP:1;                           /* Byte 20 Bits 5 */
334     PackedBit     TMD:1;                          /* Byte 20 Bits 6 */
335     PackedBit     :1;                             /* Byte 20 Bits 7 */
336 #else 
337     PackedBit     :1;                             /* Byte 20 Bits 7 */
338     PackedBit     TMD:1;                          /* Byte 20 Bits 6 */
339     PackedBit     WP:1;                           /* Byte 20 Bits 5 */
340     PackedBit     FMKE:1;                         /* Byte 20 Bits 4 */
341     PackedBit     URE:1;                          /* Byte 20 Bits 3 */
342     PackedBit     WEI:1;                          /* Byte 20 Bits 2 */
343     PackedBit     SSE:1;                          /* Byte 20 Bits 1 */
344     PackedBit     FE:1;                           /* Byte 20 Bits 0 */
345 #endif
346 #ifdef LITTLE_ENDIAN_BITFIELDS        
347     PackedBit     WSEO:1;                         /* Byte 21 Bits 0 */
348     PackedBit     WSEB:1;                         /* Byte 21 Bits 1 */
349     PackedBit     PEOT:1;                         /* Byte 21 Bits 2 */
350     PackedBit     CLN:1;                          /* Byte 21 Bits 3 */
351     PackedBit     CLND:1;                         /* Byte 21 Bits 4 */
352     PackedBit     RRR:1;                          /* Byte 21 Bits 5 */
353     PackedBit     UCLN:1;                         /* Byte 21 Bits 6 */
354     PackedBit     :1;                             /* Byte 21 Bits 7 */
355 #else 
356     PackedBit     :1;                             /* Byte 21 Bits 7 */
357     PackedBit     UCLN:1;                         /* Byte 21 Bits 6 */
358     PackedBit     RRR:1;                          /* Byte 21 Bits 5 */
359     PackedBit     CLND:1;                         /* Byte 21 Bits 4 */
360     PackedBit     CLN:1;                          /* Byte 21 Bits 3 */
361     PackedBit     PEOT:1;                         /* Byte 21 Bits 2 */
362     PackedBit     WSEB:1;                         /* Byte 21 Bits 1 */
363     PackedBit     WSEO:1;                         /* Byte 21 Bits 0 */
364 #endif
365     unsigned char Byte21;                          /* Byte 22         */ 
366     unsigned char RemainingTape[3];                /* Byte 23-25      */ 
367     unsigned char TrackingRetryCounter;            /* Byte 26         */ 
368     unsigned char ReadWriteRetryCounter;           /* Byte 27         */ 
369     unsigned char FaultSymptomCode;                /* Byte 28         */ 
370     
371 } ExtendedRequestSense_T;     
372
373 /* ======================================================= */
374 /*  ReadElementStatus_T */
375 /* ======================================================= */
376 typedef struct 
377 {
378     unsigned char cmd;                           /* Byte 1 */
379 #ifdef LITTLE_ENDIAN_BITFIELDS        
380     PackedBit     type : 4;
381     PackedBit     voltag :1;
382     PackedBit     lun :3;
383 #else
384     PackedBit     lun :3;
385     PackedBit     voltag :1;
386     PackedBit     type : 4;
387 #endif
388     unsigned char start[2];                    /* Byte 3-4 */
389     unsigned char number[2];                   /* Byte 5-6 */
390     unsigned char byte4;                       /* Byte 7 */
391     unsigned char length[4];                   /* Byte 8-11 */
392     unsigned char byte78[2];                   /* Byte 12-13 */
393 } ReadElementStatus_T;
394
395 /* ======================================================= */
396 /* ElementStatusPage_T */
397 /* ======================================================= */
398 typedef struct 
399 {
400     unsigned char type;     /* Byte 1 = Element Type Code*/
401 #ifdef LITTLE_ENDIAN_BITFIELDS        
402     PackedBit     bitres  : 6;
403     PackedBit     avoltag : 1;
404     PackedBit     pvoltag : 1;
405 #else
406     PackedBit     pvoltag : 1;
407     PackedBit     avoltag : 1;
408     PackedBit     bitres  : 6;
409 #endif
410     unsigned char length[2];    /* Byte 2-3  = Element Descriptor Length */
411     unsigned char byte4;        /* Byte 4 */
412     unsigned char count[3];     /* Byte 5-7 = Byte Count of Descriptor Available */
413 } ElementStatusPage_T;
414
415
416 /* ======================================================= */
417 /* ElementStatusData_T */
418 /* ======================================================= */
419 typedef struct 
420 {
421     unsigned char first[2];    /* Byte 1-2 = First Element Adress Reported */
422     unsigned char number[2];   /* Byte 3-4 = Number of Elements Available */
423     unsigned char byte5;      /* Reserved */
424     unsigned char count[3];     /* Byte 6-8 = Byte Count of Report Available */
425 } ElementStatusData_T;
426
427 /* ======================================================= */
428 /* MediumTransportElementDescriptor_T */
429 /* ======================================================= */
430 typedef struct 
431 {
432     unsigned char address[2];   /* Byte 1-2 = Element Address */
433 #ifdef LITTLE_ENDIAN_BITFIELDS        
434     PackedBit     full   : 1;
435     PackedBit     rsvd   : 1;
436     PackedBit     except : 1;
437     PackedBit     res    : 5;
438 #else
439     PackedBit     res    : 5;
440     PackedBit     except : 1;
441     PackedBit     rsvd   : 1;
442     PackedBit     full   : 1;
443 #endif
444     unsigned char byte4;        /* Byte 4      */
445     unsigned char asc;          /* Byte 5 ASC  */
446     unsigned char ascq;         /* Byte 6 ASCQ */
447     unsigned char byte79[3];    /* Byte 7-9    */
448 #ifdef LITTLE_ENDIAN_BITFIELDS        
449     PackedBit     byte10res : 6;
450     PackedBit     invert : 1;
451     PackedBit     svalid : 1;
452 #else
453     PackedBit     svalid : 1;
454     PackedBit     invert : 1;
455     PackedBit     byte10res : 6;
456 #endif
457     unsigned char source[2];
458   unsigned char pvoltag[36];
459   unsigned char res4[4];
460 } MediumTransportElementDescriptor_T;
461
462 /* ======================================================= */
463 /* ImportExportElementDescriptor_T */
464 /* ======================================================= */
465 typedef struct 
466 {
467   unsigned char address[2];   /* Byte 1 = Element Address */
468 #ifdef LITTLE_ENDIAN_BITFIELDS        
469   PackedBit     full   : 1;
470   PackedBit     impexp : 1;
471   PackedBit     except : 1;
472   PackedBit     access : 1;
473   PackedBit     exenab : 1;
474   PackedBit     inenab : 1;
475   PackedBit     res    : 2;
476 #else
477   PackedBit     res    : 2;
478   PackedBit     inenab : 1;
479   PackedBit     exenab : 1;
480   PackedBit     access : 1;
481   PackedBit     except : 1;
482   PackedBit     rsvd   : 1;
483   PackedBit     full   : 1;
484 #endif
485     unsigned char byte4;
486     unsigned char asc;
487     unsigned char ascq;
488     unsigned char byte79[3];
489 #ifdef LITTLE_ENDIAN_BITFIELDS        
490     PackedBit     byte10res : 6;
491     PackedBit     invert : 1;
492     PackedBit     svalid : 1;
493 #else
494     PackedBit     svalid : 1;
495     PackedBit     invert : 1;
496     PackedBit     byte10res : 6;
497 #endif
498     unsigned char source[2];
499   unsigned char pvoltag[36];
500   unsigned char res4[4];
501   unsigned char mediadomain[1];
502   unsigned char mediatype[1];
503   unsigned char res5[2];
504 } ImportExportElementDescriptor_T;
505
506 /* ======================================================= */
507 /* StorageElementDescriptor_T */
508 /* ======================================================= */
509 typedef struct 
510 {
511     unsigned char address[2];
512 #ifdef LITTLE_ENDIAN_BITFIELDS        
513     PackedBit     full   : 1;
514     PackedBit     rsvd   : 1;
515     PackedBit     except : 1;
516     PackedBit     access : 1;
517     PackedBit     res    : 4;
518 #else
519     PackedBit     res    : 4;
520     PackedBit     access : 1;
521     PackedBit     except : 1;
522     PackedBit     rsvd   : 1;
523     PackedBit     full   : 1;
524 #endif
525     unsigned char res1;
526     unsigned char asc;
527     unsigned char ascq;
528     unsigned char res2[3];
529 #ifdef LITTLE_ENDIAN_BITFIELDS        
530     PackedBit     res3   : 6;
531     PackedBit     invert : 1;
532     PackedBit     svalid : 1;
533 #else
534     PackedBit     svalid : 1;
535     PackedBit     invert : 1;
536     PackedBit     res3   : 6;
537 #endif
538     unsigned char source[2];
539   unsigned char pvoltag[36];
540   unsigned char res4[4];
541   unsigned char mediadomain[1];
542   unsigned char mediatype[1];
543   unsigned char res5[2];
544 } StorageElementDescriptor_T;
545
546 /* ======================================================= */
547 /* DataTransferElementDescriptor_T */
548 /* ======================================================= */
549 typedef struct 
550 {
551     unsigned char address[2];
552 #ifdef LITTLE_ENDIAN_BITFIELDS        
553     PackedBit     full    : 1;
554     PackedBit     rsvd    : 1;
555     PackedBit     except  : 1;
556     PackedBit     access  : 1;
557     PackedBit     res     : 4;
558 #else
559     PackedBit     res     : 4;
560     PackedBit     access  : 1;
561     PackedBit     except  : 1;
562     PackedBit     rsvd    : 1;
563     PackedBit     full    : 1;
564 #endif
565     unsigned char res1;
566     unsigned char asc;
567     unsigned char ascq;
568 #ifdef LITTLE_ENDIAN_BITFIELDS        
569     PackedBit     lun     : 3;
570     PackedBit     rsvd1   : 1;
571     PackedBit     luvalid : 1;
572     PackedBit     idvalid : 1;
573     PackedBit     rsvd2   : 1;
574     PackedBit     notbus  : 1;
575 #else
576     PackedBit     notbus  : 1;
577     PackedBit     rsvd2   : 1;
578     PackedBit     idvalid : 1;
579     PackedBit     luvalid : 1;
580     PackedBit     rsvd1   : 1;
581     PackedBit     lun     : 3;
582 #endif
583     unsigned char scsi;
584     unsigned char res2;
585 #ifdef LITTLE_ENDIAN_BITFIELDS        
586     PackedBit     res3    : 6;
587     PackedBit     invert  : 1;
588     PackedBit     svalid  : 1;
589 #else
590     PackedBit     svalid  : 1;
591     PackedBit     invert  : 1;
592     PackedBit     res3    : 6;
593 #endif
594     unsigned char source[2];
595   unsigned char pvoltag[36];
596     unsigned char res4[42];
597 } DataTransferElementDescriptor_T;
598
599 /* ======================================================= */
600 /* SCSIInquiry_T */
601 /* ======================================================= */
602 typedef struct
603 {
604 #ifdef LITTLE_ENDIAN_BITFIELDS
605     PackedBit     type : 5;
606     PackedBit     qualifier : 3;
607
608     PackedBit     type_modifier : 7;
609     PackedBit     removable : 1;
610
611     PackedBit     ansi_version : 3;
612     PackedBit     ecma_version : 3;
613     PackedBit     iso_version : 2;
614
615     PackedBit     data_format : 4;
616     PackedBit     res3_54 : 2;
617     PackedBit     termiop : 1;
618     PackedBit     aenc : 1;
619 #else
620     PackedBit     qualifier : 3;
621     PackedBit     type : 5;
622   
623     PackedBit     removable : 1;
624     PackedBit     type_modifier : 7;
625   
626     PackedBit     iso_version : 2;
627     PackedBit     ecma_version : 3;
628     PackedBit     ansi_version : 3;
629   
630     PackedBit     aenc : 1;
631     PackedBit     termiop : 1;
632     PackedBit     res3_54 : 2;
633     PackedBit     data_format : 4;
634 #endif
635   
636     unsigned char add_len;
637   
638     unsigned char  res2;
639     unsigned char res3;
640   
641 #ifdef LITTLE_ENDIAN_BITFIELDS
642     PackedBit     softreset : 1;
643     PackedBit     cmdque : 1;
644     PackedBit     res7_2 : 1;
645     PackedBit     linked  : 1;
646     PackedBit     sync : 1;
647     PackedBit     wbus16 : 1;
648     PackedBit     wbus32 : 1;
649     PackedBit     reladr : 1;
650 #else
651     PackedBit     reladr : 1;
652     PackedBit     wbus32 : 1;
653     PackedBit     wbus16 : 1;
654     PackedBit     sync : 1;
655     PackedBit     linked  : 1;
656     PackedBit     res7_2 : 1;
657     PackedBit     cmdque : 1;
658     PackedBit     softreset : 1;
659 #endif
660     char vendor_info[8];
661     char prod_ident[16];
662     char prod_version[4];
663     char vendor_specific[20];
664 } SCSIInquiry_T;
665
666 /* ======================================================= */
667 /* ModeSenseHeader_T */
668 /* ======================================================= */
669 typedef struct
670 {
671     unsigned char DataLength;
672     unsigned char MediumType;
673 #ifdef LITTLE_ENDIAN_BITFIELDS
674     PackedBit Speed:4;
675     PackedBit BufferedMode:3;
676     PackedBit WP:1;
677 #else
678     PackedBit WP:1;
679     PackedBit BufferedMode:3;
680     PackedBit Speed:4;
681 #endif
682     unsigned char BlockDescLength;
683 } ModeSenseHeader_T;
684 /* ======================================================= */
685 /* ModeBlockDescriptor_T */
686 /* ======================================================= */
687 typedef struct 
688 {
689     unsigned char DensityCode;
690     unsigned char NumberOfBlocks[3];
691     unsigned char Reserved;
692     unsigned char BlockLength[3];
693 } ModeBlockDescriptor_T;
694 /* ======================================================= */
695 /* LogSenseHeader_T */
696 /* ======================================================= */
697 typedef struct 
698 {
699 #ifdef LITTLE_ENDIAN_BITFIELDS
700     PackedBit PageCode:6;
701     PackedBit Reserved:2;
702 #else
703     PackedBit Reserved:2;
704     PackedBit PageCode:6;
705 #endif
706     unsigned char Reserved1;
707     unsigned char PageLength[2];
708 } LogSenseHeader_T ;
709 /* ======================================================= */
710 /* LogParameters_T */
711 /* ======================================================= */
712 typedef struct
713 {
714     unsigned char ParameterCode[2];
715 #ifdef LITTLE_ENDIAN_BITFIELDS
716     PackedBit LP:1;
717     PackedBit RSCD:1;
718     PackedBit TMC:1;
719     PackedBit ETC:1;
720     PackedBit TSD:1;
721     PackedBit DS:1;
722     PackedBit DU:1;
723 #else
724     PackedBit DU:1;
725     PackedBit DS:1;
726     PackedBit TSD:1;
727     PackedBit ETC:1;
728     PackedBit TMC:1;
729     PackedBit RSCD:1;
730     PackedBit LP:1;
731 #endif
732     char ParameterLength;
733 } LogParameter_T;
734 /*
735  * Pages returned by the MODE_SENSE command
736  */
737 typedef struct {
738     unsigned char SenseDataLength;
739     char res[3];
740 } ParameterListHeader_T;
741 /* ======================================================= */
742 /* ReadWriteErrorRecoveryPage_T */
743 /* ======================================================= */
744 typedef struct 
745 {
746 #ifdef LITTLE_ENDIAN_BITFIELDS
747     PackedBit PageCode : 6;
748     PackedBit res      : 1;
749     PackedBit PS       : 1;
750 #else
751     PackedBit PS       : 1;
752     PackedBit res      : 1;
753     PackedBit PageCode : 6;
754 #endif
755     unsigned char ParameterListLength;
756 #ifdef LITTLE_ENDIAN_BITFIELDS
757     PackedBit dcr  :1;  /* Disable ECC Correction */
758     PackedBit dte  :1;  /* Disable Transfer on Error */
759     PackedBit per  :1;  /* Enable Post  Error reporting */
760     PackedBit eer  :1;  /* Enable early recovery */
761     PackedBit res1 :1;
762     PackedBit tb   :1;  /* Transfer block (when not fully recovered) */
763     PackedBit res2 :1;
764     PackedBit res3 :1;
765 #else
766     PackedBit res3 :1;
767     PackedBit res2 :1;
768     PackedBit tb   :1;
769     PackedBit res1 :1;
770     PackedBit eer  :1;
771     PackedBit per  :1;
772     PackedBit dte  :1;
773     PackedBit dcr  :1;
774 #endif
775     unsigned char ReadRetryCount;
776     unsigned char res4[4];
777     unsigned char WriteRetryCount;
778     unsigned char res5[3];
779 } ReadWriteErrorRecoveryPage_T; 
780 /* ======================================================= */
781 /* EDisconnectReconnectPage_T */
782 /* ======================================================= */
783 typedef struct 
784 {
785 #ifdef LITTLE_ENDIAN_BITFIELDS
786     PackedBit PageCode : 6;
787     PackedBit RSVD     : 1;
788     PackedBit PS       : 1;
789 #else
790     PackedBit PS       : 1;
791     PackedBit RSVD     : 1;
792     PackedBit PageCode : 6;
793 #endif
794
795     unsigned char BufferFullRatio;
796     unsigned char BufferEmptyRatio;
797     unsigned char BusInactivityLimit[2];
798     unsigned char DisconnectTimeLimit[2];
799     unsigned char ConnectTimeLimit[2];
800     unsigned char MaximumBurstSize[2];
801
802 #ifdef LITTLE_ENDIAN_BITFIELDS
803     PackedBit DTDC :2;
804     PackedBit res  :6;
805 #else
806     PackedBit res  :6;
807     PackedBit DTDC :2;
808 #endif
809     unsigned char res1[3];
810 } DisconnectReconnectPage_T;
811
812 /* ======================================================= */
813 /* EAAPage_T */
814 /* ======================================================= */
815 typedef struct 
816 {
817 #ifdef LITTLE_ENDIAN_BITFIELDS
818     PackedBit PageCode : 6;
819     PackedBit RSVD     : 1;
820     PackedBit PS       : 1;
821 #else
822     PackedBit PS       : 1;
823     PackedBit RSVD     : 1;
824     PackedBit PageCode : 6;
825 #endif
826     unsigned char ParameterListLength;
827     unsigned char MediumTransportElementAddress[2];
828     unsigned char NoMediumTransportElements[2];
829     unsigned char FirstStorageElementAddress[2];
830     unsigned char NoStorageElements[2];
831     unsigned char FirstImportExportElementAddress[2];
832     unsigned char NoImportExportElements[2];
833     unsigned char FirstDataTransferElementAddress[2];
834     unsigned char NoDataTransferElements[2];
835     unsigned char res[2];
836 } EAAPage_T;    
837 /* ======================================================= */
838 /* TransPortGeometryDescriptorPage_T */
839 /* ======================================================= */
840 typedef struct {
841 #ifdef LITTLE_ENDIAN_BITFIELDS
842     PackedBit PageCode : 6;
843     PackedBit RSVD     : 1;
844     PackedBit PS       : 1;
845 #else
846     PackedBit PS       : 1;
847     PackedBit RSVD     : 1;
848     PackedBit PageCode : 6;
849 #endif
850     unsigned char ParameterListLength;
851 #ifdef LITTLE_ENDIAN_BITFIELDS
852     PackedBit Rotate    : 1;
853     PackedBit res       : 7;
854 #else
855     PackedBit res       : 7;
856     PackedBit Rotate    : 1;
857 #endif
858     unsigned char MemberNumber;
859 } TransportGeometryDescriptorPage_T;  
860 /* ======================================================= */
861 /* DeviceCapabilitiesPage_T */
862 /* ======================================================= */
863 typedef struct
864 {
865 #ifdef LITTLE_ENDIAN_BITFIELDS
866     PackedBit PageCode : 6;
867     PackedBit RSVD     : 1;
868     PackedBit PS       : 1;
869 #else
870     PackedBit PS       : 1;
871     PackedBit RSVD     : 1;
872     PackedBit PageCode : 6;
873 #endif
874     unsigned char ParameterLength;
875 #ifdef LITTLE_ENDIAN_BITFIELDS
876     PackedBit MT        : 1;
877     PackedBit ST        : 1;
878     PackedBit IE        : 1;
879     PackedBit DT        : 1;
880     PackedBit res1      : 4;
881 #else
882     PackedBit res1      : 4;
883     PackedBit DT        : 1;
884     PackedBit IE        : 1;
885     PackedBit ST        : 1;
886     PackedBit MT        : 1;
887 #endif
888     unsigned char res;
889 #ifdef LITTLE_ENDIAN_BITFIELDS
890     PackedBit MT2MT     : 1;
891     PackedBit MT2ST     : 1;
892     PackedBit MT2IE     : 1;
893     PackedBit MT2DT     : 1;
894     PackedBit res2      : 4;
895 #else
896     PackedBit res2      : 4;
897     PackedBit MT2DT     : 1;
898     PackedBit MT2IE     : 1;
899     PackedBit MT2ST     : 1;
900     PackedBit MT2MT     : 1;
901 #endif
902
903 #ifdef LITTLE_ENDIAN_BITFIELDS
904     PackedBit ST2MT     : 1;
905     PackedBit ST2ST     : 1;
906     PackedBit ST2IE     : 1;
907     PackedBit ST2DT     : 1;
908     PackedBit res3      : 4;
909 #else
910     PackedBit res3      : 4;
911     PackedBit ST2DT     : 1;
912     PackedBit ST2IE     : 1;
913     PackedBit ST2ST     : 1;
914     PackedBit ST2MT     : 1;
915 #endif
916
917 #ifdef LITTLE_ENDIAN_BITFIELDS
918     PackedBit IE2MT     : 1;
919     PackedBit IE2ST     : 1;
920     PackedBit IE2IE     : 1;
921     PackedBit IE2DT     : 1;
922     PackedBit res4      : 4;
923 #else
924     PackedBit res4      : 4;
925     PackedBit IE2DT     : 1;
926     PackedBit IE2IE     : 1;
927     PackedBit IE2ST     : 1;
928     PackedBit IE2MT     : 1;
929 #endif
930
931 #ifdef LITTLE_ENDIAN_BITFIELDS
932     PackedBit DT2MT     : 1;
933     PackedBit DT2ST     : 1;
934     PackedBit DT2IE     : 1;
935     PackedBit DT2DT     : 1;
936     PackedBit res5      : 4;
937 #else
938     PackedBit res5      : 4;
939     PackedBit DT2DT     : 1;
940     PackedBit DT2IE     : 1;
941     PackedBit DT2ST     : 1;
942     PackedBit DT2MT     : 1;
943 #endif
944     unsigned char res0819[12];
945 } DeviceCapabilitiesPage_T;  
946 /* ======================================================= */
947 /* ModePageEXB10hLCD_T */
948 /* ======================================================= */
949 typedef struct ModePageEXB10hLCD
950 {
951   unsigned char PageCode;
952   unsigned char ParameterListLength;
953
954 #ifdef LITTLE_ENDIAN_BITFIELDS
955   PackedBit WriteLine4 : 1;
956   PackedBit WriteLine3 : 1;
957   PackedBit WriteLine2 : 1;
958   PackedBit WriteLine1 : 1;
959   PackedBit res        : 4;
960 #else
961   PackedBit res        : 4;
962   PackedBit WriteLine1 : 1;
963   PackedBit WriteLine2 : 1;
964   PackedBit WriteLine3 : 1;
965   PackedBit WriteLine4 : 1;
966 #endif
967   unsigned char reserved;
968   unsigned char line1[20];
969   unsigned char line2[20];
970   unsigned char line3[20];
971   unsigned char line4[20];
972 } ModePageEXB10hLCD_T;
973 /* ======================================================= */
974 /* ModePageEXBBaudRatePage_T */
975 /* ======================================================= */
976 typedef struct ModePageEXBBaudRatePage
977 {
978   unsigned char PageCode;
979   unsigned char ParameterListLength;
980   unsigned char BaudRate[2];
981 } ModePageEXBBaudRatePage_T;
982 /* ======================================================= */
983 /* ModePageEXB120VendorUnique_T */
984 /* ======================================================= */
985 typedef struct ModePageEXB120VendorUnique
986 {
987 #ifdef  LITTLE_ENDIAN_BITFIELDS
988     PackedBit PageCode : 6;
989     PackedBit RSVD0    : 1;
990     PackedBit PS       : 1;
991 #else
992     PackedBit PS       : 1;
993     PackedBit RSVD0    : 1;
994     PackedBit PageCode : 6;
995 #endif
996     unsigned char ParameterListLength;
997 #ifdef LITTLE_ENDIAN_BITFIELDS
998     PackedBit MDC  : 2;
999     PackedBit NRDC : 1;
1000     PackedBit RSVD : 1;
1001     PackedBit NBL  : 1;
1002     PackedBit PRTY : 1;
1003     PackedBit UINT : 1;
1004     PackedBit AINT : 1;
1005 #else
1006     PackedBit AINT : 1;
1007     PackedBit UINT : 1;
1008     PackedBit PRTY : 1;
1009     PackedBit NBL  : 1;
1010     PackedBit RSVD : 1;
1011     PackedBit NRDC : 1;
1012     PackedBit MDC  : 2;
1013 #endif
1014     unsigned char MaxParityRetries;
1015     unsigned char DisplayMessage[60];
1016 } ModePageEXB120VendorUnique_T;
1017 /* ======================================================= */
1018 /* ModePageTreeFrogVendorUnique_T */
1019 /* ======================================================= */
1020 typedef struct ModePageTreeFrogVendorUnique
1021 {
1022 #ifdef  LITTLE_ENDIAN_BITFIELDS
1023     PackedBit PageCode : 6;
1024     PackedBit res0     : 1;
1025     PackedBit PS       : 1;
1026 #else
1027     PackedBit PS       : 1;
1028     PackedBit res0     : 1;
1029     PackedBit PageCode : 6;
1030 #endif
1031     unsigned char ParameterListLength;
1032 #ifdef LITTLE_ENDIAN_BITFIELDS
1033     PackedBit EBARCO  : 1;
1034     PackedBit CHKSUM  : 1;
1035     PackedBit res2    : 6;
1036 #else
1037     PackedBit res2    : 6;
1038     PackedBit CHKSUM  : 1;
1039     PackedBit EBARCO  : 1;
1040 #endif
1041     unsigned char res3;
1042     unsigned char res4;
1043     unsigned char res5;
1044     unsigned char res6;
1045     unsigned char res7;
1046     unsigned char res8;
1047     unsigned char res9;
1048 } ModePageTreeFrogVendorUnique_T;
1049 /* ======================================================= */
1050 /* ElementInfo_T */
1051 /* ======================================================= */
1052 typedef struct ElementInfo
1053 {
1054     int type;       /* CHANGER - 1, STORAGE - 2, TAPE - 4 */
1055     int address;    /* Adress of this Element */
1056     int from;       /* From where did it come */
1057     char status;    /* F -> Full, E -> Empty */
1058     char VolTag[TAG_SIZE+1]; /* Label Info if Barcode reader exsist */
1059     unsigned char ASC;  /* Additional Sense Code from read element status */
1060     unsigned char ASCQ; /* */
1061     unsigned char scsi; /* if DTE, which scsi address */
1062
1063   PackedBit svalid : 1;
1064   PackedBit invert : 1;
1065   PackedBit full   : 1;
1066   PackedBit impexp : 1;
1067   PackedBit except : 1;
1068   PackedBit access : 1;
1069   PackedBit inenab : 1;
1070   PackedBit exenab : 1;
1071
1072 } ElementInfo_T;
1073
1074
1075
1076 typedef struct {
1077     char *ident;                  /* Name of the device from inquiry */
1078     char *type;                   /* Device Type, tape|robot */
1079     int (*function_move)(int, int, int);
1080     int (*function_status)(int, int);
1081     int (*function_reset_status)(int);
1082     int (*function_free)(void);
1083     int (*function_eject)(char *, int);
1084     int (*function_clean)(char *);
1085     int (*function_rewind)(int);
1086     int (*function_barcode)(int);
1087     int (*function_search)(void);
1088     int (*function_error)(int, unsigned char, unsigned char, unsigned char, unsigned char, RequestSense_T *);
1089 } ChangerCMD_T ;
1090
1091 typedef struct {
1092     unsigned char command;        /* The SCSI command byte */
1093     int length;                   /* How long */
1094     char *name;                   /* Name of the command */
1095 } SC_COM_T;
1096
1097 typedef struct OpenFiles {
1098     int fd;                       /* The filedescriptor */
1099 #ifdef HAVE_CAM_LIKE_SCSI
1100     struct cam_device *curdev;
1101 #endif
1102   unsigned char avail;          /* Is this device available */
1103   unsigned char devopen;        /* Is the device open */
1104   unsigned char inqdone;        /* Did we try to get device infos, was an open sucessfull */
1105   unsigned char SCSI;           /* Can we send SCSI commands */
1106   int flags;                    /* Can be used for some flags ... */
1107   char *dev;                    /* The device which is used */
1108   char *type;                   /* Type of device, tape/changer */
1109   char *ConfigName;             /* The name in the config */
1110   char ident[17];               /* The identifier from the inquiry command */
1111   ChangerCMD_T *functions;      /* Pointer to the function array for this device */
1112   SCSIInquiry_T *inquiry;       /* The result from the Inquiry */
1113 } OpenFiles_T;
1114
1115 typedef struct LogPageDecode {
1116     int LogPage;
1117     char *ident;
1118     void (*decode)(LogParameter_T *, size_t);
1119 } LogPageDecode_T;
1120
1121 typedef struct {
1122    char *ident;        /* Ident as returned from the inquiry */
1123    char *vendor;       /* Vendor as returned from the inquiry */
1124    unsigned char type; /* removable .... */
1125    unsigned char sense;/* Sense key as returned from the device */
1126    unsigned char asc;  /* ASC as set in the sense struct */
1127    unsigned char ascq; /* ASCQ as set in the sense struct */
1128    int  ret;           /* What we think that we should return on this conditon */
1129    char text[80];      /* A short text describing this condition */
1130 } SenseType_T;                                                                                    
1131
1132 /* ======================================================= */
1133 /* Function-Declaration */
1134 /* ======================================================= */
1135 int SCSI_OpenDevice(int);
1136 int OpenDevice(int, char *DeviceName, char *ConfigName, char *ident);
1137
1138 int SCSI_CloseDevice(int DeviceFD); 
1139 int CloseDevice(char *, int); 
1140 int Tape_Eject(int);
1141 int Tape_Status(int);
1142 void DumpSense(void);
1143 int Sense2Action(char *ident,
1144                         unsigned char type,
1145                         unsigned char ignsense,
1146                         unsigned char sense,
1147                         unsigned char asc,
1148                         unsigned char ascq,
1149                         char **text);
1150
1151 int SCSI_ExecuteCommand(int DeviceFD,
1152                         Direction_T Direction,
1153                         CDB_T CDB,
1154                         size_t CDB_Length,
1155                         void *DataBuffer,
1156                         size_t DataBufferLength,
1157                         RequestSense_T *RequestSense,
1158                         size_t RequestSenseLength);
1159
1160 int Tape_Ioctl(int DeviceFD, int command);
1161 void ChangerStatus(char * option,
1162                         char * labelfile,
1163                         int HasBarCode,
1164                         char *changer_file,
1165                         char *changer_dev,
1166                         char *tape_device);
1167
1168 int SCSI_Inquiry(int, SCSIInquiry_T *, size_t);
1169 int PrintInquiry(SCSIInquiry_T *);
1170 int DecodeSCSI(CDB_T CDB, char *string);
1171
1172 int RequestSense(int fd, ExtendedRequestSense_T *s, int ClearErrorCounters);
1173 int DecodeSense(RequestSense_T *sense, char *pstring, FILE *out);
1174 int DecodeExtSense(ExtendedRequestSense_T *sense, char *pstring, FILE *out);
1175
1176 void ChgExit(char *, char *, int);
1177
1178 void ChangerReplay(char *option);
1179 void ChangerStatus(char *option, char *labelfile, int HasBarCode, char *changer_file, char *changer_dev, char *tape_device);
1180 int BarCode(int fd);
1181 int MapBarCode(char *labelfile, MBC_T *);
1182
1183 int Tape_Ready(int fd, time_t wait_time);
1184
1185 void Inventory(char *labelfile, int drive, int eject, int start, int stop, int clean);
1186 void ChangerDriverVersion(void);
1187 void PrintConf(void);
1188 int LogSense(int fd);
1189 int ScanBus(int print);
1190 void DebugPrint(int level, int section, char * fmt, ...);
1191 int DecodeSense(RequestSense_T *sense, char *pstring, FILE *out);
1192 void SCSI_OS_Version(void);
1193 int get_clean_state(char *tapedev);
1194 int find_empty(int fd, int start, int count);
1195 int get_slot_count(int fd);
1196 int get_drive_count(int fd);
1197 int GetCurrentSlot(int fd, int drive);
1198 void DumpDev(OpenFiles_T *p, char *device);
1199 int isempty(int fd, int slot);
1200
1201 #endif  /* !SCSIDEFS_H */
1202 /*
1203  * Local variables:
1204  * indent-tabs-mode: nil
1205  * c-file-style: gnu
1206  * End:
1207  */