From 0bea5896cce2489529f0b6dced59ceec3822ddee Mon Sep 17 00:00:00 2001 From: Yann Dirson Date: Wed, 27 Sep 2023 14:30:38 +0200 Subject: [PATCH] freebsd: move net/if_mib.h contents to separate namespace 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 (rust-lang/libc#3194). Signed-off-by: Yann Dirson --- src/unix/bsd/freebsdlike/freebsd/ifmib.rs | 44 ++++++++++++++++++++++ src/unix/bsd/freebsdlike/freebsd/mod.rs | 46 +---------------------- 2 files changed, 46 insertions(+), 44 deletions(-) create mode 100644 src/unix/bsd/freebsdlike/freebsd/ifmib.rs diff --git a/src/unix/bsd/freebsdlike/freebsd/ifmib.rs b/src/unix/bsd/freebsdlike/freebsd/ifmib.rs new file mode 100644 index 0000000000000..0297e1bc9a0b7 --- /dev/null +++ b/src/unix/bsd/freebsdlike/freebsd/ifmib.rs @@ -0,0 +1,44 @@ +// sys/net/if_mib.h + +/// non-interface-specific +pub const IFMIB_SYSTEM: ::c_int = 1; +/// per-interface data table +pub const IFMIB_IFDATA: ::c_int = 2; + +/// generic stats for all kinds of ifaces +pub const IFDATA_GENERAL: ::c_int = 1; +/// specific to the type of interface +pub const IFDATA_LINKSPECIFIC: ::c_int = 2; +/// driver name and unit +pub const IFDATA_DRIVERNAME: ::c_int = 3; + +/// number of interfaces configured +pub const IFMIB_IFCOUNT: ::c_int = 1; + +/// functions not specific to a type of iface +pub const NETLINK_GENERIC: ::c_int = 0; + +pub const DOT3COMPLIANCE_STATS: ::c_int = 1; +pub const DOT3COMPLIANCE_COLLS: ::c_int = 2; + +pub const dot3ChipSetAMD7990: ::c_int = 1; +pub const dot3ChipSetAMD79900: ::c_int = 2; +pub const dot3ChipSetAMD79C940: ::c_int = 3; + +pub const dot3ChipSetIntel82586: ::c_int = 1; +pub const dot3ChipSetIntel82596: ::c_int = 2; +pub const dot3ChipSetIntel82557: ::c_int = 3; + +pub const dot3ChipSetNational8390: ::c_int = 1; +pub const dot3ChipSetNationalSonic: ::c_int = 2; + +pub const dot3ChipSetFujitsu86950: ::c_int = 1; + +pub const dot3ChipSetDigitalDC21040: ::c_int = 1; +pub const dot3ChipSetDigitalDC21140: ::c_int = 2; +pub const dot3ChipSetDigitalDC21041: ::c_int = 3; +pub const dot3ChipSetDigitalDC21140A: ::c_int = 4; +pub const dot3ChipSetDigitalDC21142: ::c_int = 5; + +pub const dot3ChipSetWesternDigital83C690: ::c_int = 1; +pub const dot3ChipSetWesternDigital83C790: ::c_int = 2; diff --git a/src/unix/bsd/freebsdlike/freebsd/mod.rs b/src/unix/bsd/freebsdlike/freebsd/mod.rs index d737e86891ef9..e5ac7ef2dfde6 100644 --- a/src/unix/bsd/freebsdlike/freebsd/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/mod.rs @@ -3328,50 +3328,8 @@ pub const IFDR_REASON_MSG: ::c_int = 1; pub const IFDR_REASON_VENDOR: ::c_int = 2; // sys/net/if_mib.h - -/// non-interface-specific -pub const IFMIB_SYSTEM: ::c_int = 1; -/// per-interface data table -pub const IFMIB_IFDATA: ::c_int = 2; - -/// generic stats for all kinds of ifaces -pub const IFDATA_GENERAL: ::c_int = 1; -/// specific to the type of interface -pub const IFDATA_LINKSPECIFIC: ::c_int = 2; -/// driver name and unit -pub const IFDATA_DRIVERNAME: ::c_int = 3; - -/// number of interfaces configured -pub const IFMIB_IFCOUNT: ::c_int = 1; - -/// functions not specific to a type of iface -pub const NETLINK_GENERIC: ::c_int = 0; - -pub const DOT3COMPLIANCE_STATS: ::c_int = 1; -pub const DOT3COMPLIANCE_COLLS: ::c_int = 2; - -pub const dot3ChipSetAMD7990: ::c_int = 1; -pub const dot3ChipSetAMD79900: ::c_int = 2; -pub const dot3ChipSetAMD79C940: ::c_int = 3; - -pub const dot3ChipSetIntel82586: ::c_int = 1; -pub const dot3ChipSetIntel82596: ::c_int = 2; -pub const dot3ChipSetIntel82557: ::c_int = 3; - -pub const dot3ChipSetNational8390: ::c_int = 1; -pub const dot3ChipSetNationalSonic: ::c_int = 2; - -pub const dot3ChipSetFujitsu86950: ::c_int = 1; - -pub const dot3ChipSetDigitalDC21040: ::c_int = 1; -pub const dot3ChipSetDigitalDC21140: ::c_int = 2; -pub const dot3ChipSetDigitalDC21041: ::c_int = 3; -pub const dot3ChipSetDigitalDC21140A: ::c_int = 4; -pub const dot3ChipSetDigitalDC21142: ::c_int = 5; - -pub const dot3ChipSetWesternDigital83C690: ::c_int = 1; -pub const dot3ChipSetWesternDigital83C790: ::c_int = 2; - +pub mod ifmib; + // sys/netinet/in.h // Protocols (RFC 1700) // NOTE: These are in addition to the constants defined in src/unix/mod.rs