diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2020-01-08 11:55:07 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2020-01-08 11:55:07 +0100 |
commit | 64be35ab02c6f9c70355bd1ace9ffbc4c3fa901f (patch) | |
tree | cd55b5de249687dd1ef9baa2c464e096cd7d59c3 /src/shared/ethtool-util.c | |
parent | d9b204544b69e344bc5a6177c1b10bf7b8109aad (diff) | |
download | systemd-64be35ab02c6f9c70355bd1ace9ffbc4c3fa901f.tar.gz |
network: rename *fd to *ethtool_fd
Diffstat (limited to 'src/shared/ethtool-util.c')
-rw-r--r-- | src/shared/ethtool-util.c | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/src/shared/ethtool-util.c b/src/shared/ethtool-util.c index e10948d612..e00ed8e97d 100644 --- a/src/shared/ethtool-util.c +++ b/src/shared/ethtool-util.c @@ -145,7 +145,7 @@ static int ethtool_connect_or_warn(int *ret, bool warn) { return 0; } -int ethtool_get_driver(int *fd, const char *ifname, char **ret) { +int ethtool_get_driver(int *ethtool_fd, const char *ifname, char **ret) { struct ethtool_drvinfo ecmd = { .cmd = ETHTOOL_GDRVINFO }; @@ -155,15 +155,15 @@ int ethtool_get_driver(int *fd, const char *ifname, char **ret) { char *d; int r; - if (*fd < 0) { - r = ethtool_connect_or_warn(fd, true); + if (*ethtool_fd < 0) { + r = ethtool_connect_or_warn(ethtool_fd, true); if (r < 0) return r; } strscpy(ifr.ifr_name, IFNAMSIZ, ifname); - r = ioctl(*fd, SIOCETHTOOL, &ifr); + r = ioctl(*ethtool_fd, SIOCETHTOOL, &ifr); if (r < 0) return -errno; @@ -175,7 +175,7 @@ int ethtool_get_driver(int *fd, const char *ifname, char **ret) { return 0; } -int ethtool_get_link_info(int *fd, const char *ifname, +int ethtool_get_link_info(int *ethtool_fd, const char *ifname, int *ret_autonegotiation, size_t *ret_speed, Duplex *ret_duplex, NetDevPort *ret_port) { struct ethtool_cmd ecmd = { @@ -186,15 +186,15 @@ int ethtool_get_link_info(int *fd, const char *ifname, }; int r; - if (*fd < 0) { - r = ethtool_connect_or_warn(fd, false); + if (*ethtool_fd < 0) { + r = ethtool_connect_or_warn(ethtool_fd, false); if (r < 0) return r; } strscpy(ifr.ifr_name, IFNAMSIZ, ifname); - r = ioctl(*fd, SIOCETHTOOL, &ifr); + r = ioctl(*ethtool_fd, SIOCETHTOOL, &ifr); if (r < 0) return -errno; @@ -218,17 +218,17 @@ int ethtool_get_link_info(int *fd, const char *ifname, return 0; } -int ethtool_get_permanent_macaddr(int *fd, const char *ifname, struct ether_addr *ret) { +int ethtool_get_permanent_macaddr(int *ethtool_fd, const char *ifname, struct ether_addr *ret) { _cleanup_free_ struct ethtool_perm_addr *epaddr = NULL; struct ifreq ifr; int r; - assert(fd); + assert(ethtool_fd); assert(ifname); assert(ret); - if (*fd < 0) { - r = ethtool_connect_or_warn(fd, false); + if (*ethtool_fd < 0) { + r = ethtool_connect_or_warn(ethtool_fd, false); if (r < 0) return r; } @@ -245,7 +245,7 @@ int ethtool_get_permanent_macaddr(int *fd, const char *ifname, struct ether_addr }; strscpy(ifr.ifr_name, IFNAMSIZ, ifname); - r = ioctl(*fd, SIOCETHTOOL, &ifr); + r = ioctl(*ethtool_fd, SIOCETHTOOL, &ifr); if (r < 0) return -errno; @@ -258,7 +258,7 @@ int ethtool_get_permanent_macaddr(int *fd, const char *ifname, struct ether_addr return 0; } -int ethtool_set_speed(int *fd, const char *ifname, unsigned speed, Duplex duplex) { +int ethtool_set_speed(int *ethtool_fd, const char *ifname, unsigned speed, Duplex duplex) { struct ethtool_cmd ecmd = { .cmd = ETHTOOL_GSET }; @@ -271,15 +271,15 @@ int ethtool_set_speed(int *fd, const char *ifname, unsigned speed, Duplex duplex if (speed == 0 && duplex == _DUP_INVALID) return 0; - if (*fd < 0) { - r = ethtool_connect_or_warn(fd, true); + if (*ethtool_fd < 0) { + r = ethtool_connect_or_warn(ethtool_fd, true); if (r < 0) return r; } strscpy(ifr.ifr_name, IFNAMSIZ, ifname); - r = ioctl(*fd, SIOCETHTOOL, &ifr); + r = ioctl(*ethtool_fd, SIOCETHTOOL, &ifr); if (r < 0) return -errno; @@ -308,7 +308,7 @@ int ethtool_set_speed(int *fd, const char *ifname, unsigned speed, Duplex duplex if (need_update) { ecmd.cmd = ETHTOOL_SSET; - r = ioctl(*fd, SIOCETHTOOL, &ifr); + r = ioctl(*ethtool_fd, SIOCETHTOOL, &ifr); if (r < 0) return -errno; } @@ -316,7 +316,7 @@ int ethtool_set_speed(int *fd, const char *ifname, unsigned speed, Duplex duplex return 0; } -int ethtool_set_wol(int *fd, const char *ifname, WakeOnLan wol) { +int ethtool_set_wol(int *ethtool_fd, const char *ifname, WakeOnLan wol) { struct ethtool_wolinfo ecmd = { .cmd = ETHTOOL_GWOL }; @@ -329,15 +329,15 @@ int ethtool_set_wol(int *fd, const char *ifname, WakeOnLan wol) { if (wol == _WOL_INVALID) return 0; - if (*fd < 0) { - r = ethtool_connect_or_warn(fd, true); + if (*ethtool_fd < 0) { + r = ethtool_connect_or_warn(ethtool_fd, true); if (r < 0) return r; } strscpy(ifr.ifr_name, IFNAMSIZ, ifname); - r = ioctl(*fd, SIOCETHTOOL, &ifr); + r = ioctl(*ethtool_fd, SIOCETHTOOL, &ifr); if (r < 0) return -errno; @@ -397,7 +397,7 @@ int ethtool_set_wol(int *fd, const char *ifname, WakeOnLan wol) { if (need_update) { ecmd.cmd = ETHTOOL_SWOL; - r = ioctl(*fd, SIOCETHTOOL, &ifr); + r = ioctl(*ethtool_fd, SIOCETHTOOL, &ifr); if (r < 0) return -errno; } @@ -405,7 +405,7 @@ int ethtool_set_wol(int *fd, const char *ifname, WakeOnLan wol) { return 0; } -int ethtool_set_nic_buffer_size(int *fd, const char *ifname, netdev_ring_param *ring) { +int ethtool_set_nic_buffer_size(int *ethtool_fd, const char *ifname, netdev_ring_param *ring) { struct ethtool_ringparam ecmd = { .cmd = ETHTOOL_GRINGPARAM }; @@ -415,15 +415,15 @@ int ethtool_set_nic_buffer_size(int *fd, const char *ifname, netdev_ring_param * bool need_update = false; int r; - if (*fd < 0) { - r = ethtool_connect_or_warn(fd, true); + if (*ethtool_fd < 0) { + r = ethtool_connect_or_warn(ethtool_fd, true); if (r < 0) return r; } strscpy(ifr.ifr_name, IFNAMSIZ, ifname); - r = ioctl(*fd, SIOCETHTOOL, &ifr); + r = ioctl(*ethtool_fd, SIOCETHTOOL, &ifr); if (r < 0) return -errno; @@ -444,7 +444,7 @@ int ethtool_set_nic_buffer_size(int *fd, const char *ifname, netdev_ring_param * if (need_update) { ecmd.cmd = ETHTOOL_SRINGPARAM; - r = ioctl(*fd, SIOCETHTOOL, &ifr); + r = ioctl(*ethtool_fd, SIOCETHTOOL, &ifr); if (r < 0) return -errno; } @@ -452,7 +452,7 @@ int ethtool_set_nic_buffer_size(int *fd, const char *ifname, netdev_ring_param * return 0; } -static int get_stringset(int fd, struct ifreq *ifr, int stringset_id, struct ethtool_gstrings **gstrings) { +static int get_stringset(int ethtool_fd, struct ifreq *ifr, int stringset_id, struct ethtool_gstrings **gstrings) { _cleanup_free_ struct ethtool_gstrings *strings = NULL; struct { struct ethtool_sset_info info; @@ -468,7 +468,7 @@ static int get_stringset(int fd, struct ifreq *ifr, int stringset_id, struct eth ifr->ifr_data = (void *) &buffer.info; - r = ioctl(fd, SIOCETHTOOL, ifr); + r = ioctl(ethtool_fd, SIOCETHTOOL, ifr); if (r < 0) return -errno; @@ -487,7 +487,7 @@ static int get_stringset(int fd, struct ifreq *ifr, int stringset_id, struct eth ifr->ifr_data = (void *) strings; - r = ioctl(fd, SIOCETHTOOL, ifr); + r = ioctl(ethtool_fd, SIOCETHTOOL, ifr); if (r < 0) return -errno; @@ -507,21 +507,21 @@ static int find_feature_index(struct ethtool_gstrings *strings, const char *feat return -ENODATA; } -int ethtool_set_features(int *fd, const char *ifname, int *features) { +int ethtool_set_features(int *ethtool_fd, const char *ifname, int *features) { _cleanup_free_ struct ethtool_gstrings *strings = NULL; struct ethtool_sfeatures *sfeatures; int block, bit, i, r; struct ifreq ifr = {}; - if (*fd < 0) { - r = ethtool_connect_or_warn(fd, true); + if (*ethtool_fd < 0) { + r = ethtool_connect_or_warn(ethtool_fd, true); if (r < 0) return r; } strscpy(ifr.ifr_name, IFNAMSIZ, ifname); - r = get_stringset(*fd, &ifr, ETH_SS_FEATURES, &strings); + r = get_stringset(*ethtool_fd, &ifr, ETH_SS_FEATURES, &strings); if (r < 0) return log_warning_errno(r, "ethtool: could not get ethtool features for %s", ifname); @@ -553,7 +553,7 @@ int ethtool_set_features(int *fd, const char *ifname, int *features) { ifr.ifr_data = (void *) sfeatures; - r = ioctl(*fd, SIOCETHTOOL, &ifr); + r = ioctl(*ethtool_fd, SIOCETHTOOL, &ifr); if (r < 0) return log_warning_errno(r, "ethtool: could not set ethtool features for %s", ifname); |