+/* Closes and frees the connection to 'dpif'. Does not destroy the datapath
+ * itself; call dpif_delete() first, instead, if that is desirable. */
+void
+dpif_close(struct dpif *dpif)
+{
+ if (dpif) {
+ struct registered_dpif_class *registered_class;
+
+ registered_class = shash_find_data(&dpif_classes,
+ dpif->dpif_class->type);
+ assert(registered_class);
+ assert(registered_class->refcount);
+
+ registered_class->refcount--;
+ dpif_uninit(dpif, true);
+ }
+}
+
+/* Returns the name of datapath 'dpif' prefixed with the type
+ * (for use in log messages). */
+const char *
+dpif_name(const struct dpif *dpif)
+{
+ return dpif->full_name;
+}
+
+/* Returns the name of datapath 'dpif' without the type
+ * (for use in device names). */
+const char *
+dpif_base_name(const struct dpif *dpif)
+{
+ return dpif->base_name;
+}
+
+/* Enumerates all names that may be used to open 'dpif' into 'all_names'. The
+ * Linux datapath, for example, supports opening a datapath both by number,
+ * e.g. "dp0", and by the name of the datapath's local port. For some
+ * datapaths, this might be an infinite set (e.g. in a file name, slashes may
+ * be duplicated any number of times), in which case only the names most likely
+ * to be used will be enumerated.
+ *
+ * The caller must already have initialized 'all_names'. Any existing names in
+ * 'all_names' will not be disturbed. */