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
include!;
/*
XXX bindgen can't currently handle `#define` in the form of `(~(whatever)0)`
see also https://github.com/rust-lang-nursery/rust-bindgen/issues/316
re: `bindgen-freebsd.h`:
- bindgen turns `const …` into `pub static` declaration, which is not what we're looking for,
- no need to `#undef`s anything, we just don't whitelist vars in the `build.rs` (also, `#undef` doesn't seem to work anyways).
*/
// #define CAM_XPT_PATH_ID ((path_id_t)~0)
pub const CAM_XPT_PATH_ID: path_id_t = !0;
// #define CAM_BUS_WILDCARD ((path_id_t)~0)
pub const CAM_BUS_WILDCARD: path_id_t = !0;
// #define CAM_TARGET_WILDCARD ((target_id_t)~0)
pub const CAM_TARGET_WILDCARD: target_id_t = !0;
// #define CAM_LUN_WILDCARD (~(u_int)0)
pub const CAM_LUN_WILDCARD: u_int = !0;
/*
similarly,
/usr/include/cam/scsi/scsi_pass.h
39:#define CAMIOCOMMAND _IOWR(CAM_VERSION, 2, union ccb)
/usr/include/cam/cam_ccb.h
574:#define CAM_VERSION 0x19 /* Hex value for current version */
/usr/include/sys/ioccom.h
61:#define _IOWR(g,n,t) _IOC(IOC_INOUT, (g), (n), sizeof(t))
/usr/include/sys/ioccom.h
51:#define IOC_INOUT (IOC_IN|IOC_OUT)
/usr/include/sys/ioccom.h
49:#define IOC_OUT 0x40000000 /* copy out parameters */
50:#define IOC_IN 0x80000000 /* copy in parameters */
/usr/include/sys/ioccom.h
54:#define _IOC(inout,group,num,len) ((unsigned long) \
55- ((inout) | (((len) & IOCPARM_MASK) << 16) | ((group) << 8) | (num)))
/usr/include/sys/ioccom.h
42:#define IOCPARM_MASK ((1 << IOCPARM_SHIFT) - 1) /* parameter length mask */
/usr/include/sys/ioccom.h
41:#define IOCPARM_SHIFT 13 /* number of bits for ioctl size */
*/
use c_ulong;
use size_of;
const IOCPARM_MASK: c_ulong = ;
const IOC_OUT: c_ulong = 0x40000000;
const IOC_IN: c_ulong = 0x80000000;
pub const CAMIOCOMMAND: c_ulong = IOC_IN | IOC_OUT | | | 2;