Skip to content

Commit 2e82a35

Browse files
committed
freebsd: move net/if_mib.h contents to submodule
There is a conflict of NETLINK_GENERIC definitions between net/if_mib.h and netlink/netlink.h. netlink.h is already exported in the crate root for Linux (and those definitions are already used by at least crates neli and netlink-packet-route), and if_mib is not much used yet, so this moves if_mib contents into its own namespace to leave place for netlink support on FreeBSD (#3194). Module definition moved to the end of file to avoid cryptic style.rs error "constant found after module when it belongs before". Signed-off-by: Yann Dirson <[email protected]>
1 parent 9593176 commit 2e82a35

File tree

3 files changed

+73
-46
lines changed

3 files changed

+73
-46
lines changed

libc-test/semver/freebsd.txt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,31 @@ IFF_RUNNING
424424
IFF_SIMPLEX
425425
IFF_STATICARP
426426
IFF_UP
427+
ifmib::DOT3COMPLIANCE_STATS
428+
ifmib::DOT3COMPLIANCE_COLLS
429+
ifmib::IFDATA_GENERAL
430+
ifmib::IFDATA_LINKSPECIFIC
431+
ifmib::IFDATA_DRIVERNAME
432+
ifmib::IFMIB_IFCOUNT
433+
ifmib::IFMIB_IFDATA
434+
ifmib::IFMIB_SYSTEM
435+
ifmib::NETLINK_GENERIC
436+
ifmib::dot3ChipSetAMD7990
437+
ifmib::dot3ChipSetAMD79900
438+
ifmib::dot3ChipSetAMD79C940
439+
ifmib::dot3ChipSetIntel82586
440+
ifmib::dot3ChipSetIntel82596
441+
ifmib::dot3ChipSetIntel82557
442+
ifmib::dot3ChipSetNational8390
443+
ifmib::dot3ChipSetNationalSonic
444+
ifmib::dot3ChipSetFujitsu86950
445+
ifmib::dot3ChipSetDigitalDC21040
446+
ifmib::dot3ChipSetDigitalDC21140
447+
ifmib::dot3ChipSetDigitalDC21041
448+
ifmib::dot3ChipSetDigitalDC21140A
449+
ifmib::dot3ChipSetDigitalDC21142
450+
ifmib::dot3ChipSetWesternDigital83C690
451+
ifmib::dot3ChipSetWesternDigital83C790
427452
IMAXBEL
428453
INIT_PROCESS
429454
IOV_MAX
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// sys/net/if_mib.h
2+
3+
/// non-interface-specific
4+
pub const IFMIB_SYSTEM: ::c_int = 1;
5+
/// per-interface data table
6+
pub const IFMIB_IFDATA: ::c_int = 2;
7+
8+
/// generic stats for all kinds of ifaces
9+
pub const IFDATA_GENERAL: ::c_int = 1;
10+
/// specific to the type of interface
11+
pub const IFDATA_LINKSPECIFIC: ::c_int = 2;
12+
/// driver name and unit
13+
pub const IFDATA_DRIVERNAME: ::c_int = 3;
14+
15+
/// number of interfaces configured
16+
pub const IFMIB_IFCOUNT: ::c_int = 1;
17+
18+
/// functions not specific to a type of iface
19+
pub const NETLINK_GENERIC: ::c_int = 0;
20+
21+
pub const DOT3COMPLIANCE_STATS: ::c_int = 1;
22+
pub const DOT3COMPLIANCE_COLLS: ::c_int = 2;
23+
24+
pub const dot3ChipSetAMD7990: ::c_int = 1;
25+
pub const dot3ChipSetAMD79900: ::c_int = 2;
26+
pub const dot3ChipSetAMD79C940: ::c_int = 3;
27+
28+
pub const dot3ChipSetIntel82586: ::c_int = 1;
29+
pub const dot3ChipSetIntel82596: ::c_int = 2;
30+
pub const dot3ChipSetIntel82557: ::c_int = 3;
31+
32+
pub const dot3ChipSetNational8390: ::c_int = 1;
33+
pub const dot3ChipSetNationalSonic: ::c_int = 2;
34+
35+
pub const dot3ChipSetFujitsu86950: ::c_int = 1;
36+
37+
pub const dot3ChipSetDigitalDC21040: ::c_int = 1;
38+
pub const dot3ChipSetDigitalDC21140: ::c_int = 2;
39+
pub const dot3ChipSetDigitalDC21041: ::c_int = 3;
40+
pub const dot3ChipSetDigitalDC21140A: ::c_int = 4;
41+
pub const dot3ChipSetDigitalDC21142: ::c_int = 5;
42+
43+
pub const dot3ChipSetWesternDigital83C690: ::c_int = 1;
44+
pub const dot3ChipSetWesternDigital83C790: ::c_int = 2;

src/unix/bsd/freebsdlike/freebsd/mod.rs

Lines changed: 4 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -3326,52 +3326,7 @@ pub const IFNET_PCP_NONE: ::c_int = 0xff;
33263326
pub const IFDR_MSG_SIZE: ::c_int = 64;
33273327
pub const IFDR_REASON_MSG: ::c_int = 1;
33283328
pub const IFDR_REASON_VENDOR: ::c_int = 2;
3329-
3330-
// sys/net/if_mib.h
3331-
3332-
/// non-interface-specific
3333-
pub const IFMIB_SYSTEM: ::c_int = 1;
3334-
/// per-interface data table
3335-
pub const IFMIB_IFDATA: ::c_int = 2;
3336-
3337-
/// generic stats for all kinds of ifaces
3338-
pub const IFDATA_GENERAL: ::c_int = 1;
3339-
/// specific to the type of interface
3340-
pub const IFDATA_LINKSPECIFIC: ::c_int = 2;
3341-
/// driver name and unit
3342-
pub const IFDATA_DRIVERNAME: ::c_int = 3;
3343-
3344-
/// number of interfaces configured
3345-
pub const IFMIB_IFCOUNT: ::c_int = 1;
3346-
3347-
/// functions not specific to a type of iface
3348-
pub const NETLINK_GENERIC: ::c_int = 0;
3349-
3350-
pub const DOT3COMPLIANCE_STATS: ::c_int = 1;
3351-
pub const DOT3COMPLIANCE_COLLS: ::c_int = 2;
3352-
3353-
pub const dot3ChipSetAMD7990: ::c_int = 1;
3354-
pub const dot3ChipSetAMD79900: ::c_int = 2;
3355-
pub const dot3ChipSetAMD79C940: ::c_int = 3;
3356-
3357-
pub const dot3ChipSetIntel82586: ::c_int = 1;
3358-
pub const dot3ChipSetIntel82596: ::c_int = 2;
3359-
pub const dot3ChipSetIntel82557: ::c_int = 3;
3360-
3361-
pub const dot3ChipSetNational8390: ::c_int = 1;
3362-
pub const dot3ChipSetNationalSonic: ::c_int = 2;
3363-
3364-
pub const dot3ChipSetFujitsu86950: ::c_int = 1;
3365-
3366-
pub const dot3ChipSetDigitalDC21040: ::c_int = 1;
3367-
pub const dot3ChipSetDigitalDC21140: ::c_int = 2;
3368-
pub const dot3ChipSetDigitalDC21041: ::c_int = 3;
3369-
pub const dot3ChipSetDigitalDC21140A: ::c_int = 4;
3370-
pub const dot3ChipSetDigitalDC21142: ::c_int = 5;
3371-
3372-
pub const dot3ChipSetWesternDigital83C690: ::c_int = 1;
3373-
pub const dot3ChipSetWesternDigital83C790: ::c_int = 2;
3374-
3329+
33753330
// sys/netinet/in.h
33763331
// Protocols (RFC 1700)
33773332
// NOTE: These are in addition to the constants defined in src/unix/mod.rs
@@ -5692,3 +5647,6 @@ cfg_if! {
56925647
// Unknown target_arch
56935648
}
56945649
}
5650+
5651+
// sys/net/if_mib.h
5652+
pub mod ifmib;

0 commit comments

Comments
 (0)