提交 d8a62d95 编写于 作者: D Daniel P. Berrange

Turn two int parameters into bools in bridge APIs

* src/util/bridge.c, src/util/bridge.h: s/int/bool/ in
  virNetDevSetOnline and virNetDevBridgeSetSTP
上级 dced27c8
......@@ -1727,7 +1727,7 @@ networkStartNetworkVirtual(struct network_driver *driver,
goto err1;
if (virNetDevBridgeSetSTP(network->def->bridge,
network->def->stp ? 1 : 0) < 0)
network->def->stp ? true : false) < 0)
goto err1;
/* Disable IPv6 on the bridge if there are no IPv6 addresses
......
......@@ -605,14 +605,14 @@ cleanup:
/**
* virNetDevSetOnline:
* @ifname: the interface name
* @up: 1 for up, 0 for down
* @online: true for up, false for down
*
* Function to control if an interface is activated (up, 1) or not (down, 0)
* Function to control if an interface is activated (up, true) or not (down, false)
*
* Returns 0 in case of success or -1 on error.
*/
int virNetDevSetOnline(const char *ifname,
int up)
bool online)
{
int fd = -1;
int ret = -1;
......@@ -629,7 +629,7 @@ int virNetDevSetOnline(const char *ifname,
goto cleanup;
}
if (up)
if (online)
ifflags = ifr.ifr_flags | IFF_UP;
else
ifflags = ifr.ifr_flags & ~IFF_UP;
......@@ -654,14 +654,14 @@ cleanup:
/**
* virNetDevIsOnline:
* @ifname: the interface name
* @up: where to store the status
* @online: where to store the status
*
* Function to query if an interface is activated (1) or not (0)
* Function to query if an interface is activated (true) or not (false)
*
* Returns 0 in case of success or an errno code in case of failure.
*/
int virNetDevIsOnline(const char *ifname,
int *up)
bool *online)
{
int fd = -1;
int ret = -1;
......@@ -677,7 +677,7 @@ int virNetDevIsOnline(const char *ifname,
goto cleanup;
}
*up = (ifr.ifr_flags & IFF_UP) ? 1 : 0;
*online = (ifr.ifr_flags & IFF_UP) ? true : false;
ret = 0;
cleanup:
......@@ -809,7 +809,7 @@ cleanup:
* Returns 0 in case of success or -1 on failure
*/
int virNetDevBridgeSetSTP(const char *brname,
int enable)
bool enable)
{
virCommandPtr cmd;
int ret = -1;
......
......@@ -76,10 +76,10 @@ int virNetDevTapDelete(const char *ifname)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
int virNetDevSetOnline(const char *ifname,
int up)
bool online)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
int virNetDevIsOnline(const char *ifname,
int *up)
bool *online)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
int virNetDevSetIPv4Address(const char *ifname,
......@@ -98,10 +98,10 @@ int virNetDevBridgeGetSTPDelay(const char *brname,
int *delay)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
int virNetDevBridgeSetSTP(const char *brname,
int enable)
bool enable)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
int virNetDevBridgeGetSTP(const char *brname,
int *enable)
bool *enable)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
int virNetDevTapCreate(char **ifname,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册