diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index da2c690d7b6c61d649d90c75e61c5957514cb53d..db65ffeeecaac34bc0dc69543c52e6a2c95ae33c 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -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 diff --git a/src/util/bridge.c b/src/util/bridge.c index be7524bee12a8d4550a8965bc20fc9e1ae7698f0..3d3ce0ed636fb6b149dd68972b1af9969ed76232 100644 --- a/src/util/bridge.c +++ b/src/util/bridge.c @@ -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; diff --git a/src/util/bridge.h b/src/util/bridge.h index 488a08cb270225d200b20e21bdeaf1135e9504b2..c4e8d3f6d9bf0a657ffcdbdc03528210cfe636a3 100644 --- a/src/util/bridge.h +++ b/src/util/bridge.h @@ -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,