On Fri, Aug 10, 2018 at 08:56:17AM -0700, Darrell Ball wrote:
> By making opt_dpif_open() more general, it can be used effectively
> by all potential callers and avoids trying to open potentially bogus
> datapaths provided by the user. Also, the error handling is improved by
> reducing bogus errors and having more specific real errors.
> 
> Signed-off-by: Darrell Ball <[email protected]>

Thanks.  I folded in the following simplifications and applied this to
master.



diff --git a/lib/dpctl.c b/lib/dpctl.c
index 594497473c49..c228dc10c2e3 100644
--- a/lib/dpctl.c
+++ b/lib/dpctl.c
@@ -195,13 +195,10 @@ dp_exists(const char *queried_dp)
     struct sset dpif_names = SSET_INITIALIZER(&dpif_names),
                 dpif_types = SSET_INITIALIZER(&dpif_types);
     dp_enumerate_types(&dpif_types);
-    bool found = false;
 
-    if (sset_contains(&dpif_types, queried_type) &&
-        !dp_enumerate_names(queried_type, &dpif_names) &&
-        sset_contains(&dpif_names, queried_name)) {
-        found = true;
-    }
+    bool found = (sset_contains(&dpif_types, queried_type) &&
+                  !dp_enumerate_names(queried_type, &dpif_names) &&
+                  sset_contains(&dpif_names, queried_name));
 
     sset_destroy(&dpif_names);
     sset_destroy(&dpif_types);
@@ -211,10 +208,7 @@ dp_exists(const char *queried_dp)
 static bool
 dp_arg_exists(int argc, const char *argv[])
 {
-    if (argc > 1 && dp_exists(argv[1])) {
-        return true;
-    }
-    return false;
+    return argc > 1 && dp_exists(argv[1]);
 }
 
 /* Open a dpif with an optional name argument.
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to