Skip to content

Commit 39dfa2b

Browse files
authored
refactor: cfg for mount/* & if_.rs (#2217)
1 parent 8cc58e7 commit 39dfa2b

File tree

3 files changed

+22
-30
lines changed

3 files changed

+22
-30
lines changed

src/mount/bsd.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,7 @@ libc_bitflags!(
6262
MNT_SNAPSHOT;
6363
/// Using soft updates.
6464
#[cfg(any(
65-
target_os = "dragonfly",
66-
target_os = "freebsd",
65+
freebsdlike,
6766
target_os = "netbsd",
6867
target_os = "openbsd"
6968
))]

src/mount/mod.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,15 @@ mod linux;
66
pub use self::linux::*;
77

88
#[cfg(any(
9-
target_os = "dragonfly",
10-
target_os = "freebsd",
9+
freebsdlike,
1110
target_os = "macos",
1211
target_os = "netbsd",
1312
target_os = "openbsd"
1413
))]
1514
mod bsd;
1615

1716
#[cfg(any(
18-
target_os = "dragonfly",
19-
target_os = "freebsd",
17+
freebsdlike,
2018
target_os = "macos",
2119
target_os = "netbsd",
2220
target_os = "openbsd"

src/net/if_.rs

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -40,25 +40,23 @@ libc_bitflags!(
4040
IFF_POINTOPOINT;
4141
/// Avoid use of trailers. (see
4242
/// [`netdevice(7)`](https://man7.org/linux/man-pages/man7/netdevice.7.html))
43-
#[cfg(any(target_os = "android",
44-
target_os = "fuchsia",
43+
#[cfg(any(
44+
linux_android,
45+
solarish,
4546
apple_targets,
46-
target_os = "linux",
47-
target_os = "netbsd",
48-
target_os = "illumos",
49-
target_os = "solaris"))]
47+
target_os = "fuchsia",
48+
target_os = "netbsd"))]
5049
IFF_NOTRAILERS;
5150
/// Interface manages own routes.
5251
#[cfg(any(target_os = "dragonfly"))]
5352
IFF_SMART;
5453
/// Resources allocated. (see
5554
/// [`netdevice(7)`](https://man7.org/linux/man-pages/man7/netdevice.7.html))
56-
#[cfg(any(target_os = "android",
55+
#[cfg(any(
56+
linux_android,
5757
bsd,
58-
target_os = "fuchsia",
59-
target_os = "illumos",
60-
target_os = "linux",
61-
target_os = "solaris"))]
58+
solarish,
59+
target_os = "fuchsia"))]
6260
IFF_RUNNING;
6361
/// No arp protocol, L2 destination address not set. (see
6462
/// [`netdevice(7)`](https://man7.org/linux/man-pages/man7/netdevice.7.html))
@@ -71,7 +69,7 @@ libc_bitflags!(
7169
IFF_ALLMULTI;
7270
/// Master of a load balancing bundle. (see
7371
/// [`netdevice(7)`](https://man7.org/linux/man-pages/man7/netdevice.7.html))
74-
#[cfg(any(target_os = "android", target_os = "fuchsia", target_os = "linux"))]
72+
#[cfg(any(linux_android, target_os = "fuchsia"))]
7573
IFF_MASTER;
7674
/// transmission in progress, tx hardware queue is full
7775
#[cfg(any(target_os = "freebsd",
@@ -84,11 +82,10 @@ libc_bitflags!(
8482
IFF_INTELLIGENT;
8583
/// Slave of a load balancing bundle. (see
8684
/// [`netdevice(7)`](https://man7.org/linux/man-pages/man7/netdevice.7.html))
87-
#[cfg(any(target_os = "android", target_os = "fuchsia", target_os = "linux"))]
85+
#[cfg(any(linux_android, target_os = "fuchsia"))]
8886
IFF_SLAVE;
8987
/// Can't hear own transmissions.
90-
#[cfg(any(target_os = "dragonfly",
91-
target_os = "freebsd",
88+
#[cfg(any(freebsdlike,
9289
target_os = "macos",
9390
target_os = "netbsd",
9491
target_os = "openbsd"))]
@@ -104,7 +101,7 @@ libc_bitflags!(
104101
IFF_MULTI_BCAST;
105102
/// Is able to select media type via ifmap. (see
106103
/// [`netdevice(7)`](https://man7.org/linux/man-pages/man7/netdevice.7.html))
107-
#[cfg(any(target_os = "android", target_os = "fuchsia", target_os = "linux"))]
104+
#[cfg(any(linux_android, target_os = "fuchsia"))]
108105
IFF_PORTSEL;
109106
/// Per link layer defined bit.
110107
#[cfg(bsd)]
@@ -114,22 +111,20 @@ libc_bitflags!(
114111
IFF_UNNUMBERED;
115112
/// Auto media selection active. (see
116113
/// [`netdevice(7)`](https://man7.org/linux/man-pages/man7/netdevice.7.html))
117-
#[cfg(any(target_os = "android", target_os = "fuchsia", target_os = "linux"))]
114+
#[cfg(any(linux_android, target_os = "fuchsia"))]
118115
IFF_AUTOMEDIA;
119116
/// Per link layer defined bit.
120117
#[cfg(bsd)]
121118
IFF_LINK2;
122119
/// Use alternate physical connection.
123-
#[cfg(any(target_os = "dragonfly",
124-
target_os = "freebsd",
125-
apple_targets,))]
120+
#[cfg(any(freebsdlike, apple_targets))]
126121
IFF_ALTPHYS;
127122
/// DHCP controls interface.
128123
#[cfg(solarish)]
129124
IFF_DHCPRUNNING;
130125
/// The addresses are lost when the interface goes down. (see
131126
/// [`netdevice(7)`](https://man7.org/linux/man-pages/man7/netdevice.7.html))
132-
#[cfg(any(target_os = "android", target_os = "fuchsia", target_os = "linux"))]
127+
#[cfg(any(linux_android, target_os = "fuchsia"))]
133128
IFF_DYNAMIC;
134129
/// Do not advertise.
135130
#[cfg(solarish)]
@@ -195,13 +190,13 @@ libc_bitflags!(
195190
#[cfg(solarish)]
196191
IFF_NORTEXCH;
197192
/// Do not provide packet information
198-
#[cfg(any(target_os = "android", target_os = "fuchsia", target_os = "linux"))]
193+
#[cfg(any(linux_android, target_os = "fuchsia"))]
199194
IFF_NO_PI as libc::c_int;
200195
/// TUN device (no Ethernet headers)
201-
#[cfg(any(target_os = "android", target_os = "fuchsia", target_os = "linux"))]
196+
#[cfg(any(linux_android, target_os = "fuchsia"))]
202197
IFF_TUN as libc::c_int;
203198
/// TAP device
204-
#[cfg(any(target_os = "android", target_os = "fuchsia", target_os = "linux"))]
199+
#[cfg(any(linux_android, target_os = "fuchsia"))]
205200
IFF_TAP as libc::c_int;
206201
/// IPv4 interface.
207202
#[cfg(solarish)]

0 commit comments

Comments
 (0)