diff options
author | Zach Reizner <zachr@google.com> | 2017-08-30 17:07:01 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-09-01 12:39:18 -0700 |
commit | 3cbded2c51574bfdefe8d26a9c6ff235c7330b59 (patch) | |
tree | 6e891f47d965e42c47c254094b17b6813ca8dd09 /net_util | |
parent | 86fb9567b588a11ed1f7ed2e3223c25fad07cc6f (diff) | |
download | crosvm-3cbded2c51574bfdefe8d26a9c6ff235c7330b59.tar crosvm-3cbded2c51574bfdefe8d26a9c6ff235c7330b59.tar.gz crosvm-3cbded2c51574bfdefe8d26a9c6ff235c7330b59.tar.bz2 crosvm-3cbded2c51574bfdefe8d26a9c6ff235c7330b59.tar.lz crosvm-3cbded2c51574bfdefe8d26a9c6ff235c7330b59.tar.xz crosvm-3cbded2c51574bfdefe8d26a9c6ff235c7330b59.tar.zst crosvm-3cbded2c51574bfdefe8d26a9c6ff235c7330b59.zip |
fix armv7a and aarch64 build errors and warnings
BUG=None TEST=cargo build --target=armv7a-cros-linux-gnueabi && cargo build --target=aarch64-cros-linux-gnu Change-Id: I954c152f3c8086e24c4809dd5aabb5043fdd63af Reviewed-on: https://chromium-review.googlesource.com/644408 Commit-Ready: Zach Reizner <zachr@chromium.org> Tested-by: Zach Reizner <zachr@chromium.org> Reviewed-by: Jason Clinton <jclinton@chromium.org> Reviewed-by: Stephen Barber <smbarber@chromium.org> Reviewed-by: Dylan Reid <dgreid@chromium.org>
Diffstat (limited to 'net_util')
-rw-r--r-- | net_util/src/lib.rs | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/net_util/src/lib.rs b/net_util/src/lib.rs index 41ca236..5a8fda8 100644 --- a/net_util/src/lib.rs +++ b/net_util/src/lib.rs @@ -72,7 +72,7 @@ impl Tap { // Open calls are safe because we give a constant nul-terminated // string and verify the result. let fd = unsafe { - libc::open(b"/dev/net/tun\0".as_ptr() as *const i8, + libc::open(b"/dev/net/tun\0".as_ptr() as *const c_char, libc::O_RDWR | libc::O_NONBLOCK | libc::O_CLOEXEC) }; if fd < 0 { @@ -93,9 +93,8 @@ impl Tap { let ifru_flags = ifreq.ifr_ifru.ifru_flags.as_mut(); let mut name_slice = &mut ifrn_name[..TUNTAP_DEV_FORMAT.len()]; name_slice.copy_from_slice(TUNTAP_DEV_FORMAT); - *ifru_flags = (net_sys::IFF_TAP | - net_sys::IFF_NO_PI | - net_sys::IFF_VNET_HDR) as c_short; + *ifru_flags = (net_sys::IFF_TAP | net_sys::IFF_NO_PI | net_sys::IFF_VNET_HDR) as + c_short; } // ioctl is safe since we call it with a valid tap fd and check the return @@ -107,9 +106,9 @@ impl Tap { // Safe since only the name is accessed, and it's cloned out. Ok(Tap { - tap_file: tuntap, - if_name: unsafe { ifreq.ifr_ifrn.ifrn_name.as_ref().clone() }, - }) + tap_file: tuntap, + if_name: unsafe { ifreq.ifr_ifrn.ifrn_name.as_ref().clone() }, + }) } /// Set the host-side IP address for the tap interface. @@ -126,7 +125,8 @@ impl Tap { } // ioctl is safe. Called with a valid sock fd, and we check the return. - let ret = unsafe { ioctl_with_ref(&sock, net_sys::sockios::SIOCSIFADDR as u64, &ifreq) }; + let ret = + unsafe { ioctl_with_ref(&sock, net_sys::sockios::SIOCSIFADDR as c_ulong, &ifreq) }; if ret < 0 { return Err(Error::IoctlError(sys_util::Error::last())); } @@ -148,7 +148,8 @@ impl Tap { } // ioctl is safe. Called with a valid sock fd, and we check the return. - let ret = unsafe { ioctl_with_ref(&sock, net_sys::sockios::SIOCSIFNETMASK as u64, &ifreq) }; + let ret = + unsafe { ioctl_with_ref(&sock, net_sys::sockios::SIOCSIFNETMASK as c_ulong, &ifreq) }; if ret < 0 { return Err(Error::IoctlError(sys_util::Error::last())); } @@ -159,7 +160,8 @@ impl Tap { /// Set the offload flags for the tap interface. pub fn set_offload(&self, flags: c_uint) -> Result<()> { // ioctl is safe. Called with a valid tap fd, and we check the return. - let ret = unsafe { ioctl_with_val(&self.tap_file, net_sys::TUNSETOFFLOAD(), flags as u64) }; + let ret = + unsafe { ioctl_with_val(&self.tap_file, net_sys::TUNSETOFFLOAD(), flags as c_ulong) }; if ret < 0 { return Err(Error::IoctlError(sys_util::Error::last())); } @@ -181,7 +183,8 @@ impl Tap { } // ioctl is safe. Called with a valid sock fd, and we check the return. - let ret = unsafe { ioctl_with_ref(&sock, net_sys::sockios::SIOCSIFFLAGS as u64, &ifreq) }; + let ret = + unsafe { ioctl_with_ref(&sock, net_sys::sockios::SIOCSIFFLAGS as c_ulong, &ifreq) }; if ret < 0 { return Err(Error::IoctlError(sys_util::Error::last())); } |