summaryrefslogtreecommitdiff
path: root/ovsdb
diff options
context:
space:
mode:
authorBen Pfaff <blp@ovn.org>2018-05-24 10:32:59 -0700
committerBen Pfaff <blp@ovn.org>2018-05-25 13:36:05 -0700
commitfa37affad362df15fc59db00aa96ee79cd5eebd9 (patch)
treef539cdab21f0951aa8bb7c8b6984d9854d33112d /ovsdb
parent3d62892884d88cf1d0d02f58b3317e6ec0ca8971 (diff)
downloadopenvswitch-fa37affad362df15fc59db00aa96ee79cd5eebd9.tar.gz
Embrace anonymous unions.
Several OVS structs contain embedded named unions, like this: struct { ... union { ... } u; }; C11 standardized a feature that many compilers already implemented anyway, where an embedded union may be unnamed, like this: struct { ... union { ... }; }; This is more convenient because it allows the programmer to omit "u." in many places. OVS already used this feature in several places. This commit embraces it in several others. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Justin Pettit <jpettit@ovn.org> Tested-by: Alin Gabriel Serdean <aserdean@ovn.org> Acked-by: Alin Gabriel Serdean <aserdean@ovn.org>
Diffstat (limited to 'ovsdb')
-rw-r--r--ovsdb/column.c6
-rw-r--r--ovsdb/condition.c6
-rw-r--r--ovsdb/execution.c14
-rw-r--r--ovsdb/file.c4
-rw-r--r--ovsdb/jsonrpc-server.c26
-rw-r--r--ovsdb/log.c2
-rw-r--r--ovsdb/mutation.c6
-rw-r--r--ovsdb/ovsdb-client.c66
-rwxr-xr-xovsdb/ovsdb-idlc.in1
-rw-r--r--ovsdb/ovsdb-server.c12
-rw-r--r--ovsdb/ovsdb-tool.c2
-rw-r--r--ovsdb/ovsdb-util.c2
-rw-r--r--ovsdb/ovsdb.c12
-rw-r--r--ovsdb/replication.c12
-rw-r--r--ovsdb/storage.c4
-rw-r--r--ovsdb/table.c8
-rw-r--r--ovsdb/transaction.c8
-rw-r--r--ovsdb/trigger.c4
18 files changed, 98 insertions, 97 deletions
diff --git a/ovsdb/column.c b/ovsdb/column.c
index 8838df3eb..9dfc8714f 100644
--- a/ovsdb/column.c
+++ b/ovsdb/column.c
@@ -165,15 +165,15 @@ ovsdb_column_set_from_json(const struct json *json,
}
/* XXX this is O(n**2) */
- for (i = 0; i < json->u.array.n; i++) {
+ for (i = 0; i < json->array.n; i++) {
const struct ovsdb_column *column;
const char *s;
- if (json->u.array.elems[i]->type != JSON_STRING) {
+ if (json->array.elems[i]->type != JSON_STRING) {
goto error;
}
- s = json->u.array.elems[i]->u.string;
+ s = json->array.elems[i]->string;
column = shash_find_data(&schema->columns, s);
if (!column) {
error = ovsdb_syntax_error(json, NULL, "%s is not a valid "
diff --git a/ovsdb/condition.c b/ovsdb/condition.c
index 6da3b08ad..f2213ca11 100644
--- a/ovsdb/condition.c
+++ b/ovsdb/condition.c
@@ -81,9 +81,9 @@ ovsdb_clause_from_json(const struct ovsdb_table_schema *ts,
}
if (json->type != JSON_ARRAY
- || json->u.array.n != 3
- || json->u.array.elems[0]->type != JSON_STRING
- || json->u.array.elems[1]->type != JSON_STRING) {
+ || json->array.n != 3
+ || json->array.elems[0]->type != JSON_STRING
+ || json->array.elems[1]->type != JSON_STRING) {
return ovsdb_syntax_error(json, NULL, "Parse error in condition.");
}
array = json_array(json);
diff --git a/ovsdb/execution.c b/ovsdb/execution.c
index 38303c7db..c55a0b771 100644
--- a/ovsdb/execution.c
+++ b/ovsdb/execution.c
@@ -121,9 +121,9 @@ ovsdb_execute_compose(struct ovsdb *db, const struct ovsdb_session *session,
*durable = false;
if (params->type != JSON_ARRAY
- || !params->u.array.n
- || params->u.array.elems[0]->type != JSON_STRING
- || strcmp(params->u.array.elems[0]->u.string, db->schema->name)) {
+ || !params->array.n
+ || params->array.elems[0]->type != JSON_STRING
+ || strcmp(params->array.elems[0]->string, db->schema->name)) {
if (params->type != JSON_ARRAY) {
error = ovsdb_syntax_error(params, NULL, "array expected");
} else {
@@ -147,10 +147,10 @@ ovsdb_execute_compose(struct ovsdb *db, const struct ovsdb_session *session,
results = NULL;
results = json_array_create_empty();
- n_operations = params->u.array.n - 1;
+ n_operations = params->array.n - 1;
error = NULL;
for (i = 1; i <= n_operations; i++) {
- struct json *operation = params->u.array.elems[i];
+ struct json *operation = params->array.elems[i];
struct ovsdb_error *parse_error;
struct ovsdb_parser parser;
struct json *result;
@@ -735,11 +735,11 @@ ovsdb_execute_wait(struct ovsdb_execution *x, struct ovsdb_parser *parser,
if (!error) {
/* Parse "rows" into 'expected'. */
ovsdb_row_hash_init(&expected, &columns);
- for (i = 0; i < rows->u.array.n; i++) {
+ for (i = 0; i < rows->array.n; i++) {
struct ovsdb_row *row;
row = ovsdb_row_create(table);
- error = ovsdb_row_from_json(row, rows->u.array.elems[i], x->symtab,
+ error = ovsdb_row_from_json(row, rows->array.elems[i], x->symtab,
NULL);
if (error) {
ovsdb_row_destroy(row);
diff --git a/ovsdb/file.c b/ovsdb/file.c
index f523f3798..8d16b097b 100644
--- a/ovsdb/file.c
+++ b/ovsdb/file.c
@@ -135,7 +135,7 @@ ovsdb_file_txn_table_from_json(struct ovsdb_txn *txn,
return ovsdb_syntax_error(json, NULL, "object expected");
}
- SHASH_FOR_EACH (node, json->u.object) {
+ SHASH_FOR_EACH (node, json->object) {
const char *uuid_string = node->name;
struct json *txn_row_json = node->data;
struct ovsdb_error *error;
@@ -177,7 +177,7 @@ ovsdb_file_txn_from_json(struct ovsdb *db, const struct json *json,
}
txn = ovsdb_txn_create(db);
- SHASH_FOR_EACH (node, json->u.object) {
+ SHASH_FOR_EACH (node, json->object) {
const char *table_name = node->name;
struct json *node_json = node->data;
struct ovsdb_table *table;
diff --git a/ovsdb/jsonrpc-server.c b/ovsdb/jsonrpc-server.c
index 84ba6ad21..6c58f4102 100644
--- a/ovsdb/jsonrpc-server.c
+++ b/ovsdb/jsonrpc-server.c
@@ -772,7 +772,7 @@ ovsdb_jsonrpc_lookup_db(const struct ovsdb_jsonrpc_session *s,
goto error;
}
- db_name = params->elems[0]->u.string;
+ db_name = params->elems[0]->string;
db = shash_find_data(&s->up.server->dbs, db_name);
if (!db) {
error = ovsdb_syntax_error(
@@ -1054,7 +1054,7 @@ execute_cancel(struct ovsdb_jsonrpc_session *s, struct jsonrpc_msg *request)
struct ovsdb_jsonrpc_trigger *t;
struct json *id;
- id = request->params->u.array.elems[0];
+ id = request->params->array.elems[0];
t = ovsdb_jsonrpc_trigger_find(s, id, json_hash(id, 0));
if (t) {
ovsdb_jsonrpc_trigger_complete(t);
@@ -1303,16 +1303,16 @@ ovsdb_jsonrpc_parse_monitor_request(
"array of column names expected");
}
- for (i = 0; i < columns->u.array.n; i++) {
+ for (i = 0; i < columns->array.n; i++) {
const struct ovsdb_column *column;
const char *s;
- if (columns->u.array.elems[i]->type != JSON_STRING) {
+ if (columns->array.elems[i]->type != JSON_STRING) {
return ovsdb_syntax_error(columns, NULL,
"array of column names expected");
}
- s = columns->u.array.elems[i]->u.string;
+ s = columns->array.elems[i]->string;
column = shash_find_data(&table->schema->columns, s);
if (!column) {
return ovsdb_syntax_error(columns, NULL, "%s is not a valid "
@@ -1367,8 +1367,8 @@ ovsdb_jsonrpc_monitor_create(struct ovsdb_jsonrpc_session *s, struct ovsdb *db,
error = ovsdb_syntax_error(params, NULL, "invalid parameters");
goto error;
}
- monitor_id = params->u.array.elems[1];
- monitor_requests = params->u.array.elems[2];
+ monitor_id = params->array.elems[1];
+ monitor_requests = params->array.elems[2];
if (monitor_requests->type != JSON_OBJECT) {
error = ovsdb_syntax_error(monitor_requests, NULL,
"monitor-requests must be object");
@@ -1409,7 +1409,7 @@ ovsdb_jsonrpc_monitor_create(struct ovsdb_jsonrpc_session *s, struct ovsdb *db,
/* Parse columns. */
mr_value = node->data;
if (mr_value->type == JSON_ARRAY) {
- const struct json_array *array = &mr_value->u.array;
+ const struct json_array *array = &mr_value->array;
for (i = 0; i < array->n; i++) {
error = ovsdb_jsonrpc_parse_monitor_request(m->dbmon,
@@ -1503,14 +1503,14 @@ ovsdb_jsonrpc_monitor_cond_change(struct ovsdb_jsonrpc_session *s,
goto error;
}
- m = ovsdb_jsonrpc_monitor_find(s, params->u.array.elems[0]);
+ m = ovsdb_jsonrpc_monitor_find(s, params->array.elems[0]);
if (!m) {
- error = ovsdb_syntax_error(params->u.array.elems[0], NULL,
+ error = ovsdb_syntax_error(params->array.elems[0], NULL,
"unknown monitor session");
goto error;
}
- const struct json *new_monitor_id = params->u.array.elems[1];
+ const struct json *new_monitor_id = params->array.elems[1];
bool changing_id = !json_equal(m->monitor_id, new_monitor_id);
if (changing_id && ovsdb_jsonrpc_monitor_find(s, new_monitor_id)) {
error = ovsdb_syntax_error(new_monitor_id, NULL,
@@ -1518,7 +1518,7 @@ ovsdb_jsonrpc_monitor_cond_change(struct ovsdb_jsonrpc_session *s,
goto error;
}
- monitor_cond_change_reqs = params->u.array.elems[2];
+ monitor_cond_change_reqs = params->array.elems[2];
if (monitor_cond_change_reqs->type != JSON_OBJECT) {
error =
ovsdb_syntax_error(NULL, NULL,
@@ -1546,7 +1546,7 @@ ovsdb_jsonrpc_monitor_cond_change(struct ovsdb_jsonrpc_session *s,
mr_value = node->data;
if (mr_value->type == JSON_ARRAY) {
- const struct json_array *array = &mr_value->u.array;
+ const struct json_array *array = &mr_value->array;
for (i = 0; i < array->n; i++) {
error = ovsdb_jsonrpc_parse_monitor_cond_change_request(
diff --git a/ovsdb/log.c b/ovsdb/log.c
index 1c9376815..c82a79c9f 100644
--- a/ovsdb/log.c
+++ b/ovsdb/log.c
@@ -494,7 +494,7 @@ ovsdb_log_read(struct ovsdb_log *file, struct json **jsonp)
"offset %lld are not valid JSON (%s)",
file->display_name, data_length,
(long long int) data_offset,
- json->u.string);
+ json->string);
goto error;
}
if (json->type != JSON_OBJECT) {
diff --git a/ovsdb/mutation.c b/ovsdb/mutation.c
index e5d192e15..cd20bdb7c 100644
--- a/ovsdb/mutation.c
+++ b/ovsdb/mutation.c
@@ -85,9 +85,9 @@ ovsdb_mutation_from_json(const struct ovsdb_table_schema *ts,
const char *column_name;
if (json->type != JSON_ARRAY
- || json->u.array.n != 3
- || json->u.array.elems[0]->type != JSON_STRING
- || json->u.array.elems[1]->type != JSON_STRING) {
+ || json->array.n != 3
+ || json->array.elems[0]->type != JSON_STRING
+ || json->array.elems[1]->type != JSON_STRING) {
return ovsdb_syntax_error(json, NULL, "Parse error in mutation.");
}
array = json_array(json);
diff --git a/ovsdb/ovsdb-client.c b/ovsdb/ovsdb-client.c
index 68ec7b2d1..cdb021f39 100644
--- a/ovsdb/ovsdb-client.c
+++ b/ovsdb/ovsdb-client.c
@@ -488,7 +488,7 @@ parse_json(const char *s)
{
struct json *json = json_from_string(s);
if (json->type == JSON_STRING) {
- ovs_fatal(0, "\"%s\": %s", s, json->u.string);
+ ovs_fatal(0, "\"%s\": %s", s, json->string);
}
return json;
}
@@ -577,13 +577,13 @@ fetch_dbs(struct jsonrpc *rpc, struct svec *dbs)
ovs_fatal(0, "list_dbs response is not array");
}
- for (i = 0; i < reply->result->u.array.n; i++) {
- const struct json *name = reply->result->u.array.elems[i];
+ for (i = 0; i < reply->result->array.n; i++) {
+ const struct json *name = reply->result->array.elems[i];
if (name->type != JSON_STRING) {
ovs_fatal(0, "list_dbs response %"PRIuSIZE" is not string", i);
}
- svec_add(dbs, name->u.string);
+ svec_add(dbs, name->string);
}
jsonrpc_msg_destroy(reply);
svec_sort(dbs);
@@ -650,14 +650,14 @@ parse_database_info_reply(const struct jsonrpc_msg *reply, const char *server,
{
const struct json *result = reply->result;
if (result->type != JSON_ARRAY
- || result->u.array.n != 1
- || result->u.array.elems[0]->type != JSON_OBJECT) {
+ || result->array.n != 1
+ || result->array.elems[0]->type != JSON_OBJECT) {
VLOG_WARN("%s: unexpected reply to _Server request for %s",
server, database);
return NULL;
}
- const struct json *op_result = result->u.array.elems[0];
+ const struct json *op_result = result->array.elems[0];
const struct json *rows = shash_find_data(json_object(op_result), "rows");
if (!rows || rows->type != JSON_ARRAY) {
VLOG_WARN("%s: missing \"rows\" member in _Server reply for %s",
@@ -665,8 +665,8 @@ parse_database_info_reply(const struct jsonrpc_msg *reply, const char *server,
return NULL;
}
- for (size_t i = 0; i < rows->u.array.n; i++) {
- const struct json *row = rows->u.array.elems[i];
+ for (size_t i = 0; i < rows->array.n; i++) {
+ const struct json *row = rows->array.elems[i];
if (row->type != JSON_OBJECT) {
VLOG_WARN("%s: bad row in _Server reply for %s",
server, database);
@@ -855,11 +855,11 @@ do_transact__(int argc, char *argv[], struct json *transaction)
{
struct jsonrpc_msg *request, *reply;
if (transaction->type != JSON_ARRAY
- || !transaction->u.array.n
- || transaction->u.array.elems[0]->type != JSON_STRING) {
+ || !transaction->array.n
+ || transaction->array.elems[0]->type != JSON_STRING) {
ovs_fatal(0, "not a valid OVSDB query");
}
- const char *db_name = json_string(transaction->u.array.elems[0]);
+ const char *db_name = json_string(transaction->array.elems[0]);
struct jsonrpc *rpc;
char *database = CONST_CAST(char *, db_name);
@@ -902,21 +902,21 @@ do_query(struct jsonrpc *rpc OVS_UNUSED, const char *database OVS_UNUSED,
struct json *abort_op = json_object_create();
json_object_put_string(abort_op, "op", "abort");
json_array_add(transaction, abort_op);
- size_t abort_idx = transaction->u.array.n - 2;
+ size_t abort_idx = transaction->array.n - 2;
/* Run query. */
struct json *result = do_transact__(argc, argv, transaction);
/* If the "abort" operation ended the transaction, remove its result. */
if (result->type == JSON_ARRAY
- && result->u.array.n == abort_idx + 1
- && result->u.array.elems[abort_idx]->type == JSON_OBJECT) {
- struct json *op_result = result->u.array.elems[abort_idx];
+ && result->array.n == abort_idx + 1
+ && result->array.elems[abort_idx]->type == JSON_OBJECT) {
+ struct json *op_result = result->array.elems[abort_idx];
struct json *error = shash_find_data(json_object(op_result), "error");
if (error
&& error->type == JSON_STRING
&& !strcmp(json_string(error), "aborted")) {
- result->u.array.n--;
+ result->array.n--;
json_destroy(op_result);
}
}
@@ -1178,7 +1178,7 @@ parse_monitor_columns(char *arg, const char *server, const char *database,
}
}
- if (columns_json->u.array.n == 0) {
+ if (columns_json->array.n == 0) {
const struct shash_node **nodes;
size_t i, n;
@@ -1456,9 +1456,9 @@ do_monitor__(struct jsonrpc *rpc, const char *database,
&& !strcmp(msg->method, "update")) {
struct json *params = msg->params;
if (params->type == JSON_ARRAY
- && params->u.array.n == 2
- && params->u.array.elems[0]->type == JSON_NULL) {
- monitor_print(params->u.array.elems[1], mts, n_mts, false);
+ && params->array.n == 2
+ && params->array.elems[0]->type == JSON_NULL) {
+ monitor_print(params->array.elems[1], mts, n_mts, false);
fflush(stdout);
}
} else if (msg->type == JSONRPC_NOTIFY
@@ -1466,9 +1466,9 @@ do_monitor__(struct jsonrpc *rpc, const char *database,
&& !strcmp(msg->method, "update2")) {
struct json *params = msg->params;
if (params->type == JSON_ARRAY
- && params->u.array.n == 2
- && params->u.array.elems[0]->type == JSON_NULL) {
- monitor2_print(params->u.array.elems[1], mts, n_mts);
+ && params->array.n == 2
+ && params->array.elems[0]->type == JSON_NULL) {
+ monitor2_print(params->array.elems[1], mts, n_mts);
fflush(stdout);
}
} else if (msg->type == JSONRPC_NOTIFY
@@ -1806,13 +1806,13 @@ do_dump(struct jsonrpc *rpc, const char *database,
/* Print database contents. */
if (reply->result->type != JSON_ARRAY
- || reply->result->u.array.n != n_tables) {
+ || reply->result->array.n != n_tables) {
ovs_fatal(0, "reply is not array of %"PRIuSIZE" elements: %s",
n_tables, json_to_string(reply->result, 0));
}
for (i = 0; i < n_tables; i++) {
const struct ovsdb_table_schema *ts = tables[i]->data;
- const struct json *op_result = reply->result->u.array.elems[i];
+ const struct json *op_result = reply->result->array.elems[i];
struct json *rows;
if (op_result->type != JSON_OBJECT
@@ -1824,9 +1824,9 @@ do_dump(struct jsonrpc *rpc, const char *database,
}
if (argc > 1) {
- dump_table(tables[i]->name, &custom_columns, &rows->u.array);
+ dump_table(tables[i]->name, &custom_columns, &rows->array);
} else {
- dump_table(tables[i]->name, &ts->columns, &rows->u.array);
+ dump_table(tables[i]->name, &ts->columns, &rows->array);
}
}
@@ -1920,7 +1920,7 @@ do_backup(struct jsonrpc *rpc, const char *database,
/* Print database transaction record. */
if (reply->result->type != JSON_ARRAY
- || reply->result->u.array.n != shash_count(&schema->tables)) {
+ || reply->result->array.n != shash_count(&schema->tables)) {
ovs_fatal(0, "reply is not array of %"PRIuSIZE" elements: %s",
shash_count(&schema->tables),
json_to_string(reply->result, 0));
@@ -1931,7 +1931,7 @@ do_backup(struct jsonrpc *rpc, const char *database,
SHASH_FOR_EACH (node, &schema->tables) {
const char *table_name = node->name;
const struct ovsdb_table_schema *table = node->data;
- const struct json *op_result = reply->result->u.array.elems[i++];
+ const struct json *op_result = reply->result->array.elems[i++];
struct json *rows;
if (op_result->type != JSON_OBJECT
@@ -1942,13 +1942,13 @@ do_backup(struct jsonrpc *rpc, const char *database,
table->name, json_to_string(op_result, 0));
}
- if (!rows->u.array.n) {
+ if (!rows->array.n) {
continue;
}
struct json *output_rows = json_object_create();
- for (size_t j = 0; j < rows->u.array.n; j++) {
- struct json *row = rows->u.array.elems[j];
+ for (size_t j = 0; j < rows->array.n; j++) {
+ struct json *row = rows->array.elems[j];
if (row->type != JSON_OBJECT) {
ovs_fatal(0, "%s table reply row is not an object: %s",
table_name, json_to_string(row, 0));
diff --git a/ovsdb/ovsdb-idlc.in b/ovsdb/ovsdb-idlc.in
index 1ea2115c0..80715dfea 100755
--- a/ovsdb/ovsdb-idlc.in
+++ b/ovsdb/ovsdb-idlc.in
@@ -387,6 +387,7 @@ bool %(s)s_is_updated(const struct %(s)s *, enum %(s)s_column_id);
#endif''')
print("\n#endif /* %(prefix)sIDL_HEADER */" % {'prefix': prefix.upper()})
+
def printEnum(type, members):
if len(members) == 0:
return
diff --git a/ovsdb/ovsdb-server.c b/ovsdb/ovsdb-server.c
index 4bae22fc7..68f7acae9 100644
--- a/ovsdb/ovsdb-server.c
+++ b/ovsdb/ovsdb-server.c
@@ -943,9 +943,9 @@ query_db_remotes(const char *name, const struct shash *all_dbs,
}
}
} else if (column->type.key.type == OVSDB_TYPE_UUID
- && column->type.key.u.uuid.refTable
+ && column->type.key.uuid.refTable
&& column->type.value.type == OVSDB_TYPE_VOID) {
- const struct ovsdb_table *ref_table = column->type.key.u.uuid.refTable;
+ const struct ovsdb_table *ref_table = column->type.key.uuid.refTable;
HMAP_FOR_EACH (row, hmap_node, &table->rows) {
const struct ovsdb_datum *datum;
size_t i;
@@ -1050,12 +1050,12 @@ update_remote_rows(const struct shash *all_dbs, const struct db *db_,
if (db != db_
|| column->type.key.type != OVSDB_TYPE_UUID
- || !column->type.key.u.uuid.refTable
+ || !column->type.key.uuid.refTable
|| column->type.value.type != OVSDB_TYPE_VOID) {
return;
}
- ref_table = column->type.key.u.uuid.refTable;
+ ref_table = column->type.key.uuid.refTable;
HMAP_FOR_EACH (row, hmap_node, &table->rows) {
const struct ovsdb_datum *datum;
@@ -1903,8 +1903,8 @@ sset_from_json(struct sset *sset, const struct json *array)
sset_clear(sset);
ovs_assert(array->type == JSON_ARRAY);
- for (i = 0; i < array->u.array.n; i++) {
- const struct json *elem = array->u.array.elems[i];
+ for (i = 0; i < array->array.n; i++) {
+ const struct json *elem = array->array.elems[i];
sset_add(sset, json_string(elem));
}
}
diff --git a/ovsdb/ovsdb-tool.c b/ovsdb/ovsdb-tool.c
index c2ad2310c..95a777241 100644
--- a/ovsdb/ovsdb-tool.c
+++ b/ovsdb/ovsdb-tool.c
@@ -212,7 +212,7 @@ parse_json(const char *s)
{
struct json *json = json_from_string(s);
if (json->type == JSON_STRING) {
- ovs_fatal(0, "\"%s\": %s", s, json->u.string);
+ ovs_fatal(0, "\"%s\": %s", s, json->string);
}
return json;
}
diff --git a/ovsdb/ovsdb-util.c b/ovsdb/ovsdb-util.c
index 1eca4fe33..c4075cdae 100644
--- a/ovsdb/ovsdb-util.c
+++ b/ovsdb/ovsdb-util.c
@@ -135,7 +135,7 @@ ovsdb_util_read_map_string_uuid_column(const struct ovsdb_row *row,
return NULL;
}
- const struct ovsdb_table *ref_table = column->type.value.u.uuid.refTable;
+ const struct ovsdb_table *ref_table = column->type.value.uuid.refTable;
if (!ref_table) {
return NULL;
}
diff --git a/ovsdb/ovsdb.c b/ovsdb/ovsdb.c
index 3c51e1c19..da8db82a9 100644
--- a/ovsdb/ovsdb.c
+++ b/ovsdb/ovsdb.c
@@ -118,16 +118,16 @@ ovsdb_schema_check_ref_table(struct ovsdb_column *column,
{
struct ovsdb_table_schema *refTable;
- if (base->type != OVSDB_TYPE_UUID || !base->u.uuid.refTableName) {
+ if (base->type != OVSDB_TYPE_UUID || !base->uuid.refTableName) {
return NULL;
}
- refTable = shash_find_data(tables, base->u.uuid.refTableName);
+ refTable = shash_find_data(tables, base->uuid.refTableName);
if (!refTable) {
return ovsdb_syntax_error(NULL, NULL,
"column %s %s refers to undefined table %s",
column->name, base_name,
- base->u.uuid.refTableName);
+ base->uuid.refTableName);
}
if (ovsdb_base_type_is_strong_ref(base) && !refTable->is_root) {
@@ -388,11 +388,11 @@ static void
ovsdb_set_ref_table(const struct shash *tables,
struct ovsdb_base_type *base)
{
- if (base->type == OVSDB_TYPE_UUID && base->u.uuid.refTableName) {
+ if (base->type == OVSDB_TYPE_UUID && base->uuid.refTableName) {
struct ovsdb_table *table;
- table = shash_find_data(tables, base->u.uuid.refTableName);
- base->u.uuid.refTable = table;
+ table = shash_find_data(tables, base->uuid.refTableName);
+ base->uuid.refTable = table;
}
}
diff --git a/ovsdb/replication.c b/ovsdb/replication.c
index bb18da8ef..2b9ae2f83 100644
--- a/ovsdb/replication.c
+++ b/ovsdb/replication.c
@@ -147,8 +147,8 @@ replication_add_local_db(const char *database, struct ovsdb *db)
static void
send_schema_requests(const struct json *result)
{
- for (size_t i = 0; i < result->u.array.n; i++) {
- const struct json *name = result->u.array.elems[i];
+ for (size_t i = 0; i < result->array.n; i++) {
+ const struct json *name = result->array.elems[i];
if (name->type == JSON_STRING) {
/* Send one schema request for each remote DB. */
const char *db_name = json_string(name);
@@ -203,13 +203,13 @@ replication_run(void)
if (msg->type == JSONRPC_NOTIFY && state != RPL_S_ERR
&& !strcmp(msg->method, "update")) {
if (msg->params->type == JSON_ARRAY
- && msg->params->u.array.n == 2
- && msg->params->u.array.elems[0]->type == JSON_STRING) {
- char *db_name = msg->params->u.array.elems[0]->u.string;
+ && msg->params->array.n == 2
+ && msg->params->array.elems[0]->type == JSON_STRING) {
+ char *db_name = msg->params->array.elems[0]->string;
struct ovsdb *db = find_db(db_name);
if (db) {
struct ovsdb_error *error;
- error = process_notification(msg->params->u.array.elems[1],
+ error = process_notification(msg->params->array.elems[1],
db);
if (error) {
ovsdb_error_assert(error);
diff --git a/ovsdb/storage.c b/ovsdb/storage.c
index 446cae086..b810bff04 100644
--- a/ovsdb/storage.c
+++ b/ovsdb/storage.c
@@ -246,12 +246,12 @@ ovsdb_storage_read(struct ovsdb_storage *storage,
raft_next_entry(storage->raft, txnid, &is_snapshot));
if (!json) {
return NULL;
- } else if (json->type != JSON_ARRAY || json->u.array.n != 2) {
+ } else if (json->type != JSON_ARRAY || json->array.n != 2) {
json_destroy(json);
return ovsdb_error(NULL, "invalid commit format");
}
- struct json **e = json->u.array.elems;
+ struct json **e = json->array.elems;
schema_json = e[0]->type != JSON_NULL ? e[0] : NULL;
txn_json = e[1]->type != JSON_NULL ? e[1] : NULL;
} else if (storage->log) {
diff --git a/ovsdb/table.c b/ovsdb/table.c
index 7ec55d61f..6cd2d886d 100644
--- a/ovsdb/table.c
+++ b/ovsdb/table.c
@@ -152,7 +152,7 @@ ovsdb_table_schema_from_json(const struct json *json, const char *name,
return ovsdb_syntax_error(json, NULL,
"maxRows must be at least 1");
}
- n_max_rows = max_rows->u.integer;
+ n_max_rows = max_rows->integer;
} else {
n_max_rows = UINT_MAX;
}
@@ -187,12 +187,12 @@ ovsdb_table_schema_from_json(const struct json *json, const char *name,
if (indexes) {
size_t i;
- ts->indexes = xmalloc(indexes->u.array.n * sizeof *ts->indexes);
- for (i = 0; i < indexes->u.array.n; i++) {
+ ts->indexes = xmalloc(indexes->array.n * sizeof *ts->indexes);
+ for (i = 0; i < indexes->array.n; i++) {
struct ovsdb_column_set *index = &ts->indexes[i];
size_t j;
- error = ovsdb_column_set_from_json(indexes->u.array.elems[i],
+ error = ovsdb_column_set_from_json(indexes->array.elems[i],
ts, index);
if (error) {
goto error;
diff --git a/ovsdb/transaction.c b/ovsdb/transaction.c
index 256916fff..9801aca2b 100644
--- a/ovsdb/transaction.c
+++ b/ovsdb/transaction.c
@@ -225,7 +225,7 @@ ovsdb_txn_adjust_atom_refs(struct ovsdb_txn *txn, const struct ovsdb_row *r,
return NULL;
}
- table = base->u.uuid.refTable;
+ table = base->uuid.refTable;
for (i = 0; i < n; i++) {
const struct uuid *uuid = &atoms[i].uuid;
struct ovsdb_txn_row *txn_row;
@@ -322,7 +322,7 @@ delete_row_refs(struct ovsdb_txn *txn, const struct ovsdb_row *row,
return NULL;
}
- table = base->u.uuid.refTable;
+ table = base->uuid.refTable;
for (i = 0; i < n; i++) {
const struct uuid *uuid = &atoms[i].uuid;
struct ovsdb_txn_row *txn_row;
@@ -549,7 +549,7 @@ assess_weak_refs(struct ovsdb_txn *txn, struct ovsdb_txn_row *txn_row)
for (i = 0; i < datum->n; ) {
const struct ovsdb_row *row;
- row = ovsdb_table_get_row(column->type.key.u.uuid.refTable,
+ row = ovsdb_table_get_row(column->type.key.uuid.refTable,
&datum->keys[i].uuid);
if (row) {
add_weak_ref(txn_row->new, row);
@@ -567,7 +567,7 @@ assess_weak_refs(struct ovsdb_txn *txn, struct ovsdb_txn_row *txn_row)
for (i = 0; i < datum->n; ) {
const struct ovsdb_row *row;
- row = ovsdb_table_get_row(column->type.value.u.uuid.refTable,
+ row = ovsdb_table_get_row(column->type.value.uuid.refTable,
&datum->values[i].uuid);
if (row) {
add_weak_ref(txn_row->new, row);
diff --git a/ovsdb/trigger.c b/ovsdb/trigger.c
index a2f88568e..3f62dc96f 100644
--- a/ovsdb/trigger.c
+++ b/ovsdb/trigger.c
@@ -230,14 +230,14 @@ ovsdb_trigger_try(struct ovsdb_trigger *t, long long int now)
/* Validate parameters. */
const struct json *params = t->request->params;
- if (params->type != JSON_ARRAY || params->u.array.n != 2) {
+ if (params->type != JSON_ARRAY || params->array.n != 2) {
trigger_convert_error(t, ovsdb_syntax_error(params, NULL,
"array expected"));
return false;
}
/* Parse new schema and make a converted copy. */
- const struct json *new_schema_json = params->u.array.elems[1];
+ const struct json *new_schema_json = params->array.elems[1];
struct ovsdb_schema *new_schema;
struct ovsdb_error *error
= ovsdb_schema_from_json(new_schema_json, &new_schema);