projects
/
openvswitch
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
random: Get random seed from /dev/urandom.
[openvswitch]
/
ovsdb
/
execution.c
diff --git
a/ovsdb/execution.c
b/ovsdb/execution.c
index 0465f03885fcdf026df7e8d4559eb598ea0d9d41..5b6762f0753ff7b9f0e451ba9626352134f61674 100644
(file)
--- a/
ovsdb/execution.c
+++ b/
ovsdb/execution.c
@@
-99,10
+99,19
@@
ovsdb_execute(struct ovsdb *db, const struct json *params,
size_t n_operations;
size_t i;
size_t n_operations;
size_t i;
- if (params->type != JSON_ARRAY) {
+ 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)) {
struct ovsdb_error *error;
struct ovsdb_error *error;
- error = ovsdb_syntax_error(params, NULL, "array expected");
+ if (params->type != JSON_ARRAY) {
+ error = ovsdb_syntax_error(params, NULL, "array expected");
+ } else {
+ error = ovsdb_syntax_error(params, NULL, "database name expected "
+ "as first parameter");
+ }
+
results = ovsdb_error_to_json(error);
ovsdb_error_destroy(error);
return results;
results = ovsdb_error_to_json(error);
ovsdb_error_destroy(error);
return results;
@@
-117,9
+126,9
@@
ovsdb_execute(struct ovsdb *db, const struct json *params,
results = NULL;
results = json_array_create_empty();
results = NULL;
results = json_array_create_empty();
- n_operations = params->u.array.n;
+ n_operations = params->u.array.n
- 1
;
error = NULL;
error = NULL;
- for (i =
0; i <
n_operations; i++) {
+ for (i =
1; i <=
n_operations; i++) {
struct json *operation = params->u.array.elems[i];
struct ovsdb_error *parse_error;
struct ovsdb_parser parser;
struct json *operation = params->u.array.elems[i];
struct ovsdb_error *parse_error;
struct ovsdb_parser parser;
@@
-128,7
+137,7
@@
ovsdb_execute(struct ovsdb *db, const struct json *params,
/* Parse and execute operation. */
ovsdb_parser_init(&parser, operation,
/* Parse and execute operation. */
ovsdb_parser_init(&parser, operation,
- "ovsdb operation %zu of %zu", i
+ 1
, n_operations);
+ "ovsdb operation %zu of %zu", i, n_operations);
op = ovsdb_parser_member(&parser, "op", OP_ID);
result = json_object_create();
if (op) {
op = ovsdb_parser_member(&parser, "op", OP_ID);
result = json_object_create();
if (op) {
@@
-195,7
+204,7
@@
exit:
struct ovsdb_error *
ovsdb_execute_commit(struct ovsdb_execution *x, struct ovsdb_parser *parser,
struct ovsdb_error *
ovsdb_execute_commit(struct ovsdb_execution *x, struct ovsdb_parser *parser,
- struct json *result UNUSED)
+ struct json *result
OVS_
UNUSED)
{
const struct json *durable;
{
const struct json *durable;
@@
-207,9
+216,9
@@
ovsdb_execute_commit(struct ovsdb_execution *x, struct ovsdb_parser *parser,
}
static struct ovsdb_error *
}
static struct ovsdb_error *
-ovsdb_execute_abort(struct ovsdb_execution *x UNUSED,
- struct ovsdb_parser *parser UNUSED,
- struct json *result UNUSED)
+ovsdb_execute_abort(struct ovsdb_execution *x
OVS_
UNUSED,
+ struct ovsdb_parser *parser
OVS_
UNUSED,
+ struct json *result
OVS_
UNUSED)
{
return ovsdb_error("aborted", "aborted by request");
}
{
return ovsdb_error("aborted", "aborted by request");
}
@@
-570,7
+579,7
@@
ovsdb_execute_wait_query_cb(const struct ovsdb_row *row, void *aux_)
static struct ovsdb_error *
ovsdb_execute_wait(struct ovsdb_execution *x, struct ovsdb_parser *parser,
static struct ovsdb_error *
ovsdb_execute_wait(struct ovsdb_execution *x, struct ovsdb_parser *parser,
- struct json *result UNUSED)
+ struct json *result
OVS_
UNUSED)
{
struct ovsdb_table *table;
const struct json *timeout, *where, *columns_json, *until, *rows;
{
struct ovsdb_table *table;
const struct json *timeout, *where, *columns_json, *until, *rows;
@@
-683,7
+692,7
@@
ovsdb_execute_wait(struct ovsdb_execution *x, struct ovsdb_parser *parser,
static struct ovsdb_error *
ovsdb_execute_comment(struct ovsdb_execution *x, struct ovsdb_parser *parser,
static struct ovsdb_error *
ovsdb_execute_comment(struct ovsdb_execution *x, struct ovsdb_parser *parser,
- struct json *result UNUSED)
+ struct json *result
OVS_
UNUSED)
{
const struct json *comment;
{
const struct json *comment;