[libvirt] [PATCH 04/33] Turn two int parameters into bools in bridge APIs

Stefan Berger stefanb at linux.vnet.ibm.com
Tue Nov 8 14:21:19 UTC 2011


On 11/03/2011 01:30 PM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange"<berrange at redhat.com>
>
> * src/util/bridge.c, src/util/bridge.h: s/int/bool/ in
>    virNetDevSetOnline and virNetDevBridgeSetSTP
> ---
>   src/util/bridge.c |   18 +++++++++---------
>   src/util/bridge.h |    8 ++++----
>   2 files changed, 13 insertions(+), 13 deletions(-)
>
> diff --git a/src/util/bridge.c b/src/util/bridge.c
> index a853c2a..1584052 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 44b6631..2de7259 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 virNetDevSetIPv4Addres(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,
Hm, would have thought to see the callers being changed as well...





More information about the libvir-list mailing list