Skip to content

Commit

Permalink
ethtool: use libc::c_char instead of i8 (#8214)
Browse files Browse the repository at this point in the history
Summary: Pull Request resolved: #8214

Reviewed By: dschatzberg

Differential Revision: D51910582

fbshipit-source-id: c19dd467d753671fe42b5a3542c29069e23dc321
  • Loading branch information
brianc118 authored and facebook-github-bot committed Dec 6, 2023
1 parent 3a85501 commit 03879ad
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions below/ethtool/src/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ use crate::errors::EthtoolError;
use crate::ethtool_sys;
const ETH_GSTATS_LEN: usize = 8;

fn if_name_bytes(if_name: &str) -> [i8; libc::IF_NAMESIZE] {
fn if_name_bytes(if_name: &str) -> [libc::c_char; libc::IF_NAMESIZE] {
let mut it = if_name.as_bytes().iter().copied();
[0; libc::IF_NAMESIZE].map(|_| it.next().unwrap_or(0) as libc::c_char)
}

fn ioctl(
fd: &OwnedFd,
if_name: [i8; libc::IF_NAMESIZE],
if_name: [libc::c_char; libc::IF_NAMESIZE],
data: *mut libc::c_char,
) -> Result<(), Errno> {
let ifr = libc::ifreq {
Expand Down Expand Up @@ -256,7 +256,7 @@ pub trait EthtoolReadable {

pub struct Ethtool {
sock_fd: OwnedFd,
if_name: [i8; libc::IF_NAMESIZE],
if_name: [libc::c_char; libc::IF_NAMESIZE],
}

impl Ethtool {
Expand Down

0 comments on commit 03879ad

Please sign in to comment.