X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=ovsdb%2Fexecution.c;h=416016fd9ef3ff89758d6c87bd51653f6e54f51a;hb=c15f1d11fa95a036eaa2504527bbd5decf082db6;hp=708cc60dd58352090b7f9bcf7e09774ec2c6fc18;hpb=e9387de4a2601ed2768baaa9bc92a3ef27f1145a;p=openvswitch diff --git a/ovsdb/execution.c b/ovsdb/execution.c index 708cc60d..416016fd 100644 --- a/ovsdb/execution.c +++ b/ovsdb/execution.c @@ -200,7 +200,7 @@ exit: return results; } -struct ovsdb_error * +static struct ovsdb_error * ovsdb_execute_commit(struct ovsdb_execution *x, struct ovsdb_parser *parser, struct json *result OVS_UNUSED) { @@ -270,7 +270,7 @@ parse_row(const struct json *json, const struct ovsdb_table *table, } } -struct ovsdb_error * +static struct ovsdb_error * ovsdb_execute_insert(struct ovsdb_execution *x, struct ovsdb_parser *parser, struct json *result) { @@ -341,7 +341,7 @@ ovsdb_execute_insert(struct ovsdb_execution *x, struct ovsdb_parser *parser, return error; } -struct ovsdb_error * +static struct ovsdb_error * ovsdb_execute_select(struct ovsdb_execution *x, struct ovsdb_parser *parser, struct json *result) { @@ -364,10 +364,11 @@ ovsdb_execute_select(struct ovsdb_execution *x, struct ovsdb_parser *parser, &condition); } if (!error) { - error = ovsdb_column_set_from_json(columns_json, table, &columns); + error = ovsdb_column_set_from_json(columns_json, table->schema, + &columns); } if (!error) { - error = ovsdb_column_set_from_json(sort_json, table, &sort); + error = ovsdb_column_set_from_json(sort_json, table->schema, &sort); } if (!error) { struct ovsdb_row_set rows = OVSDB_ROW_SET_INITIALIZER; @@ -408,7 +409,7 @@ update_row_cb(const struct ovsdb_row *row, void *ur_) return true; } -struct ovsdb_error * +static struct ovsdb_error * ovsdb_execute_update(struct ovsdb_execution *x, struct ovsdb_parser *parser, struct json *result) { @@ -451,6 +452,7 @@ struct mutate_row_cbdata { size_t n_matches; struct ovsdb_txn *txn; const struct ovsdb_mutation_set *mutations; + struct ovsdb_error **error; }; static bool @@ -459,13 +461,12 @@ mutate_row_cb(const struct ovsdb_row *row, void *mr_) struct mutate_row_cbdata *mr = mr_; mr->n_matches++; - ovsdb_mutation_set_execute(ovsdb_txn_row_modify(mr->txn, row), - mr->mutations); - - return true; + *mr->error = ovsdb_mutation_set_execute(ovsdb_txn_row_modify(mr->txn, row), + mr->mutations); + return *mr->error == NULL; } -struct ovsdb_error * +static struct ovsdb_error * ovsdb_execute_mutate(struct ovsdb_execution *x, struct ovsdb_parser *parser, struct json *result) { @@ -494,6 +495,7 @@ ovsdb_execute_mutate(struct ovsdb_execution *x, struct ovsdb_parser *parser, mr.n_matches = 0; mr.txn = x->txn; mr.mutations = &mutations; + mr.error = &error; ovsdb_query(table, &condition, mutate_row_cb, &mr); json_object_put(result, "count", json_integer_create(mr.n_matches)); } @@ -522,7 +524,7 @@ delete_row_cb(const struct ovsdb_row *row, void *dr_) return true; } -struct ovsdb_error * +static struct ovsdb_error * ovsdb_execute_delete(struct ovsdb_execution *x, struct ovsdb_parser *parser, struct json *result) { @@ -605,7 +607,8 @@ ovsdb_execute_wait(struct ovsdb_execution *x, struct ovsdb_parser *parser, &condition); } if (!error) { - error = ovsdb_column_set_from_json(columns_json, table, &columns); + error = ovsdb_column_set_from_json(columns_json, table->schema, + &columns); } if (!error) { if (timeout) {