git://git.onelab.eu
/
sliver-openvswitch.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
b3c01ed
)
dpif: Use sset instead of svec in dpif interface.
author
Ben Pfaff
<blp@nicira.com>
Fri, 25 Mar 2011 20:00:13 +0000
(13:00 -0700)
committer
Ben Pfaff
<blp@nicira.com>
Thu, 31 Mar 2011 23:42:01 +0000
(16:42 -0700)
lib/dpif-linux.c
patch
|
blob
|
history
lib/dpif-provider.h
patch
|
blob
|
history
lib/dpif.c
patch
|
blob
|
history
lib/dpif.h
patch
|
blob
|
history
utilities/ovs-dpctl.c
patch
|
blob
|
history
vswitchd/bridge.c
patch
|
blob
|
history
diff --git
a/lib/dpif-linux.c
b/lib/dpif-linux.c
index
3c22b55
..
bdc7703
100644
(file)
--- a/
lib/dpif-linux.c
+++ b/
lib/dpif-linux.c
@@
-46,7
+46,6
@@
#include "rtnetlink-link.h"
#include "shash.h"
#include "sset.h"
#include "rtnetlink-link.h"
#include "shash.h"
#include "sset.h"
-#include "svec.h"
#include "unaligned.h"
#include "util.h"
#include "vlog.h"
#include "unaligned.h"
#include "util.h"
#include "vlog.h"
@@
-160,7
+159,7
@@
dpif_linux_cast(const struct dpif *dpif)
}
static int
}
static int
-dpif_linux_enumerate(struct s
vec
*all_dps)
+dpif_linux_enumerate(struct s
set
*all_dps)
{
struct nl_dump dump;
struct ofpbuf msg;
{
struct nl_dump dump;
struct ofpbuf msg;
@@
-176,7
+175,7
@@
dpif_linux_enumerate(struct svec *all_dps)
struct dpif_linux_dp dp;
if (!dpif_linux_dp_from_ofpbuf(&dp, &msg)) {
struct dpif_linux_dp dp;
if (!dpif_linux_dp_from_ofpbuf(&dp, &msg)) {
- s
vec
_add(all_dps, dp.name);
+ s
set
_add(all_dps, dp.name);
}
}
return nl_dump_done(&dump);
}
}
return nl_dump_done(&dump);
diff --git
a/lib/dpif-provider.h
b/lib/dpif-provider.h
index
91074d5
..
4d36753
100644
(file)
--- a/
lib/dpif-provider.h
+++ b/
lib/dpif-provider.h
@@
-86,7
+86,7
@@
struct dpif_class {
*
* Some kinds of datapaths might not be practically enumerable, in which
* case this function may be a null pointer. */
*
* Some kinds of datapaths might not be practically enumerable, in which
* case this function may be a null pointer. */
- int (*enumerate)(struct s
vec
*all_dps);
+ int (*enumerate)(struct s
set
*all_dps);
/* Attempts to open an existing dpif called 'name', if 'create' is false,
* or to open an existing dpif or create a new one, if 'create' is true.
/* Attempts to open an existing dpif called 'name', if 'create' is false,
* or to open an existing dpif or create a new one, if 'create' is true.
diff --git
a/lib/dpif.c
b/lib/dpif.c
index
a754613
..
81e180f
100644
(file)
--- a/
lib/dpif.c
+++ b/
lib/dpif.c
@@
-36,7
+36,7
@@
#include "packets.h"
#include "poll-loop.h"
#include "shash.h"
#include "packets.h"
#include "poll-loop.h"
#include "shash.h"
-#include "s
vec
.h"
+#include "s
set
.h"
#include "timeval.h"
#include "util.h"
#include "valgrind.h"
#include "timeval.h"
#include "util.h"
#include "valgrind.h"
@@
-184,36
+184,36
@@
dp_unregister_provider(const char *type)
}
/* Clears 'types' and enumerates the types of all currently registered datapath
}
/* Clears 'types' and enumerates the types of all currently registered datapath
- * providers into it. The caller must first initialize the s
vec
. */
+ * providers into it. The caller must first initialize the s
set
. */
void
void
-dp_enumerate_types(struct s
vec
*types)
+dp_enumerate_types(struct s
set
*types)
{
struct shash_node *node;
dp_initialize();
{
struct shash_node *node;
dp_initialize();
- s
vec
_clear(types);
+ s
set
_clear(types);
SHASH_FOR_EACH(node, &dpif_classes) {
const struct registered_dpif_class *registered_class = node->data;
SHASH_FOR_EACH(node, &dpif_classes) {
const struct registered_dpif_class *registered_class = node->data;
- s
vec
_add(types, registered_class->dpif_class->type);
+ s
set
_add(types, registered_class->dpif_class->type);
}
}
/* Clears 'names' and enumerates the names of all known created datapaths with
}
}
/* Clears 'names' and enumerates the names of all known created datapaths with
- * the given 'type'. The caller must first initialize the s
vec.
Returns 0 if
+ * the given 'type'. The caller must first initialize the s
set.
Returns 0 if
* successful, otherwise a positive errno value.
*
* Some kinds of datapaths might not be practically enumerable. This is not
* considered an error. */
int
* successful, otherwise a positive errno value.
*
* Some kinds of datapaths might not be practically enumerable. This is not
* considered an error. */
int
-dp_enumerate_names(const char *type, struct s
vec
*names)
+dp_enumerate_names(const char *type, struct s
set
*names)
{
const struct registered_dpif_class *registered_class;
const struct dpif_class *dpif_class;
int error;
dp_initialize();
{
const struct registered_dpif_class *registered_class;
const struct dpif_class *dpif_class;
int error;
dp_initialize();
- s
vec
_clear(names);
+ s
set
_clear(names);
registered_class = shash_find_data(&dpif_classes, type);
if (!registered_class) {
registered_class = shash_find_data(&dpif_classes, type);
if (!registered_class) {
diff --git
a/lib/dpif.h
b/lib/dpif.h
index
8872a2e
..
0e0f407
100644
(file)
--- a/
lib/dpif.h
+++ b/
lib/dpif.h
@@
-34,7
+34,7
@@
struct ds;
struct netdev;
struct nlattr;
struct ofpbuf;
struct netdev;
struct nlattr;
struct ofpbuf;
-struct s
vec
;
+struct s
set
;
struct dpif_class;
void dp_run(void);
struct dpif_class;
void dp_run(void);
@@
-42,9
+42,9
@@
void dp_wait(void);
int dp_register_provider(const struct dpif_class *);
int dp_unregister_provider(const char *type);
int dp_register_provider(const struct dpif_class *);
int dp_unregister_provider(const char *type);
-void dp_enumerate_types(struct s
vec
*types);
+void dp_enumerate_types(struct s
set
*types);
-int dp_enumerate_names(const char *type, struct s
vec
*names);
+int dp_enumerate_names(const char *type, struct s
set
*names);
void dp_parse_name(const char *datapath_name, char **name, char **type);
int dpif_open(const char *name, const char *type, struct dpif **);
void dp_parse_name(const char *datapath_name, char **name, char **type);
int dpif_open(const char *name, const char *type, struct dpif **);
diff --git
a/utilities/ovs-dpctl.c
b/utilities/ovs-dpctl.c
index
658f6ba
..
f3e13a7
100644
(file)
--- a/
utilities/ovs-dpctl.c
+++ b/
utilities/ovs-dpctl.c
@@
-38,7
+38,7
@@
#include "netdev.h"
#include "odp-util.h"
#include "shash.h"
#include "netdev.h"
#include "odp-util.h"
#include "shash.h"
-#include "s
vec
.h"
+#include "s
set
.h"
#include "timeval.h"
#include "util.h"
#include "vlog.h"
#include "timeval.h"
#include "util.h"
#include "vlog.h"
@@
-404,23
+404,21
@@
do_show(int argc, char *argv[])
}
}
} else {
}
}
} else {
- struct s
vec
types;
+ struct s
set
types;
const char *type;
const char *type;
- size_t i;
- s
vec
_init(&types);
+ s
set
_init(&types);
dp_enumerate_types(&types);
dp_enumerate_types(&types);
- S
VEC_FOR_EACH (i,
type, &types) {
- struct s
vec
names;
+ S
SET_FOR_EACH (
type, &types) {
+ struct s
set
names;
const char *name;
const char *name;
- size_t j;
- s
vec
_init(&names);
+ s
set
_init(&names);
if (dp_enumerate_names(type, &names)) {
failure = true;
continue;
}
if (dp_enumerate_names(type, &names)) {
failure = true;
continue;
}
- S
VEC_FOR_EACH (j,
name, &names) {
+ S
SET_FOR_EACH (
name, &names) {
struct dpif *dpif;
int error;
struct dpif *dpif;
int error;
@@
-432,9
+430,9
@@
do_show(int argc, char *argv[])
failure = true;
}
}
failure = true;
}
}
- s
vec
_destroy(&names);
+ s
set
_destroy(&names);
}
}
- s
vec
_destroy(&types);
+ s
set
_destroy(&types);
}
if (failure) {
exit(EXIT_FAILURE);
}
if (failure) {
exit(EXIT_FAILURE);
@@
-444,34
+442,34
@@
do_show(int argc, char *argv[])
static void
do_dump_dps(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
{
static void
do_dump_dps(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
{
- struct s
vec
dpif_names, dpif_types;
-
unsigned int i
;
+ struct s
set
dpif_names, dpif_types;
+
const char *type
;
int error = 0;
int error = 0;
- s
vec
_init(&dpif_names);
- s
vec
_init(&dpif_types);
+ s
set
_init(&dpif_names);
+ s
set
_init(&dpif_types);
dp_enumerate_types(&dpif_types);
dp_enumerate_types(&dpif_types);
-
for (i = 0; i < dpif_types.n; i++
) {
-
unsigned int j
;
+
SSET_FOR_EACH (type, &dpif_types
) {
+
const char *name
;
int retval;
int retval;
- retval = dp_enumerate_names(
dpif_types.names[i]
, &dpif_names);
+ retval = dp_enumerate_names(
type
, &dpif_names);
if (retval) {
error = retval;
}
if (retval) {
error = retval;
}
-
for (j = 0; j < dpif_names.n; j++
) {
+
SSET_FOR_EACH (name, &dpif_names
) {
struct dpif *dpif;
struct dpif *dpif;
- if (!dpif_open(
dpif_names.names[j], dpif_types.names[i]
, &dpif)) {
+ if (!dpif_open(
name, type
, &dpif)) {
printf("%s\n", dpif_name(dpif));
dpif_close(dpif);
}
}
}
printf("%s\n", dpif_name(dpif));
dpif_close(dpif);
}
}
}
- s
vec
_destroy(&dpif_names);
- s
vec
_destroy(&dpif_types);
+ s
set
_destroy(&dpif_names);
+ s
set
_destroy(&dpif_types);
if (error) {
exit(EXIT_FAILURE);
}
if (error) {
exit(EXIT_FAILURE);
}
diff --git
a/vswitchd/bridge.c
b/vswitchd/bridge.c
index
951ce74
..
22af407
100644
(file)
--- a/
vswitchd/bridge.c
+++ b/
vswitchd/bridge.c
@@
-375,7
+375,8
@@
bridge_configure_once(const struct ovsrec_open_vswitch *cfg)
{
static bool already_configured_once;
struct svec bridge_names;
{
static bool already_configured_once;
struct svec bridge_names;
- struct svec dpif_names, dpif_types;
+ struct sset dpif_names, dpif_types;
+ const char *type;
size_t i;
/* Only do this once per ovs-vswitchd run. */
size_t i;
/* Only do this once per ovs-vswitchd run. */
@@
-395,22
+396,21
@@
bridge_configure_once(const struct ovsrec_open_vswitch *cfg)
/* Iterate over all system dpifs and delete any of them that do not appear
* in 'cfg'. */
/* Iterate over all system dpifs and delete any of them that do not appear
* in 'cfg'. */
- s
vec
_init(&dpif_names);
- s
vec
_init(&dpif_types);
+ s
set
_init(&dpif_names);
+ s
set
_init(&dpif_types);
dp_enumerate_types(&dpif_types);
dp_enumerate_types(&dpif_types);
-
for (i = 0; i < dpif_types.n; i++
) {
-
size_t j
;
+
SSET_FOR_EACH (type, &dpif_types
) {
+
const char *name
;
- dp_enumerate_names(
dpif_types.names[i]
, &dpif_names);
+ dp_enumerate_names(
type
, &dpif_names);
/* Delete each dpif whose name is not in 'bridge_names'. */
/* Delete each dpif whose name is not in 'bridge_names'. */
-
for (j = 0; j < dpif_names.n; j++
) {
- if (!svec_contains(&bridge_names,
dpif_names.names[j]
)) {
+
SSET_FOR_EACH (name, &dpif_names
) {
+ if (!svec_contains(&bridge_names,
name
)) {
struct dpif *dpif;
int retval;
struct dpif *dpif;
int retval;
- retval = dpif_open(dpif_names.names[j], dpif_types.names[i],
- &dpif);
+ retval = dpif_open(name, type, &dpif);
if (!retval) {
dpif_delete(dpif);
dpif_close(dpif);
if (!retval) {
dpif_delete(dpif);
dpif_close(dpif);
@@
-419,8
+419,8
@@
bridge_configure_once(const struct ovsrec_open_vswitch *cfg)
}
}
svec_destroy(&bridge_names);
}
}
svec_destroy(&bridge_names);
- s
vec
_destroy(&dpif_names);
- s
vec
_destroy(&dpif_types);
+ s
set
_destroy(&dpif_names);
+ s
set
_destroy(&dpif_types);
}
/* Callback for iterate_and_prune_ifaces(). */
}
/* Callback for iterate_and_prune_ifaces(). */