ethtool-util.c revision 5fde13d748749f0e06e2e6cdd15f0980a79ea82c
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
/***
This file is part of systemd.
Copyright (C) 2013 Tom Gundersen <teg@jklm.no>
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include "ethtool-util.h"
#include "strxcpyx.h"
#include "util.h"
#include "log.h"
#include "conf-parser.h"
static const char* const duplex_table[] = {
[DUP_FULL] = "full",
[DUP_HALF] = "half"
};
static const char* const wol_table[] = {
[WOL_PHY] = "phy",
[WOL_MAGIC] = "magic",
[WOL_OFF] = "off"
};
int ethtool_connect(int *ret) {
int fd;
if (fd < 0) {
return -errno;
}
return 0;
}
{
struct ethtool_cmd ecmd;
bool need_update;
int r;
return 0;
if (r < 0)
return -errno;
need_update = true;
}
switch (duplex) {
case DUP_HALF:
need_update = true;
}
break;
case DUP_FULL:
need_update = true;
}
break;
default:
break;
}
if (need_update) {
if (r < 0)
return -errno;
}
return 0;
}
struct ethtool_wolinfo ecmd;
bool need_update;
int r;
if (wol == _WOL_INVALID)
return 0;
if (r < 0)
return -errno;
switch (wol) {
case WOL_PHY:
need_update = true;
}
break;
case WOL_MAGIC:
need_update = true;
}
break;
case WOL_OFF:
need_update = true;
}
break;
default:
break;
}
if (need_update) {
if (r < 0)
return -errno;
}
return 0;
}