2
0
mirror of https://github.com/openvswitch/ovs synced 2025-09-03 07:45:30 +00:00

dpif: Remove dpif_get_all_names().

None of the remaining dpif implementations have more than one name per
dpif, so there's no need for this function anymore.

Suggested-by: Jesse Gross <jesse@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
This commit is contained in:
Ben Pfaff
2011-01-21 16:56:26 -08:00
parent 254f2dc8e3
commit 3d8c95357f
6 changed files with 9 additions and 68 deletions

View File

@@ -912,7 +912,6 @@ const struct dpif_class dpif_linux_class = {
dpif_linux_enumerate,
dpif_linux_open,
dpif_linux_close,
NULL, /* get_all_names */
dpif_linux_destroy,
dpif_linux_get_stats,
dpif_linux_get_drop_frags,

View File

@@ -1412,7 +1412,6 @@ const struct dpif_class dpif_netdev_class = {
NULL, /* enumerate */
dpif_netdev_open,
dpif_netdev_close,
NULL, /* get_all_names */
dpif_netdev_destroy,
dpif_netdev_get_stats,
dpif_netdev_get_drop_frags,

View File

@@ -102,23 +102,6 @@ struct dpif_class {
/* Closes 'dpif' and frees associated memory. */
void (*close)(struct dpif *dpif);
/* 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 should be enumerated.
*
* The caller has already initialized 'all_names' and might already have
* added some names to it. This function should not disturb any existing
* names in 'all_names'.
*
* If a datapath class does not support multiple names for a datapath, this
* function may be a null pointer.
*
* This is used by the vswitch at startup, */
int (*get_all_names)(const struct dpif *dpif, struct svec *all_names);
/* Attempts to destroy the dpif underlying 'dpif'.
*
* If successful, 'dpif' will not be used again except as an argument for

View File

@@ -363,33 +363,6 @@ 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. */
int
dpif_get_all_names(const struct dpif *dpif, struct svec *all_names)
{
if (dpif->dpif_class->get_all_names) {
int error = dpif->dpif_class->get_all_names(dpif, all_names);
if (error) {
VLOG_WARN_RL(&error_rl,
"failed to retrieve names for datpath %s: %s",
dpif_name(dpif), strerror(error));
}
return error;
} else {
svec_add(all_names, dpif_base_name(dpif));
return 0;
}
}
/* 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(). */

View File

@@ -54,7 +54,6 @@ void dpif_close(struct dpif *);
const char *dpif_name(const struct dpif *);
const char *dpif_base_name(const struct dpif *);
int dpif_get_all_names(const struct dpif *, struct svec *);
int dpif_delete(struct dpif *);

View File

@@ -373,37 +373,25 @@ bridge_configure_once(const struct ovsrec_open_vswitch *cfg)
svec_init(&dpif_types);
dp_enumerate_types(&dpif_types);
for (i = 0; i < dpif_types.n; i++) {
struct dpif *dpif;
int retval;
size_t j;
dp_enumerate_names(dpif_types.names[i], &dpif_names);
/* For each dpif... */
/* Delete each dpif whose name is not in 'bridge_names'. */
for (j = 0; j < dpif_names.n; j++) {
retval = dpif_open(dpif_names.names[j], dpif_types.names[i], &dpif);
if (!svec_contains(&bridge_names, dpif_names.names[j])) {
struct dpif *dpif;
int retval;
retval = dpif_open(dpif_names.names[j], dpif_types.names[i],
&dpif);
if (!retval) {
struct svec all_names;
size_t k;
/* ...check whether any of its names is in 'bridge_names'. */
svec_init(&all_names);
dpif_get_all_names(dpif, &all_names);
for (k = 0; k < all_names.n; k++) {
if (svec_contains(&bridge_names, all_names.names[k])) {
goto found;
}
}
/* No. Delete the dpif. */
dpif_delete(dpif);
found:
svec_destroy(&all_names);
dpif_close(dpif);
}
}
}
}
svec_destroy(&bridge_names);
svec_destroy(&dpif_names);
svec_destroy(&dpif_types);