projects
/
openvswitch
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
dpif-sflow: Remove unused parameter from dpif_sflow_create().
[openvswitch]
/
ovsdb
/
mutation.c
diff --git
a/ovsdb/mutation.c
b/ovsdb/mutation.c
index 1b422806b4aae02946693cf85f4bd8d60cc425d7..5fd983a4badfa634707db5017761a9c6eb158710 100644
(file)
--- a/
ovsdb/mutation.c
+++ b/
ovsdb/mutation.c
@@
-1,4
+1,4
@@
-/* Copyright (c) 2009, 2010
Nicira Networks
+/* Copyright (c) 2009, 2010
, 2011, 2012 Nicira, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@
-72,7
+72,7
@@
type_mismatch(const struct ovsdb_mutation *m, const struct json *json)
static WARN_UNUSED_RESULT struct ovsdb_error *
ovsdb_mutation_from_json(const struct ovsdb_table_schema *ts,
const struct json *json,
static WARN_UNUSED_RESULT struct ovsdb_error *
ovsdb_mutation_from_json(const struct ovsdb_table_schema *ts,
const struct json *json,
-
const
struct ovsdb_symbol_table *symtab,
+ struct ovsdb_symbol_table *symtab,
struct ovsdb_mutation *m)
{
const struct json_array *array;
struct ovsdb_mutation *m)
{
const struct json_array *array;
@@
-95,6
+95,12
@@
ovsdb_mutation_from_json(const struct ovsdb_table_schema *ts,
"No column %s in table %s.",
column_name, ts->name);
}
"No column %s in table %s.",
column_name, ts->name);
}
+ if (!m->column->mutable) {
+ return ovsdb_syntax_error(json, "constraint violation",
+ "Cannot mutate immutable column %s in "
+ "table %s.", column_name, ts->name);
+ }
+
ovsdb_type_clone(&m->type, &m->column->type);
mutator_name = json_string(array->elems[1]);
ovsdb_type_clone(&m->type, &m->column->type);
mutator_name = json_string(array->elems[1]);
@@
-164,7
+170,7
@@
ovsdb_mutation_free(struct ovsdb_mutation *m)
struct ovsdb_error *
ovsdb_mutation_set_from_json(const struct ovsdb_table_schema *ts,
const struct json *json,
struct ovsdb_error *
ovsdb_mutation_set_from_json(const struct ovsdb_table_schema *ts,
const struct json *json,
-
const
struct ovsdb_symbol_table *symtab,
+ struct ovsdb_symbol_table *symtab,
struct ovsdb_mutation_set *set)
{
const struct json_array *array = json_array(json);
struct ovsdb_mutation_set *set)
{
const struct json_array *array = json_array(json);
@@
-310,7
+316,7
@@
mutate_scalar(const struct ovsdb_type *dst_type, struct ovsdb_datum *dst,
}
}
}
}
- error = ovsdb_datum_sort(dst, dst_type);
+ error = ovsdb_datum_sort(dst, dst_type
->key.type
);
if (error) {
ovsdb_error_destroy(error);
return ovsdb_error("constraint violation",
if (error) {
ovsdb_error_destroy(error);
return ovsdb_error("constraint violation",
@@
-327,7
+333,7
@@
ovsdb_mutation_check_count(struct ovsdb_datum *dst,
if (!ovsdb_datum_conforms_to_type(dst, dst_type)) {
char *s = ovsdb_type_to_english(dst_type);
struct ovsdb_error *e = ovsdb_error(
if (!ovsdb_datum_conforms_to_type(dst, dst_type)) {
char *s = ovsdb_type_to_english(dst_type);
struct ovsdb_error *e = ovsdb_error(
- "constaint violation",
+ "const
r
aint violation",
"Attempted to store %u elements in %s.", dst->n, s);
free(s);
return e;
"Attempted to store %u elements in %s.", dst->n, s);
free(s);
return e;
@@
-379,6
+385,9
@@
ovsdb_mutation_set_execute(struct ovsdb_row *row,
ovsdb_datum_subtract(dst, dst_type, arg, arg_type);
error = ovsdb_mutation_check_count(dst, dst_type);
break;
ovsdb_datum_subtract(dst, dst_type, arg, arg_type);
error = ovsdb_mutation_check_count(dst, dst_type);
break;
+
+ default:
+ NOT_REACHED();
}
if (error) {
return error;
}
if (error) {
return error;