Skip to content

Commit 476635a

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". ctest as of 0.22 cannot be told a given header's symbols live in a submodule, so let the tests ignore all of them. Signed-off-by: Yann Dirson <[email protected]>
1 parent 3d0b15b commit 476635a

File tree

3 files changed

+74
-45
lines changed

3 files changed

+74
-45
lines changed

libc-test/build.rs

+27
Original file line numberDiff line numberDiff line change
@@ -2432,6 +2432,33 @@ fn test_freebsd(target: &str) {
24322432
// FIXME: Removed in FreeBSD 15:
24332433
"LOCAL_CONNWAIT" => true,
24342434

2435+
// submodule ifmib, cannot be checked today
2436+
"DOT3COMPLIANCE_STATS"
2437+
| "DOT3COMPLIANCE_COLLS"
2438+
| "IFDATA_GENERAL"
2439+
| "IFDATA_LINKSPECIFIC"
2440+
| "IFDATA_DRIVERNAME"
2441+
| "IFMIB_IFCOUNT"
2442+
| "IFMIB_IFDATA"
2443+
| "IFMIB_SYSTEM"
2444+
| "NETLINK_GENERIC"
2445+
| "dot3ChipSetAMD7990"
2446+
| "dot3ChipSetAMD79900"
2447+
| "dot3ChipSetAMD79C940"
2448+
| "dot3ChipSetIntel82586"
2449+
| "dot3ChipSetIntel82596"
2450+
| "dot3ChipSetIntel82557"
2451+
| "dot3ChipSetNational8390"
2452+
| "dot3ChipSetNationalSonic"
2453+
| "dot3ChipSetFujitsu86950"
2454+
| "dot3ChipSetDigitalDC21040"
2455+
| "dot3ChipSetDigitalDC21140"
2456+
| "dot3ChipSetDigitalDC21041"
2457+
| "dot3ChipSetDigitalDC21140A"
2458+
| "dot3ChipSetDigitalDC21142"
2459+
| "dot3ChipSetWesternDigital83C690"
2460+
| "dot3ChipSetWesternDigital83C790" => true,
2461+
24352462
_ => false,
24362463
}
24372464
});
+44
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

+3-45
Original file line numberDiff line numberDiff line change
@@ -3289,51 +3289,6 @@ pub const IFDR_MSG_SIZE: ::c_int = 64;
32893289
pub const IFDR_REASON_MSG: ::c_int = 1;
32903290
pub const IFDR_REASON_VENDOR: ::c_int = 2;
32913291

3292-
// sys/net/if_mib.h
3293-
3294-
/// non-interface-specific
3295-
pub const IFMIB_SYSTEM: ::c_int = 1;
3296-
/// per-interface data table
3297-
pub const IFMIB_IFDATA: ::c_int = 2;
3298-
3299-
/// generic stats for all kinds of ifaces
3300-
pub const IFDATA_GENERAL: ::c_int = 1;
3301-
/// specific to the type of interface
3302-
pub const IFDATA_LINKSPECIFIC: ::c_int = 2;
3303-
/// driver name and unit
3304-
pub const IFDATA_DRIVERNAME: ::c_int = 3;
3305-
3306-
/// number of interfaces configured
3307-
pub const IFMIB_IFCOUNT: ::c_int = 1;
3308-
3309-
/// functions not specific to a type of iface
3310-
pub const NETLINK_GENERIC: ::c_int = 0;
3311-
3312-
pub const DOT3COMPLIANCE_STATS: ::c_int = 1;
3313-
pub const DOT3COMPLIANCE_COLLS: ::c_int = 2;
3314-
3315-
pub const dot3ChipSetAMD7990: ::c_int = 1;
3316-
pub const dot3ChipSetAMD79900: ::c_int = 2;
3317-
pub const dot3ChipSetAMD79C940: ::c_int = 3;
3318-
3319-
pub const dot3ChipSetIntel82586: ::c_int = 1;
3320-
pub const dot3ChipSetIntel82596: ::c_int = 2;
3321-
pub const dot3ChipSetIntel82557: ::c_int = 3;
3322-
3323-
pub const dot3ChipSetNational8390: ::c_int = 1;
3324-
pub const dot3ChipSetNationalSonic: ::c_int = 2;
3325-
3326-
pub const dot3ChipSetFujitsu86950: ::c_int = 1;
3327-
3328-
pub const dot3ChipSetDigitalDC21040: ::c_int = 1;
3329-
pub const dot3ChipSetDigitalDC21140: ::c_int = 2;
3330-
pub const dot3ChipSetDigitalDC21041: ::c_int = 3;
3331-
pub const dot3ChipSetDigitalDC21140A: ::c_int = 4;
3332-
pub const dot3ChipSetDigitalDC21142: ::c_int = 5;
3333-
3334-
pub const dot3ChipSetWesternDigital83C690: ::c_int = 1;
3335-
pub const dot3ChipSetWesternDigital83C790: ::c_int = 2;
3336-
33373292
// sys/netinet/in.h
33383293
// Protocols (RFC 1700)
33393294
// NOTE: These are in addition to the constants defined in src/unix/mod.rs
@@ -5678,3 +5633,6 @@ cfg_if! {
56785633
// Unknown target_arch
56795634
}
56805635
}
5636+
5637+
// sys/net/if_mib.h
5638+
pub mod ifmib;

0 commit comments

Comments
 (0)