1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
/* automatically generated by rust-bindgen */

#[repr(C)]
#[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct __BindgenBitfieldUnit<Storage, Align>
where
    Storage: AsRef<[u8]> + AsMut<[u8]>,
{
    storage: Storage,
    align: [Align; 0],
}

impl<Storage, Align> __BindgenBitfieldUnit<Storage, Align>
where
    Storage: AsRef<[u8]> + AsMut<[u8]>,
{
    #[inline]
    pub fn new(storage: Storage) -> Self {
        Self { storage, align: [] }
    }

    #[inline]
    pub fn get_bit(&self, index: usize) -> bool {
        debug_assert!(index / 8 < self.storage.as_ref().len());

        let byte_index = index / 8;
        let byte = self.storage.as_ref()[byte_index];

        let bit_index = if cfg!(target_endian = "big") {
            7 - (index % 8)
        } else {
            index % 8
        };

        let mask = 1 << bit_index;

        byte & mask == mask
    }

    #[inline]
    pub fn set_bit(&mut self, index: usize, val: bool) {
        debug_assert!(index / 8 < self.storage.as_ref().len());

        let byte_index = index / 8;
        let byte = &mut self.storage.as_mut()[byte_index];

        let bit_index = if cfg!(target_endian = "big") {
            7 - (index % 8)
        } else {
            index % 8
        };

        let mask = 1 << bit_index;
        if val {
            *byte |= mask;
        } else {
            *byte &= !mask;
        }
    }

    #[inline]
    pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 {
        debug_assert!(bit_width <= 64);
        debug_assert!(bit_offset / 8 < self.storage.as_ref().len());
        debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len());

        let mut val = 0;

        for i in 0..(bit_width as usize) {
            if self.get_bit(i + bit_offset) {
                let index = if cfg!(target_endian = "big") {
                    bit_width as usize - 1 - i
                } else {
                    i
                };
                val |= 1 << index;
            }
        }

        val
    }

    #[inline]
    pub fn set(&mut self, bit_offset: usize, bit_width: u8, val: u64) {
        debug_assert!(bit_width <= 64);
        debug_assert!(bit_offset / 8 < self.storage.as_ref().len());
        debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len());

        for i in 0..(bit_width as usize) {
            let mask = 1 << i;
            let val_bit_is_set = val & mask == mask;
            let index = if cfg!(target_endian = "big") {
                bit_width as usize - 1 - i
            } else {
                i
            };
            self.set_bit(index + bit_offset, val_bit_is_set);
        }
    }
}
pub const _SCSI_SG_H: u32 = 1;
pub const _FEATURES_H: u32 = 1;
pub const _DEFAULT_SOURCE: u32 = 1;
pub const __GLIBC_USE_ISOC2X: u32 = 0;
pub const __USE_ISOC11: u32 = 1;
pub const __USE_ISOC99: u32 = 1;
pub const __USE_ISOC95: u32 = 1;
pub const __USE_POSIX_IMPLICITLY: u32 = 1;
pub const _POSIX_SOURCE: u32 = 1;
pub const _POSIX_C_SOURCE: u32 = 200809;
pub const __USE_POSIX: u32 = 1;
pub const __USE_POSIX2: u32 = 1;
pub const __USE_POSIX199309: u32 = 1;
pub const __USE_POSIX199506: u32 = 1;
pub const __USE_XOPEN2K: u32 = 1;
pub const __USE_XOPEN2K8: u32 = 1;
pub const _ATFILE_SOURCE: u32 = 1;
pub const __USE_MISC: u32 = 1;
pub const __USE_ATFILE: u32 = 1;
pub const __USE_FORTIFY_LEVEL: u32 = 0;
pub const __GLIBC_USE_DEPRECATED_GETS: u32 = 0;
pub const __GLIBC_USE_DEPRECATED_SCANF: u32 = 0;
pub const _STDC_PREDEF_H: u32 = 1;
pub const __STDC_IEC_559__: u32 = 1;
pub const __STDC_IEC_559_COMPLEX__: u32 = 1;
pub const __STDC_ISO_10646__: u32 = 201706;
pub const __GNU_LIBRARY__: u32 = 6;
pub const __GLIBC__: u32 = 2;
pub const __GLIBC_MINOR__: u32 = 31;
pub const _SYS_CDEFS_H: u32 = 1;
pub const __glibc_c99_flexarr_available: u32 = 1;
pub const __WORDSIZE: u32 = 64;
pub const __WORDSIZE_TIME64_COMPAT32: u32 = 1;
pub const __SYSCALL_WORDSIZE: u32 = 64;
pub const __LONG_DOUBLE_USES_FLOAT128: u32 = 0;
pub const __HAVE_GENERIC_SELECTION: u32 = 1;
pub const SG_DXFER_NONE: i32 = -1;
pub const SG_DXFER_TO_DEV: i32 = -2;
pub const SG_DXFER_FROM_DEV: i32 = -3;
pub const SG_DXFER_TO_FROM_DEV: i32 = -4;
pub const SG_FLAG_DIRECT_IO: u32 = 1;
pub const SG_FLAG_LUN_INHIBIT: u32 = 2;
pub const SG_FLAG_NO_DXFER: u32 = 65536;
pub const SG_INFO_OK_MASK: u32 = 1;
pub const SG_INFO_OK: u32 = 0;
pub const SG_INFO_CHECK: u32 = 1;
pub const SG_INFO_DIRECT_IO_MASK: u32 = 6;
pub const SG_INFO_INDIRECT_IO: u32 = 0;
pub const SG_INFO_DIRECT_IO: u32 = 2;
pub const SG_INFO_MIXED_IO: u32 = 4;
pub const SG_EMULATED_HOST: u32 = 8707;
pub const SG_SET_TRANSFORM: u32 = 8708;
pub const SG_GET_TRANSFORM: u32 = 8709;
pub const SG_SET_RESERVED_SIZE: u32 = 8821;
pub const SG_GET_RESERVED_SIZE: u32 = 8818;
pub const SG_GET_SCSI_ID: u32 = 8822;
pub const SG_SET_FORCE_LOW_DMA: u32 = 8825;
pub const SG_GET_LOW_DMA: u32 = 8826;
pub const SG_SET_FORCE_PACK_ID: u32 = 8827;
pub const SG_GET_PACK_ID: u32 = 8828;
pub const SG_GET_NUM_WAITING: u32 = 8829;
pub const SG_GET_SG_TABLESIZE: u32 = 8831;
pub const SG_GET_VERSION_NUM: u32 = 8834;
pub const SG_SCSI_RESET: u32 = 8836;
pub const SG_SCSI_RESET_NOTHING: u32 = 0;
pub const SG_SCSI_RESET_DEVICE: u32 = 1;
pub const SG_SCSI_RESET_BUS: u32 = 2;
pub const SG_SCSI_RESET_HOST: u32 = 3;
pub const SG_IO: u32 = 8837;
pub const SG_GET_REQUEST_TABLE: u32 = 8838;
pub const SG_SET_KEEP_ORPHAN: u32 = 8839;
pub const SG_GET_KEEP_ORPHAN: u32 = 8840;
pub const SG_SCATTER_SZ: u32 = 32768;
pub const SG_DEFAULT_RETRIES: u32 = 1;
pub const SG_DEF_FORCE_LOW_DMA: u32 = 0;
pub const SG_DEF_FORCE_PACK_ID: u32 = 0;
pub const SG_DEF_KEEP_ORPHAN: u32 = 0;
pub const SG_DEF_RESERVED_SIZE: u32 = 32768;
pub const SG_MAX_QUEUE: u32 = 16;
pub const SG_BIG_BUFF: u32 = 32768;
pub const SG_MAX_SENSE: u32 = 16;
pub const SG_SET_TIMEOUT: u32 = 8705;
pub const SG_GET_TIMEOUT: u32 = 8706;
pub const SG_GET_COMMAND_Q: u32 = 8816;
pub const SG_SET_COMMAND_Q: u32 = 8817;
pub const SG_SET_DEBUG: u32 = 8830;
pub const SG_NEXT_CMD_LEN: u32 = 8835;
pub const SG_DEF_COMMAND_Q: u32 = 0;
pub const SG_DEF_UNDERRUN_FLAG: u32 = 0;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct sg_iovec {
    pub iov_base: *mut ::std::os::raw::c_void,
    pub iov_len: usize,
}
#[test]
fn bindgen_test_layout_sg_iovec() {
    assert_eq!(
        ::std::mem::size_of::<sg_iovec>(),
        16usize,
        concat!("Size of: ", stringify!(sg_iovec))
    );
    assert_eq!(
        ::std::mem::align_of::<sg_iovec>(),
        8usize,
        concat!("Alignment of ", stringify!(sg_iovec))
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<sg_iovec>())).iov_base as *const _ as usize },
        0usize,
        concat!(
            "Offset of field: ",
            stringify!(sg_iovec),
            "::",
            stringify!(iov_base)
        )
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<sg_iovec>())).iov_len as *const _ as usize },
        8usize,
        concat!(
            "Offset of field: ",
            stringify!(sg_iovec),
            "::",
            stringify!(iov_len)
        )
    );
}
impl Default for sg_iovec {
    fn default() -> Self {
        unsafe { ::std::mem::zeroed() }
    }
}
pub type sg_iovec_t = sg_iovec;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct sg_io_hdr {
    pub interface_id: ::std::os::raw::c_int,
    pub dxfer_direction: ::std::os::raw::c_int,
    pub cmd_len: ::std::os::raw::c_uchar,
    pub mx_sb_len: ::std::os::raw::c_uchar,
    pub iovec_count: ::std::os::raw::c_ushort,
    pub dxfer_len: ::std::os::raw::c_uint,
    pub dxferp: *mut ::std::os::raw::c_void,
    pub cmdp: *mut ::std::os::raw::c_uchar,
    pub sbp: *mut ::std::os::raw::c_uchar,
    pub timeout: ::std::os::raw::c_uint,
    pub flags: ::std::os::raw::c_uint,
    pub pack_id: ::std::os::raw::c_int,
    pub usr_ptr: *mut ::std::os::raw::c_void,
    pub status: ::std::os::raw::c_uchar,
    pub masked_status: ::std::os::raw::c_uchar,
    pub msg_status: ::std::os::raw::c_uchar,
    pub sb_len_wr: ::std::os::raw::c_uchar,
    pub host_status: ::std::os::raw::c_ushort,
    pub driver_status: ::std::os::raw::c_ushort,
    pub resid: ::std::os::raw::c_int,
    pub duration: ::std::os::raw::c_uint,
    pub info: ::std::os::raw::c_uint,
}
#[test]
fn bindgen_test_layout_sg_io_hdr() {
    assert_eq!(
        ::std::mem::size_of::<sg_io_hdr>(),
        88usize,
        concat!("Size of: ", stringify!(sg_io_hdr))
    );
    assert_eq!(
        ::std::mem::align_of::<sg_io_hdr>(),
        8usize,
        concat!("Alignment of ", stringify!(sg_io_hdr))
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<sg_io_hdr>())).interface_id as *const _ as usize },
        0usize,
        concat!(
            "Offset of field: ",
            stringify!(sg_io_hdr),
            "::",
            stringify!(interface_id)
        )
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<sg_io_hdr>())).dxfer_direction as *const _ as usize },
        4usize,
        concat!(
            "Offset of field: ",
            stringify!(sg_io_hdr),
            "::",
            stringify!(dxfer_direction)
        )
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<sg_io_hdr>())).cmd_len as *const _ as usize },
        8usize,
        concat!(
            "Offset of field: ",
            stringify!(sg_io_hdr),
            "::",
            stringify!(cmd_len)
        )
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<sg_io_hdr>())).mx_sb_len as *const _ as usize },
        9usize,
        concat!(
            "Offset of field: ",
            stringify!(sg_io_hdr),
            "::",
            stringify!(mx_sb_len)
        )
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<sg_io_hdr>())).iovec_count as *const _ as usize },
        10usize,
        concat!(
            "Offset of field: ",
            stringify!(sg_io_hdr),
            "::",
            stringify!(iovec_count)
        )
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<sg_io_hdr>())).dxfer_len as *const _ as usize },
        12usize,
        concat!(
            "Offset of field: ",
            stringify!(sg_io_hdr),
            "::",
            stringify!(dxfer_len)
        )
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<sg_io_hdr>())).dxferp as *const _ as usize },
        16usize,
        concat!(
            "Offset of field: ",
            stringify!(sg_io_hdr),
            "::",
            stringify!(dxferp)
        )
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<sg_io_hdr>())).cmdp as *const _ as usize },
        24usize,
        concat!(
            "Offset of field: ",
            stringify!(sg_io_hdr),
            "::",
            stringify!(cmdp)
        )
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<sg_io_hdr>())).sbp as *const _ as usize },
        32usize,
        concat!(
            "Offset of field: ",
            stringify!(sg_io_hdr),
            "::",
            stringify!(sbp)
        )
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<sg_io_hdr>())).timeout as *const _ as usize },
        40usize,
        concat!(
            "Offset of field: ",
            stringify!(sg_io_hdr),
            "::",
            stringify!(timeout)
        )
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<sg_io_hdr>())).flags as *const _ as usize },
        44usize,
        concat!(
            "Offset of field: ",
            stringify!(sg_io_hdr),
            "::",
            stringify!(flags)
        )
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<sg_io_hdr>())).pack_id as *const _ as usize },
        48usize,
        concat!(
            "Offset of field: ",
            stringify!(sg_io_hdr),
            "::",
            stringify!(pack_id)
        )
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<sg_io_hdr>())).usr_ptr as *const _ as usize },
        56usize,
        concat!(
            "Offset of field: ",
            stringify!(sg_io_hdr),
            "::",
            stringify!(usr_ptr)
        )
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<sg_io_hdr>())).status as *const _ as usize },
        64usize,
        concat!(
            "Offset of field: ",
            stringify!(sg_io_hdr),
            "::",
            stringify!(status)
        )
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<sg_io_hdr>())).masked_status as *const _ as usize },
        65usize,
        concat!(
            "Offset of field: ",
            stringify!(sg_io_hdr),
            "::",
            stringify!(masked_status)
        )
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<sg_io_hdr>())).msg_status as *const _ as usize },
        66usize,
        concat!(
            "Offset of field: ",
            stringify!(sg_io_hdr),
            "::",
            stringify!(msg_status)
        )
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<sg_io_hdr>())).sb_len_wr as *const _ as usize },
        67usize,
        concat!(
            "Offset of field: ",
            stringify!(sg_io_hdr),
            "::",
            stringify!(sb_len_wr)
        )
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<sg_io_hdr>())).host_status as *const _ as usize },
        68usize,
        concat!(
            "Offset of field: ",
            stringify!(sg_io_hdr),
            "::",
            stringify!(host_status)
        )
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<sg_io_hdr>())).driver_status as *const _ as usize },
        70usize,
        concat!(
            "Offset of field: ",
            stringify!(sg_io_hdr),
            "::",
            stringify!(driver_status)
        )
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<sg_io_hdr>())).resid as *const _ as usize },
        72usize,
        concat!(
            "Offset of field: ",
            stringify!(sg_io_hdr),
            "::",
            stringify!(resid)
        )
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<sg_io_hdr>())).duration as *const _ as usize },
        76usize,
        concat!(
            "Offset of field: ",
            stringify!(sg_io_hdr),
            "::",
            stringify!(duration)
        )
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<sg_io_hdr>())).info as *const _ as usize },
        80usize,
        concat!(
            "Offset of field: ",
            stringify!(sg_io_hdr),
            "::",
            stringify!(info)
        )
    );
}
impl Default for sg_io_hdr {
    fn default() -> Self {
        unsafe { ::std::mem::zeroed() }
    }
}
pub type sg_io_hdr_t = sg_io_hdr;
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct sg_scsi_id {
    pub host_no: ::std::os::raw::c_int,
    pub channel: ::std::os::raw::c_int,
    pub scsi_id: ::std::os::raw::c_int,
    pub lun: ::std::os::raw::c_int,
    pub scsi_type: ::std::os::raw::c_int,
    pub h_cmd_per_lun: ::std::os::raw::c_short,
    pub d_queue_depth: ::std::os::raw::c_short,
    pub unused: [::std::os::raw::c_int; 2usize],
}
#[test]
fn bindgen_test_layout_sg_scsi_id() {
    assert_eq!(
        ::std::mem::size_of::<sg_scsi_id>(),
        32usize,
        concat!("Size of: ", stringify!(sg_scsi_id))
    );
    assert_eq!(
        ::std::mem::align_of::<sg_scsi_id>(),
        4usize,
        concat!("Alignment of ", stringify!(sg_scsi_id))
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<sg_scsi_id>())).host_no as *const _ as usize },
        0usize,
        concat!(
            "Offset of field: ",
            stringify!(sg_scsi_id),
            "::",
            stringify!(host_no)
        )
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<sg_scsi_id>())).channel as *const _ as usize },
        4usize,
        concat!(
            "Offset of field: ",
            stringify!(sg_scsi_id),
            "::",
            stringify!(channel)
        )
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<sg_scsi_id>())).scsi_id as *const _ as usize },
        8usize,
        concat!(
            "Offset of field: ",
            stringify!(sg_scsi_id),
            "::",
            stringify!(scsi_id)
        )
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<sg_scsi_id>())).lun as *const _ as usize },
        12usize,
        concat!(
            "Offset of field: ",
            stringify!(sg_scsi_id),
            "::",
            stringify!(lun)
        )
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<sg_scsi_id>())).scsi_type as *const _ as usize },
        16usize,
        concat!(
            "Offset of field: ",
            stringify!(sg_scsi_id),
            "::",
            stringify!(scsi_type)
        )
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<sg_scsi_id>())).h_cmd_per_lun as *const _ as usize },
        20usize,
        concat!(
            "Offset of field: ",
            stringify!(sg_scsi_id),
            "::",
            stringify!(h_cmd_per_lun)
        )
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<sg_scsi_id>())).d_queue_depth as *const _ as usize },
        22usize,
        concat!(
            "Offset of field: ",
            stringify!(sg_scsi_id),
            "::",
            stringify!(d_queue_depth)
        )
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<sg_scsi_id>())).unused as *const _ as usize },
        24usize,
        concat!(
            "Offset of field: ",
            stringify!(sg_scsi_id),
            "::",
            stringify!(unused)
        )
    );
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct sg_req_info {
    pub req_state: ::std::os::raw::c_char,
    pub orphan: ::std::os::raw::c_char,
    pub sg_io_owned: ::std::os::raw::c_char,
    pub problem: ::std::os::raw::c_char,
    pub pack_id: ::std::os::raw::c_int,
    pub usr_ptr: *mut ::std::os::raw::c_void,
    pub duration: ::std::os::raw::c_uint,
    pub unused: ::std::os::raw::c_int,
}
#[test]
fn bindgen_test_layout_sg_req_info() {
    assert_eq!(
        ::std::mem::size_of::<sg_req_info>(),
        24usize,
        concat!("Size of: ", stringify!(sg_req_info))
    );
    assert_eq!(
        ::std::mem::align_of::<sg_req_info>(),
        8usize,
        concat!("Alignment of ", stringify!(sg_req_info))
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<sg_req_info>())).req_state as *const _ as usize },
        0usize,
        concat!(
            "Offset of field: ",
            stringify!(sg_req_info),
            "::",
            stringify!(req_state)
        )
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<sg_req_info>())).orphan as *const _ as usize },
        1usize,
        concat!(
            "Offset of field: ",
            stringify!(sg_req_info),
            "::",
            stringify!(orphan)
        )
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<sg_req_info>())).sg_io_owned as *const _ as usize },
        2usize,
        concat!(
            "Offset of field: ",
            stringify!(sg_req_info),
            "::",
            stringify!(sg_io_owned)
        )
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<sg_req_info>())).problem as *const _ as usize },
        3usize,
        concat!(
            "Offset of field: ",
            stringify!(sg_req_info),
            "::",
            stringify!(problem)
        )
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<sg_req_info>())).pack_id as *const _ as usize },
        4usize,
        concat!(
            "Offset of field: ",
            stringify!(sg_req_info),
            "::",
            stringify!(pack_id)
        )
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<sg_req_info>())).usr_ptr as *const _ as usize },
        8usize,
        concat!(
            "Offset of field: ",
            stringify!(sg_req_info),
            "::",
            stringify!(usr_ptr)
        )
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<sg_req_info>())).duration as *const _ as usize },
        16usize,
        concat!(
            "Offset of field: ",
            stringify!(sg_req_info),
            "::",
            stringify!(duration)
        )
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<sg_req_info>())).unused as *const _ as usize },
        20usize,
        concat!(
            "Offset of field: ",
            stringify!(sg_req_info),
            "::",
            stringify!(unused)
        )
    );
}
impl Default for sg_req_info {
    fn default() -> Self {
        unsafe { ::std::mem::zeroed() }
    }
}
pub type sg_req_info_t = sg_req_info;
pub type Sg_io_hdr = sg_io_hdr;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct sg_io_vec {
    _unused: [u8; 0],
}
pub type Sg_io_vec = sg_io_vec;
pub type Sg_scsi_id = sg_scsi_id;
pub type Sg_req_info = sg_req_info;
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct sg_header {
    pub pack_len: ::std::os::raw::c_int,
    pub reply_len: ::std::os::raw::c_int,
    pub pack_id: ::std::os::raw::c_int,
    pub result: ::std::os::raw::c_int,
    pub _bitfield_1: __BindgenBitfieldUnit<[u8; 4usize], u16>,
    pub sense_buffer: [::std::os::raw::c_uchar; 16usize],
}
#[test]
fn bindgen_test_layout_sg_header() {
    assert_eq!(
        ::std::mem::size_of::<sg_header>(),
        36usize,
        concat!("Size of: ", stringify!(sg_header))
    );
    assert_eq!(
        ::std::mem::align_of::<sg_header>(),
        4usize,
        concat!("Alignment of ", stringify!(sg_header))
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<sg_header>())).pack_len as *const _ as usize },
        0usize,
        concat!(
            "Offset of field: ",
            stringify!(sg_header),
            "::",
            stringify!(pack_len)
        )
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<sg_header>())).reply_len as *const _ as usize },
        4usize,
        concat!(
            "Offset of field: ",
            stringify!(sg_header),
            "::",
            stringify!(reply_len)
        )
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<sg_header>())).pack_id as *const _ as usize },
        8usize,
        concat!(
            "Offset of field: ",
            stringify!(sg_header),
            "::",
            stringify!(pack_id)
        )
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<sg_header>())).result as *const _ as usize },
        12usize,
        concat!(
            "Offset of field: ",
            stringify!(sg_header),
            "::",
            stringify!(result)
        )
    );
    assert_eq!(
        unsafe { &(*(::std::ptr::null::<sg_header>())).sense_buffer as *const _ as usize },
        20usize,
        concat!(
            "Offset of field: ",
            stringify!(sg_header),
            "::",
            stringify!(sense_buffer)
        )
    );
}
impl sg_header {
    #[inline]
    pub fn twelve_byte(&self) -> ::std::os::raw::c_uint {
        unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u32) }
    }
    #[inline]
    pub fn set_twelve_byte(&mut self, val: ::std::os::raw::c_uint) {
        unsafe {
            let val: u32 = ::std::mem::transmute(val);
            self._bitfield_1.set(0usize, 1u8, val as u64)
        }
    }
    #[inline]
    pub fn target_status(&self) -> ::std::os::raw::c_uint {
        unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 5u8) as u32) }
    }
    #[inline]
    pub fn set_target_status(&mut self, val: ::std::os::raw::c_uint) {
        unsafe {
            let val: u32 = ::std::mem::transmute(val);
            self._bitfield_1.set(1usize, 5u8, val as u64)
        }
    }
    #[inline]
    pub fn host_status(&self) -> ::std::os::raw::c_uint {
        unsafe { ::std::mem::transmute(self._bitfield_1.get(6usize, 8u8) as u32) }
    }
    #[inline]
    pub fn set_host_status(&mut self, val: ::std::os::raw::c_uint) {
        unsafe {
            let val: u32 = ::std::mem::transmute(val);
            self._bitfield_1.set(6usize, 8u8, val as u64)
        }
    }
    #[inline]
    pub fn driver_status(&self) -> ::std::os::raw::c_uint {
        unsafe { ::std::mem::transmute(self._bitfield_1.get(14usize, 8u8) as u32) }
    }
    #[inline]
    pub fn set_driver_status(&mut self, val: ::std::os::raw::c_uint) {
        unsafe {
            let val: u32 = ::std::mem::transmute(val);
            self._bitfield_1.set(14usize, 8u8, val as u64)
        }
    }
    #[inline]
    pub fn other_flags(&self) -> ::std::os::raw::c_uint {
        unsafe { ::std::mem::transmute(self._bitfield_1.get(22usize, 10u8) as u32) }
    }
    #[inline]
    pub fn set_other_flags(&mut self, val: ::std::os::raw::c_uint) {
        unsafe {
            let val: u32 = ::std::mem::transmute(val);
            self._bitfield_1.set(22usize, 10u8, val as u64)
        }
    }
    #[inline]
    pub fn new_bitfield_1(
        twelve_byte: ::std::os::raw::c_uint,
        target_status: ::std::os::raw::c_uint,
        host_status: ::std::os::raw::c_uint,
        driver_status: ::std::os::raw::c_uint,
        other_flags: ::std::os::raw::c_uint,
    ) -> __BindgenBitfieldUnit<[u8; 4usize], u16> {
        let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 4usize], u16> =
            Default::default();
        __bindgen_bitfield_unit.set(0usize, 1u8, {
            let twelve_byte: u32 = unsafe { ::std::mem::transmute(twelve_byte) };
            twelve_byte as u64
        });
        __bindgen_bitfield_unit.set(1usize, 5u8, {
            let target_status: u32 = unsafe { ::std::mem::transmute(target_status) };
            target_status as u64
        });
        __bindgen_bitfield_unit.set(6usize, 8u8, {
            let host_status: u32 = unsafe { ::std::mem::transmute(host_status) };
            host_status as u64
        });
        __bindgen_bitfield_unit.set(14usize, 8u8, {
            let driver_status: u32 = unsafe { ::std::mem::transmute(driver_status) };
            driver_status as u64
        });
        __bindgen_bitfield_unit.set(22usize, 10u8, {
            let other_flags: u32 = unsafe { ::std::mem::transmute(other_flags) };
            other_flags as u64
        });
        __bindgen_bitfield_unit
    }
}