diff mbox

[ovs-dev,1/3] dpif-netlink-rtnl: Tidy up some code.

Message ID 20170519202736.5685-2-joe@ovn.org
State Accepted
Headers show

Commit Message

Joe Stringer May 19, 2017, 8:27 p.m. UTC
Simplify and refactor a couple of bits of code for improved readability.

Signed-off-by: Joe Stringer <joe@ovn.org>
---
 lib/dpif-netlink-rtnl.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

Comments

Gregory Rose May 19, 2017, 10:47 p.m. UTC | #1
On Fri, 2017-05-19 at 13:27 -0700, Joe Stringer wrote:
> Simplify and refactor a couple of bits of code for improved readability.
> 
> Signed-off-by: Joe Stringer <joe@ovn.org>
> ---
>  lib/dpif-netlink-rtnl.c | 20 ++++++++++----------
>  1 file changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/lib/dpif-netlink-rtnl.c b/lib/dpif-netlink-rtnl.c
> index 7faad5248037..0ca6529e9d82 100644
> --- a/lib/dpif-netlink-rtnl.c
> +++ b/lib/dpif-netlink-rtnl.c
> @@ -1,5 +1,6 @@
>  /*
>   * Copyright (c) 2017 Red Hat, Inc.
> + * Copyright (c) 2017 Nicira, Inc.

???

The patch itself looks fine but changing a copyright seems strange.

- Greg

>   *
>   * Licensed under the Apache License, Version 2.0 (the "License");
>   * you may not use this file except in compliance with the License.
> @@ -369,17 +370,16 @@ dpif_netlink_rtnl_port_create(struct netdev *netdev)
>          err = dpif_netlink_rtnl_verify(tnl_cfg, type, name);
>          if (!err) {
>              return 0;
> -        } else {
> -            err = dpif_netlink_rtnl_destroy(name);
> -            if (err) {
> -                static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5);
> -
> -                VLOG_WARN_RL(&rl, "RTNL device %s exists and cannot be "
> -                             "deleted: %s", name, ovs_strerror(err));
> -                return err;
> -            }
> -            err = dpif_netlink_rtnl_create(tnl_cfg, name, type, kind, flags);
>          }
> +        err = dpif_netlink_rtnl_destroy(name);
> +        if (err) {
> +            static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5);
> +
> +            VLOG_WARN_RL(&rl, "RTNL device %s exists and cannot be "
> +                         "deleted: %s", name, ovs_strerror(err));
> +            return err;
> +        }
> +        err = dpif_netlink_rtnl_create(tnl_cfg, name, type, kind, flags);
>      }
>      if (err) {
>          return err;
Eric Garver May 22, 2017, 5:36 p.m. UTC | #2
On Fri, May 19, 2017 at 01:27:34PM -0700, Joe Stringer wrote:
> Simplify and refactor a couple of bits of code for improved readability.
> 
> Signed-off-by: Joe Stringer <joe@ovn.org>
> ---
>  lib/dpif-netlink-rtnl.c | 20 ++++++++++----------
>  1 file changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/lib/dpif-netlink-rtnl.c b/lib/dpif-netlink-rtnl.c
> index 7faad5248037..0ca6529e9d82 100644
> --- a/lib/dpif-netlink-rtnl.c
> +++ b/lib/dpif-netlink-rtnl.c
> @@ -1,5 +1,6 @@
>  /*
>   * Copyright (c) 2017 Red Hat, Inc.
> + * Copyright (c) 2017 Nicira, Inc.
>   *
>   * Licensed under the Apache License, Version 2.0 (the "License");
>   * you may not use this file except in compliance with the License.
> @@ -369,17 +370,16 @@ dpif_netlink_rtnl_port_create(struct netdev *netdev)
>          err = dpif_netlink_rtnl_verify(tnl_cfg, type, name);
>          if (!err) {
>              return 0;
> -        } else {
> -            err = dpif_netlink_rtnl_destroy(name);
> -            if (err) {
> -                static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5);
> -
> -                VLOG_WARN_RL(&rl, "RTNL device %s exists and cannot be "
> -                             "deleted: %s", name, ovs_strerror(err));
> -                return err;
> -            }
> -            err = dpif_netlink_rtnl_create(tnl_cfg, name, type, kind, flags);
>          }
> +        err = dpif_netlink_rtnl_destroy(name);
> +        if (err) {
> +            static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5);
> +
> +            VLOG_WARN_RL(&rl, "RTNL device %s exists and cannot be "
> +                         "deleted: %s", name, ovs_strerror(err));
> +            return err;
> +        }
> +        err = dpif_netlink_rtnl_create(tnl_cfg, name, type, kind, flags);
>      }
>      if (err) {
>          return err;
> -- 
> 2.11.1
> 

Acked-by: Eric Garver <e@erig.me>
Joe Stringer May 22, 2017, 11:51 p.m. UTC | #3
On 19 May 2017 at 15:47, Greg Rose <gvrose8192@gmail.com> wrote:
> On Fri, 2017-05-19 at 13:27 -0700, Joe Stringer wrote:
>> Simplify and refactor a couple of bits of code for improved readability.
>>
>> Signed-off-by: Joe Stringer <joe@ovn.org>
>> ---
>>  lib/dpif-netlink-rtnl.c | 20 ++++++++++----------
>>  1 file changed, 10 insertions(+), 10 deletions(-)
>>
>> diff --git a/lib/dpif-netlink-rtnl.c b/lib/dpif-netlink-rtnl.c
>> index 7faad5248037..0ca6529e9d82 100644
>> --- a/lib/dpif-netlink-rtnl.c
>> +++ b/lib/dpif-netlink-rtnl.c
>> @@ -1,5 +1,6 @@
>>  /*
>>   * Copyright (c) 2017 Red Hat, Inc.
>> + * Copyright (c) 2017 Nicira, Inc.
>
> ???
>
> The patch itself looks fine but changing a copyright seems strange.

Thanks for the reviews.

While reviewing the earlier revisions of the series, I collected a
bunch of changes, some that I submitted as suggestions which ended up
folded into the merged series, and some which I figured I could just
submit later so that we didn't have to keep going back and forth on
the series. Looks like this hunk was brought in when I rebased my
changes.

Fair enough though, there's nothing particularly interesting about
this particular patch that would warrant this. I can skip it.

- Joe
Joe Stringer May 23, 2017, 10:45 p.m. UTC | #4
On 22 May 2017 at 10:36, Eric Garver <e@erig.me> wrote:
> On Fri, May 19, 2017 at 01:27:34PM -0700, Joe Stringer wrote:
>> Simplify and refactor a couple of bits of code for improved readability.
>>
>> Signed-off-by: Joe Stringer <joe@ovn.org>
>> ---
>>  lib/dpif-netlink-rtnl.c | 20 ++++++++++----------
>>  1 file changed, 10 insertions(+), 10 deletions(-)
>>
>> diff --git a/lib/dpif-netlink-rtnl.c b/lib/dpif-netlink-rtnl.c
>> index 7faad5248037..0ca6529e9d82 100644
>> --- a/lib/dpif-netlink-rtnl.c
>> +++ b/lib/dpif-netlink-rtnl.c
>> @@ -1,5 +1,6 @@
>>  /*
>>   * Copyright (c) 2017 Red Hat, Inc.
>> + * Copyright (c) 2017 Nicira, Inc.
>>   *
>>   * Licensed under the Apache License, Version 2.0 (the "License");
>>   * you may not use this file except in compliance with the License.
>> @@ -369,17 +370,16 @@ dpif_netlink_rtnl_port_create(struct netdev *netdev)
>>          err = dpif_netlink_rtnl_verify(tnl_cfg, type, name);
>>          if (!err) {
>>              return 0;
>> -        } else {
>> -            err = dpif_netlink_rtnl_destroy(name);
>> -            if (err) {
>> -                static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5);
>> -
>> -                VLOG_WARN_RL(&rl, "RTNL device %s exists and cannot be "
>> -                             "deleted: %s", name, ovs_strerror(err));
>> -                return err;
>> -            }
>> -            err = dpif_netlink_rtnl_create(tnl_cfg, name, type, kind, flags);
>>          }
>> +        err = dpif_netlink_rtnl_destroy(name);
>> +        if (err) {
>> +            static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5);
>> +
>> +            VLOG_WARN_RL(&rl, "RTNL device %s exists and cannot be "
>> +                         "deleted: %s", name, ovs_strerror(err));
>> +            return err;
>> +        }
>> +        err = dpif_netlink_rtnl_create(tnl_cfg, name, type, kind, flags);
>>      }
>>      if (err) {
>>          return err;
>> --
>> 2.11.1
>>
>
> Acked-by: Eric Garver <e@erig.me>

Thanks, applied to master.
diff mbox

Patch

diff --git a/lib/dpif-netlink-rtnl.c b/lib/dpif-netlink-rtnl.c
index 7faad5248037..0ca6529e9d82 100644
--- a/lib/dpif-netlink-rtnl.c
+++ b/lib/dpif-netlink-rtnl.c
@@ -1,5 +1,6 @@ 
 /*
  * Copyright (c) 2017 Red Hat, Inc.
+ * Copyright (c) 2017 Nicira, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -369,17 +370,16 @@  dpif_netlink_rtnl_port_create(struct netdev *netdev)
         err = dpif_netlink_rtnl_verify(tnl_cfg, type, name);
         if (!err) {
             return 0;
-        } else {
-            err = dpif_netlink_rtnl_destroy(name);
-            if (err) {
-                static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5);
-
-                VLOG_WARN_RL(&rl, "RTNL device %s exists and cannot be "
-                             "deleted: %s", name, ovs_strerror(err));
-                return err;
-            }
-            err = dpif_netlink_rtnl_create(tnl_cfg, name, type, kind, flags);
         }
+        err = dpif_netlink_rtnl_destroy(name);
+        if (err) {
+            static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5);
+
+            VLOG_WARN_RL(&rl, "RTNL device %s exists and cannot be "
+                         "deleted: %s", name, ovs_strerror(err));
+            return err;
+        }
+        err = dpif_netlink_rtnl_create(tnl_cfg, name, type, kind, flags);
     }
     if (err) {
         return err;