@@ -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'.
@@ -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.
*/
@@ -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);
}
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 <amusil@redhat.com> --- lib/ovn-util.c | 20 -------------------- lib/ovn-util.h | 4 ---- northd/northd.c | 6 +++--- 3 files changed, 3 insertions(+), 27 deletions(-)