Replace and remove the ovn_smap_get_uint as smap_get_uint is avaiable in OvS
library since 7b2e999fd759 ("smap: Add smap_get_uint() helper function.").Signed-off-by: Ales Musil <[email protected]> --- lib/ovn-util.c | 20 -------------------- lib/ovn-util.h | 4 ---- northd/northd.c | 6 +++--- 3 files changed, 3 insertions(+), 27 deletions(-) diff --git a/lib/ovn-util.c b/lib/ovn-util.c index 6ef9cac7f..882e67f93 100644 --- a/lib/ovn-util.c +++ b/lib/ovn-util.c @@ -815,26 +815,6 @@ str_tolower(const char *orig) return copy; } -/* This is a wrapper function which get the value associated with 'key' in - * 'smap' and converts it to an unsigned int. If 'key' is not in 'smap' or a - * valid unsigned integer can't be parsed from it's value, returns 'def'. - * - * Note: Remove this function once OpenvSwitch library (lib/smap.h) has this - * helper function. - */ -unsigned int -ovn_smap_get_uint(const struct smap *smap, const char *key, unsigned int def) -{ - const char *value = smap_get(smap, key); - unsigned int u_value; - - if (!value || !str_to_uint(value, 10, &u_value)) { - return def; - } - - return u_value; -} - /* For a 'key' of the form "IP:port" or just "IP", sets 'port', * 'ip_address' and 'ip' ('struct in6_addr' IPv6 or IPv4 mapped address). * The caller must free() the memory allocated for 'ip_address'. diff --git a/lib/ovn-util.h b/lib/ovn-util.h index aa0b3b2fb..2afff0d07 100644 --- a/lib/ovn-util.h +++ b/lib/ovn-util.h @@ -206,10 +206,6 @@ char *normalize_ipv4_prefix(ovs_be32 ipv4, unsigned int plen); char *normalize_ipv6_prefix(const struct in6_addr *ipv6, unsigned int plen); char *normalize_v46_prefix(const struct in6_addr *prefix, unsigned int plen); -/* Temporary util function until ovs library has smap_get_unit. */ -unsigned int ovn_smap_get_uint(const struct smap *smap, const char *key, - unsigned int def); - /* Returns a lowercase copy of orig. * Caller must free the returned string. */ diff --git a/northd/northd.c b/northd/northd.c index 952f8200d..5f2d3d0ea 100644 --- a/northd/northd.c +++ b/northd/northd.c @@ -10915,7 +10915,7 @@ build_routing_policy_flow(struct hmap *lflows, struct ovn_datapath *od, rule->priority, nexthop); return; } - uint32_t pkt_mark = ovn_smap_get_uint(&rule->options, "pkt_mark", 0); + uint32_t pkt_mark = smap_get_uint(&rule->options, "pkt_mark", 0); if (pkt_mark) { ds_put_format(&actions, "pkt.mark = %u; ", pkt_mark); } @@ -10938,7 +10938,7 @@ build_routing_policy_flow(struct hmap *lflows, struct ovn_datapath *od, } else if (!strcmp(rule->action, "drop")) { ds_put_cstr(&actions, debug_drop_action()); } else if (!strcmp(rule->action, "allow")) { - uint32_t pkt_mark = ovn_smap_get_uint(&rule->options, "pkt_mark", 0); + uint32_t pkt_mark = smap_get_uint(&rule->options, "pkt_mark", 0); if (pkt_mark) { ds_put_format(&actions, "pkt.mark = %u; ", pkt_mark); } @@ -11002,7 +11002,7 @@ build_ecmp_routing_policy_flows(struct hmap *lflows, struct ovn_datapath *od, } ds_clear(&actions); - uint32_t pkt_mark = ovn_smap_get_uint(&rule->options, "pkt_mark", 0); + uint32_t pkt_mark = smap_get_uint(&rule->options, "pkt_mark", 0); if (pkt_mark) { ds_put_format(&actions, "pkt.mark = %u; ", pkt_mark); } -- 2.43.0 _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
