dp_initialize();
- if (!type || *type == '\0') {
- type = "system";
- }
+ type = dpif_normalize_type(type);
registered_class = shash_find_data(&dpif_classes, type);
if (!registered_class) {
return dpif->base_name;
}
+/* Returns the fully spelled out name for the given datapath 'type'.
+ *
+ * Normalized type string can be compared with strcmp(). Unnormalized type
+ * string might be the same even if they have different spellings. */
+const char *
+dpif_normalize_type(const char *type)
+{
+ return type && type[0] ? type : "system";
+}
+
/* Destroys the datapath that 'dpif' is connected to, first removing all of its
* ports. After calling this function, it does not make sense to pass 'dpif'
* to any functions other than dpif_name() or dpif_close(). */
const char *dpif_name(const struct dpif *);
const char *dpif_base_name(const struct dpif *);
+const char *dpif_normalize_type(const char *);
+
int dpif_delete(struct dpif *);
int dpif_get_dp_stats(const struct dpif *, struct odp_stats *);