11//! Linux-specific definitions for linux-like values
22
3+ use core:: mem;
4+
35pub type useconds_t = u32 ;
46pub type dev_t = u64 ;
57pub type socklen_t = u32 ;
422424 pub direction: :: __u16,
423425 pub trigger: ff_trigger,
424426 pub replay: ff_replay,
425- // FIXME this is actually a union
427+ // FIXME(1.0) this is actually a union
426428 #[ cfg( target_pointer_width = "64" ) ]
427429 pub u: [ u64 ; 4 ] ,
428430 #[ cfg( target_pointer_width = "32" ) ]
@@ -930,33 +932,39 @@ s! {
930932 pub disabled: __u8,
931933 pub flags: __u16,
932934 }
935+
933936 pub struct iw_point {
934937 pub pointer: * mut :: c_void,
935938 pub length: __u16,
936939 pub flags: __u16,
937940 }
941+
938942 pub struct iw_freq {
939943 pub m: __s32,
940944 pub e: __s16,
941945 pub i: __u8,
942946 pub flags: __u8,
943947 }
948+
944949 pub struct iw_quality {
945950 pub qual: __u8,
946951 pub level: __u8,
947952 pub noise: __u8,
948953 pub updated: __u8,
949954 }
955+
950956 pub struct iw_discarded {
951957 pub nwid: __u32,
952958 pub code: __u32,
953959 pub fragment: __u32,
954960 pub retries: __u32,
955961 pubmisc: __u32,
956962 }
963+
957964 pub struct iw_missed {
958965 pub beacon: __u32,
959966 }
967+
960968 pub struct iw_scan_req {
961969 pub scan_type: __u8,
962970 pub essid_len: __u8,
968976 pub max_channel_time: __u32,
969977 pub channel_list: [ iw_freq; IW_MAX_FREQUENCIES ] ,
970978 }
979+
971980 pub struct iw_encode_ext {
972981 pub ext_flags: __u32,
973982 pub tx_seq: [ __u8; IW_ENCODE_SEQ_MAX_SIZE ] ,
@@ -977,22 +986,26 @@ s! {
977986 pub key_len: __u16,
978987 pub key: [ __u8; 0 ] ,
979988 }
989+
980990 pub struct iw_pmksa {
981991 pub cmd: __u32,
982992 pub bssid: :: sockaddr,
983993 pub pmkid: [ __u8; IW_PMKID_LEN ] ,
984994 }
995+
985996 pub struct iw_pmkid_cand {
986997 pub flags: __u32,
987998 pub index: __u32,
988999 pub bssid: :: sockaddr,
9891000 }
1001+
9901002 pub struct iw_statistics {
9911003 pub status: __u16,
9921004 pub qual: iw_quality,
9931005 pub discard: iw_discarded,
9941006 pub miss: iw_missed,
9951007 }
1008+
9961009 pub struct iw_range {
9971010 pub throughput: __u32,
9981011 pub min_nwid: __u32,
@@ -1038,6 +1051,7 @@ s! {
10381051 pub freq: [ iw_freq; IW_MAX_FREQUENCIES ] ,
10391052 pub enc_capa: __u32,
10401053 }
1054+
10411055 pub struct iw_priv_args {
10421056 pub cmd: __u32,
10431057 pub set_args: __u16,
@@ -1127,16 +1141,19 @@ cfg_if! {
11271141 pub low: iw_quality,
11281142 pub high: iw_quality,
11291143 }
1144+
11301145 pub struct iw_mlme {
11311146 pub cmd: __u16,
11321147 pub reason_code: __u16,
11331148 pub addr: :: sockaddr,
11341149 }
1150+
11351151 pub struct iw_michaelmicfailure {
11361152 pub flags: __u32,
11371153 pub src_addr: :: sockaddr,
11381154 pub tsc: [ __u8; IW_ENCODE_SEQ_MAX_SIZE ] ,
11391155 }
1156+
11401157 pub struct __c_anonymous_elf32_rela {
11411158 pub r_offset: Elf32_Addr ,
11421159 pub r_info: Elf32_Word ,
@@ -1251,7 +1268,10 @@ s_no_extra_traits! {
12511268 pub ifcu_req: * mut :: ifreq,
12521269 }
12531270
1271+ /// Structure used in SIOCGIFCONF request. Used to retrieve interface configuration for
1272+ /// machine (useful for programs which must know all networks accessible).
12541273 pub struct ifconf {
1274+ /// Size of buffer
12551275 pub ifc_len: :: c_int,
12561276 pub ifc_ifcu: __c_anonymous_ifc_ifcu,
12571277 }
@@ -1400,6 +1420,13 @@ s_no_extra_traits! {
14001420 size: [ u8 ; :: __SIZEOF_PTHREAD_BARRIER_T] ,
14011421 }
14021422
1423+ // linux/net_tstamp.h
1424+ #[ allow( missing_debug_implementations) ]
1425+ pub struct sock_txtime {
1426+ pub clockid: :: clockid_t,
1427+ pub flags: :: __u32,
1428+ }
1429+
14031430 // linux/can.h
14041431 #[ repr( align( 8 ) ) ]
14051432 #[ allow( missing_debug_implementations) ]
@@ -1433,19 +1460,7 @@ s_no_extra_traits! {
14331460 pub af: u32 ,
14341461 pub data: [ u8 ; CANXL_MAX_DLEN ] ,
14351462 }
1436- }
1437-
1438- s_no_extra_traits ! {
1439- // linux/net_tstamp.h
1440- #[ allow( missing_debug_implementations) ]
1441- pub struct sock_txtime {
1442- pub clockid: :: clockid_t,
1443- pub flags: :: __u32,
1444- }
1445- }
14461463
1447- s_no_extra_traits ! {
1448- // linux/can.h
14491464 #[ allow( missing_debug_implementations) ]
14501465 pub union __c_anonymous_sockaddr_can_can_addr {
14511466 pub tp: __c_anonymous_sockaddr_can_tp,
@@ -1458,9 +1473,7 @@ s_no_extra_traits! {
14581473 pub can_ifindex: :: c_int,
14591474 pub can_addr: __c_anonymous_sockaddr_can_can_addr,
14601475 }
1461- }
14621476
1463- s_no_extra_traits ! {
14641477 // linux/wireless.h
14651478 pub union iwreq_data {
14661479 pub name: [ c_char; :: IFNAMSIZ ] ,
@@ -3518,15 +3531,15 @@ pub const TP_STATUS_TS_SYS_HARDWARE: ::__u32 = 1 << 30;
35183531pub const TP_STATUS_TS_RAW_HARDWARE : :: __u32 = 1 << 31 ;
35193532
35203533pub const TPACKET_ALIGNMENT : usize = 16 ;
3521- pub const TPACKET_HDRLEN : usize = ( ( core:: mem:: size_of :: < :: tpacket_hdr > ( ) + TPACKET_ALIGNMENT - 1 )
3534+ pub const TPACKET_HDRLEN : usize = ( ( mem:: size_of :: < :: tpacket_hdr > ( ) + TPACKET_ALIGNMENT - 1 )
3535+ & !( TPACKET_ALIGNMENT - 1 ) )
3536+ + mem:: size_of :: < :: sockaddr_ll > ( ) ;
3537+ pub const TPACKET2_HDRLEN : usize = ( ( mem:: size_of :: < :: tpacket2_hdr > ( ) + TPACKET_ALIGNMENT - 1 )
35223538 & !( TPACKET_ALIGNMENT - 1 ) )
3523- + core:: mem:: size_of :: < :: sockaddr_ll > ( ) ;
3524- pub const TPACKET2_HDRLEN : usize =
3525- ( ( core:: mem:: size_of :: < :: tpacket2_hdr > ( ) + TPACKET_ALIGNMENT - 1 ) & !( TPACKET_ALIGNMENT - 1 ) )
3526- + core:: mem:: size_of :: < :: sockaddr_ll > ( ) ;
3527- pub const TPACKET3_HDRLEN : usize =
3528- ( ( core:: mem:: size_of :: < :: tpacket3_hdr > ( ) + TPACKET_ALIGNMENT - 1 ) & !( TPACKET_ALIGNMENT - 1 ) )
3529- + core:: mem:: size_of :: < :: sockaddr_ll > ( ) ;
3539+ + mem:: size_of :: < :: sockaddr_ll > ( ) ;
3540+ pub const TPACKET3_HDRLEN : usize = ( ( mem:: size_of :: < :: tpacket3_hdr > ( ) + TPACKET_ALIGNMENT - 1 )
3541+ & !( TPACKET_ALIGNMENT - 1 ) )
3542+ + mem:: size_of :: < :: sockaddr_ll > ( ) ;
35303543
35313544// linux/netfilter.h
35323545pub const NF_DROP : :: c_int = 0 ;
@@ -5046,7 +5059,7 @@ pub const CANXL_SEC: ::c_int = 0x01;
50465059pub const CAN_MTU : usize = :: mem:: size_of :: < can_frame > ( ) ;
50475060pub const CANFD_MTU : usize = :: mem:: size_of :: < canfd_frame > ( ) ;
50485061pub const CANXL_MTU : usize = :: mem:: size_of :: < canxl_frame > ( ) ;
5049- // FIXME: use `core::mem::offset_of!` once that is available
5062+ // FIXME(offset_of) : use `core::mem::offset_of!` once that is available
50505063// https://github.com/rust-lang/rfcs/pull/3308
50515064// pub const CANXL_HDR_SIZE: usize = core::mem::offset_of!(canxl_frame, data);
50525065pub const CANXL_HDR_SIZE : usize = 12 ;
@@ -5561,7 +5574,6 @@ f! {
55615574 ( x + TPACKET_ALIGNMENT - 1 ) & !( TPACKET_ALIGNMENT - 1 )
55625575 }
55635576
5564-
55655577 pub fn BPF_RVAL ( code: :: __u32) -> :: __u32 {
55665578 code & 0x18
55675579 }
0 commit comments