[ovs-dev] [PATCH] dpif: Don't clear argument in dp_enumerate_types().
Ben Pfaff
blp at nicira.com
Tue Dec 2 18:55:16 UTC 2014
All but one of the callers of dp_enumerate_types() hands it an sset that is
known to be empty. The one exception is the implementation of the
ofproto-provider 'enumerate_types' function in ofproto-dpif. That function
isn't supposed to clear the existing contents of the sset passed in.
Therefore, this commit changes dp_enumerate_types() to not clear the sset
before it adds new members.
The ofproto-provider comment wasn't clear about the desired behavior so
this commit also clarifies that.
Reported-by: Zoltán Balogh <zoltan.balogh at ericsson.com>
Signed-off-by: Ben Pfaff <blp at nicira.com>
---
AUTHORS | 1 +
lib/dpif.c | 5 ++---
ofproto/ofproto-provider.h | 7 ++++---
3 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/AUTHORS b/AUTHORS
index 09540f4..346a75d 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -319,6 +319,7 @@ Yeming Zhao zhaoyeming at gmail.com
Ying Chen yingchen at vmware.com
Yongqiang Liu liuyq7809 at gmail.com
Ziyou Wang ziyouw at vmware.com
+Zoltán Balogh zoltan.balogh at ericsson.com
ankur dwivedi ankurengg2003 at gmail.com
chen zhang 3zhangchen9211 at gmail.com
kk yap yapkke at stanford.edu
diff --git a/lib/dpif.c b/lib/dpif.c
index e39d7cd..b6be485 100644
--- a/lib/dpif.c
+++ b/lib/dpif.c
@@ -225,15 +225,14 @@ dp_blacklist_provider(const char *type)
ovs_mutex_unlock(&dpif_mutex);
}
-/* Clears 'types' and enumerates the types of all currently registered datapath
- * providers into it. The caller must first initialize the sset. */
+/* Adds the types of all currently registered datapath providers to 'types'.
+ * The caller must first initialize the sset. */
void
dp_enumerate_types(struct sset *types)
{
struct shash_node *node;
dp_initialize();
- sset_clear(types);
ovs_mutex_lock(&dpif_mutex);
SHASH_FOR_EACH(node, &dpif_classes) {
diff --git a/ofproto/ofproto-provider.h b/ofproto/ofproto-provider.h
index 0911333..4dc8adb 100644
--- a/ofproto/ofproto-provider.h
+++ b/ofproto/ofproto-provider.h
@@ -629,9 +629,10 @@ struct ofproto_class {
* may choose to remove it all. */
void (*init)(const struct shash *iface_hints);
- /* Enumerates the types of all support ofproto types into 'types'. The
- * caller has already initialized 'types' and other ofproto classes might
- * already have added names to it. */
+ /* Enumerates the types of all supported ofproto types into 'types'. The
+ * caller has already initialized 'types'. The implementation should add
+ * its own types to 'types' but not remove any existing ones, because other
+ * ofproto classes might already have added names to it. */
void (*enumerate_types)(struct sset *types);
/* Enumerates the names of all existing datapath of the specified 'type'
--
1.7.10.4
More information about the dev
mailing list