Here's an incremental.
---
ovsdb/ovsdb-idlc.in | 26 ++++++++++++++++----------
vswitchd/bridge.c | 14 ++++++--------
2 files changed, 22 insertions(+), 18 deletions(-)
diff --git a/ovsdb/ovsdb-idlc.in b/ovsdb/ovsdb-idlc.in
index 4043d85..0b1933b 100755
--- a/ovsdb/ovsdb-idlc.in
+++ b/ovsdb/ovsdb-idlc.in
@@ -120,7 +120,7 @@ const struct %(s)s *%(s)s_next(const struct %(s)s *);
(ROW) ? ((NEXT) = %(s)s_next(ROW), 1) : 0; \\
(ROW) = (NEXT))
-void %(s)s_init(struct ovsdb_idl_row *);
+void %(s)s_init(struct %(s)s *);
void %(s)s_delete(const struct %(s)s *);
struct %(s)s *%(s)s_insert(struct ovsdb_idl_txn *);
''' % {'s': structName, 'S': structName.upper()}
@@ -356,13 +356,19 @@ static void
/* Nothing to do. */
}''' % {'s': structName, 'c': columnName}
+ # Generic Row Initialization function.
+ print """
+static void
+%(s)s_init__(struct ovsdb_idl_row *row)
+{
+ %(s)s_init(%(s)s_cast(row));
+}""" % {'s': structName}
+
# Row Initialization function.
print """
void
-%(s)s_init(struct ovsdb_idl_row *row_)
+%(s)s_init(struct %(s)s *row)
{
- struct %(s)s *row = %(s)s_cast(row_);
-
memset(row, 0, sizeof *row); """ % {'s': structName}
for columnName, column in sorted(table.columns.iteritems()):
if column.type.is_smap():
@@ -472,15 +478,15 @@ void
datum.keys = xmalloc(datum.n * sizeof *datum.keys);
datum.values = xmalloc(datum.n * sizeof *datum.values);
+ i = 0;
SMAP_FOR_EACH (node, smap) {
- for (i = 0; i < datum.n; i++) {
- datum.keys[i].string = xstrdup(node->key);
- datum.values[i].string = xstrdup(node->value);
- }
+ datum.keys[i].string = xstrdup(node->key);
+ datum.values[i].string = xstrdup(node->value);
+ i++;
}
ovsdb_datum_sort_unique(&datum, OVSDB_TYPE_STRING, OVSDB_TYPE_STRING);
} else {
- memset(&datum, 0, sizeof datum);
+ ovsdb_datum_init_empty(&datum);
}
ovsdb_idl_txn_write(&row->header_,
&%(s)s_columns[%(S)s_COL_%(C)s],
@@ -592,7 +598,7 @@ static void\n%s_columns_init(void)
print " {\"%s\", %s," % (tableName, is_root)
print " %s_columns, ARRAY_SIZE(%s_columns)," % (
structName, structName)
- print " sizeof(struct %s), %s_init}," % (structName, structName)
+ print " sizeof(struct %s), %s_init__}," % (structName, structName)
print "};"
# IDL class.
diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
index 4748135..5a2b251 100644
--- a/vswitchd/bridge.c
+++ b/vswitchd/bridge.c
@@ -875,8 +875,7 @@ port_configure_stp(const struct ofproto *ofproto, struct
port *port,
const char *config_str;
struct iface *iface;
- config_str = smap_get(&port->cfg->other_config, "stp-enable");
- if (config_str && !strcmp(config_str, "false")) {
+ if (smap_get_bool(&port->cfg->other_config, "stp-enable", false)) {
port_s->enable = false;
return;
} else {
@@ -2461,8 +2460,8 @@ bridge_add_del_ports(struct bridge *br,
VLOG_WARN("bridge %s: no port named %s, synthesizing one",
br->name, br->name);
- ovsrec_interface_init(&br->synth_local_iface.header_);
- ovsrec_port_init(&br->synth_local_port.header_);
+ ovsrec_interface_init(&br->synth_local_iface);
+ ovsrec_port_init(&br->synth_local_port);
br->synth_local_port.interfaces = &br->synth_local_ifacep;
br->synth_local_port.n_interfaces = 1;
@@ -2636,7 +2635,7 @@ bridge_configure_remotes(struct bridge *br,
/* Check if we should disable in-band control on this bridge. */
disable_in_band = smap_get_bool(&br->cfg->other_config, "disable-in-band",
- true);
+ false);
/* Set OpenFlow queue ID for in-band control. */
ofproto_set_in_band_queue(br->ofproto,
@@ -3728,12 +3727,12 @@ synthesize_splinter_port(const char *real_dev_name,
struct ovsrec_port *port;
iface = xmalloc(sizeof *iface);
- ovsrec_interface_init(&iface->header_);
+ ovsrec_interface_init(iface);
iface->name = xstrdup(vlan_dev_name);
iface->type = "system";
port = xmalloc(sizeof *port);
- ovsrec_port_init(&iface->header_);
+ ovsrec_port_init(port);
port->interfaces = xmemdup(&iface, sizeof iface);
port->n_interfaces = 1;
port->name = xstrdup(vlan_dev_name);
@@ -3741,7 +3740,6 @@ synthesize_splinter_port(const char *real_dev_name,
port->tag = xmalloc(sizeof *port->tag);
*port->tag = vid;
- smap_init(&port->other_config);
smap_add(&port->other_config, "realdev", real_dev_name);
register_rec(port);
--
1.7.10.2
_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev