On 8/15/18, 1:52 PM, "[email protected] on behalf of Ben Pfaff" 
<[email protected] on behalf of [email protected]> wrote:

    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]);
     }


cool; thanks Ben
     
     /* Open a dpif with an optional name argument.
    _______________________________________________
    dev mailing list
    [email protected]
    
https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmail.openvswitch.org%2Fmailman%2Flistinfo%2Fovs-dev&amp;data=02%7C01%7Cdball%40vmware.com%7C9cb84e244708465e9ad608d602f10d3f%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C1%7C0%7C636699631682655681&amp;sdata=c%2F1x1O6rnqbNIU3HjIAoeyBtlyeegw4GfRVkYonJ7Vs%3D&amp;reserved=0
    

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to