git://git.onelab.eu
/
sliver-openvswitch.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
updated to new rx_recv semantics
[sliver-openvswitch.git]
/
lib
/
ovsdb-data.c
diff --git
a/lib/ovsdb-data.c
b/lib/ovsdb-data.c
index
7ec7694
..
b4b28db
100644
(file)
--- a/
lib/ovsdb-data.c
+++ b/
lib/ovsdb-data.c
@@
-24,6
+24,7
@@
#include "dynamic-string.h"
#include "hash.h"
#include "dynamic-string.h"
#include "hash.h"
+#include "ovs-thread.h"
#include "ovsdb-error.h"
#include "ovsdb-parser.h"
#include "json.h"
#include "ovsdb-error.h"
#include "ovsdb-parser.h"
#include "json.h"
@@
-57,7
+58,7
@@
ovsdb_atom_init_default(union ovsdb_atom *atom, enum ovsdb_atomic_type type)
{
switch (type) {
case OVSDB_TYPE_VOID:
{
switch (type) {
case OVSDB_TYPE_VOID:
- NOT_REACHED();
+
OVS_
NOT_REACHED();
case OVSDB_TYPE_INTEGER:
atom->integer = 0;
case OVSDB_TYPE_INTEGER:
atom->integer = 0;
@@
-81,7
+82,7
@@
ovsdb_atom_init_default(union ovsdb_atom *atom, enum ovsdb_atomic_type type)
case OVSDB_N_TYPES:
default:
case OVSDB_N_TYPES:
default:
- NOT_REACHED();
+
OVS_
NOT_REACHED();
}
}
}
}
@@
-94,9
+95,9
@@
const union ovsdb_atom *
ovsdb_atom_default(enum ovsdb_atomic_type type)
{
static union ovsdb_atom default_atoms[OVSDB_N_TYPES];
ovsdb_atom_default(enum ovsdb_atomic_type type)
{
static union ovsdb_atom default_atoms[OVSDB_N_TYPES];
- static
bool inited
;
+ static
struct ovsthread_once once = OVSTHREAD_ONCE_INITIALIZER
;
- if (
!inited
) {
+ if (
ovsthread_once_start(&once)
) {
int i;
for (i = 0; i < OVSDB_N_TYPES; i++) {
int i;
for (i = 0; i < OVSDB_N_TYPES; i++) {
@@
-104,7
+105,7
@@
ovsdb_atom_default(enum ovsdb_atomic_type type)
ovsdb_atom_init_default(&default_atoms[i], i);
}
}
ovsdb_atom_init_default(&default_atoms[i], i);
}
}
-
inited = true
;
+
ovsthread_once_done(&once)
;
}
ovs_assert(ovsdb_atomic_type_is_valid(type));
}
ovs_assert(ovsdb_atomic_type_is_valid(type));
@@
-122,7
+123,7
@@
ovsdb_atom_is_default(const union ovsdb_atom *atom,
{
switch (type) {
case OVSDB_TYPE_VOID:
{
switch (type) {
case OVSDB_TYPE_VOID:
- NOT_REACHED();
+
OVS_
NOT_REACHED();
case OVSDB_TYPE_INTEGER:
return atom->integer == 0;
case OVSDB_TYPE_INTEGER:
return atom->integer == 0;
@@
-141,7
+142,7
@@
ovsdb_atom_is_default(const union ovsdb_atom *atom,
case OVSDB_N_TYPES:
default:
case OVSDB_N_TYPES:
default:
- NOT_REACHED();
+
OVS_
NOT_REACHED();
}
}
}
}
@@
-155,7
+156,7
@@
ovsdb_atom_clone(union ovsdb_atom *new, const union ovsdb_atom *old,
{
switch (type) {
case OVSDB_TYPE_VOID:
{
switch (type) {
case OVSDB_TYPE_VOID:
- NOT_REACHED();
+
OVS_
NOT_REACHED();
case OVSDB_TYPE_INTEGER:
new->integer = old->integer;
case OVSDB_TYPE_INTEGER:
new->integer = old->integer;
@@
-179,7
+180,7
@@
ovsdb_atom_clone(union ovsdb_atom *new, const union ovsdb_atom *old,
case OVSDB_N_TYPES:
default:
case OVSDB_N_TYPES:
default:
- NOT_REACHED();
+
OVS_
NOT_REACHED();
}
}
}
}
@@
-200,7
+201,7
@@
ovsdb_atom_hash(const union ovsdb_atom *atom, enum ovsdb_atomic_type type,
{
switch (type) {
case OVSDB_TYPE_VOID:
{
switch (type) {
case OVSDB_TYPE_VOID:
- NOT_REACHED();
+
OVS_
NOT_REACHED();
case OVSDB_TYPE_INTEGER:
return hash_int(atom->integer, basis);
case OVSDB_TYPE_INTEGER:
return hash_int(atom->integer, basis);
@@
-219,7
+220,7
@@
ovsdb_atom_hash(const union ovsdb_atom *atom, enum ovsdb_atomic_type type,
case OVSDB_N_TYPES:
default:
case OVSDB_N_TYPES:
default:
- NOT_REACHED();
+
OVS_
NOT_REACHED();
}
}
}
}
@@
-232,7
+233,7
@@
ovsdb_atom_compare_3way(const union ovsdb_atom *a,
{
switch (type) {
case OVSDB_TYPE_VOID:
{
switch (type) {
case OVSDB_TYPE_VOID:
- NOT_REACHED();
+
OVS_
NOT_REACHED();
case OVSDB_TYPE_INTEGER:
return a->integer < b->integer ? -1 : a->integer > b->integer;
case OVSDB_TYPE_INTEGER:
return a->integer < b->integer ? -1 : a->integer > b->integer;
@@
-251,7
+252,7
@@
ovsdb_atom_compare_3way(const union ovsdb_atom *a,
case OVSDB_N_TYPES:
default:
case OVSDB_N_TYPES:
default:
- NOT_REACHED();
+
OVS_
NOT_REACHED();
}
}
}
}
@@
-352,7
+353,7
@@
ovsdb_atom_from_json__(union ovsdb_atom *atom,
switch (type) {
case OVSDB_TYPE_VOID:
switch (type) {
case OVSDB_TYPE_VOID:
- NOT_REACHED();
+
OVS_
NOT_REACHED();
case OVSDB_TYPE_INTEGER:
if (json->type == JSON_INTEGER) {
case OVSDB_TYPE_INTEGER:
if (json->type == JSON_INTEGER) {
@@
-393,7
+394,7
@@
ovsdb_atom_from_json__(union ovsdb_atom *atom,
case OVSDB_N_TYPES:
default:
case OVSDB_N_TYPES:
default:
- NOT_REACHED();
+
OVS_
NOT_REACHED();
}
return ovsdb_syntax_error(json, NULL, "expected %s",
}
return ovsdb_syntax_error(json, NULL, "expected %s",
@@
-442,7
+443,7
@@
ovsdb_atom_to_json(const union ovsdb_atom *atom, enum ovsdb_atomic_type type)
{
switch (type) {
case OVSDB_TYPE_VOID:
{
switch (type) {
case OVSDB_TYPE_VOID:
- NOT_REACHED();
+
OVS_
NOT_REACHED();
case OVSDB_TYPE_INTEGER:
return json_integer_create(atom->integer);
case OVSDB_TYPE_INTEGER:
return json_integer_create(atom->integer);
@@
-462,7
+463,7
@@
ovsdb_atom_to_json(const union ovsdb_atom *atom, enum ovsdb_atomic_type type)
case OVSDB_N_TYPES:
default:
case OVSDB_N_TYPES:
default:
- NOT_REACHED();
+
OVS_
NOT_REACHED();
}
}
}
}
@@
-475,7
+476,7
@@
ovsdb_atom_json_length(const union ovsdb_atom *atom,
switch (type) {
case OVSDB_TYPE_VOID:
switch (type) {
case OVSDB_TYPE_VOID:
- NOT_REACHED();
+
OVS_
NOT_REACHED();
case OVSDB_TYPE_INTEGER:
json.type = JSON_INTEGER;
case OVSDB_TYPE_INTEGER:
json.type = JSON_INTEGER;
@@
-501,7
+502,7
@@
ovsdb_atom_json_length(const union ovsdb_atom *atom,
case OVSDB_N_TYPES:
default:
case OVSDB_N_TYPES:
default:
- NOT_REACHED();
+
OVS_
NOT_REACHED();
}
return json_serialized_length(&json);
}
return json_serialized_length(&json);
@@
-516,7
+517,7
@@
ovsdb_atom_from_string__(union ovsdb_atom *atom,
switch (type) {
case OVSDB_TYPE_VOID:
switch (type) {
case OVSDB_TYPE_VOID:
- NOT_REACHED();
+
OVS_
NOT_REACHED();
case OVSDB_TYPE_INTEGER: {
long long int integer;
case OVSDB_TYPE_INTEGER: {
long long int integer;
@@
-584,7
+585,7
@@
ovsdb_atom_from_string__(union ovsdb_atom *atom,
case OVSDB_N_TYPES:
default:
case OVSDB_N_TYPES:
default:
- NOT_REACHED();
+
OVS_
NOT_REACHED();
}
return NULL;
}
return NULL;
@@
-670,7
+671,7
@@
ovsdb_atom_to_string(const union ovsdb_atom *atom, enum ovsdb_atomic_type type,
{
switch (type) {
case OVSDB_TYPE_VOID:
{
switch (type) {
case OVSDB_TYPE_VOID:
- NOT_REACHED();
+
OVS_
NOT_REACHED();
case OVSDB_TYPE_INTEGER:
ds_put_format(out, "%"PRId64, atom->integer);
case OVSDB_TYPE_INTEGER:
ds_put_format(out, "%"PRId64, atom->integer);
@@
-702,7
+703,7
@@
ovsdb_atom_to_string(const union ovsdb_atom *atom, enum ovsdb_atomic_type type,
case OVSDB_N_TYPES:
default:
case OVSDB_N_TYPES:
default:
- NOT_REACHED();
+
OVS_
NOT_REACHED();
}
}
}
}
@@
-740,12
+741,12
@@
check_string_constraints(const char *s,
if (n_chars < c->minLen) {
return ovsdb_error(
"constraint violation",
if (n_chars < c->minLen) {
return ovsdb_error(
"constraint violation",
- "\"%s\" length %
zu
is less than minimum allowed "
+ "\"%s\" length %
"PRIuSIZE"
is less than minimum allowed "
"length %u", s, n_chars, c->minLen);
} else if (n_chars > c->maxLen) {
return ovsdb_error(
"constraint violation",
"length %u", s, n_chars, c->minLen);
} else if (n_chars > c->maxLen) {
return ovsdb_error(
"constraint violation",
- "\"%s\" length %
zu
is greater than maximum allowed "
+ "\"%s\" length %
"PRIuSIZE"
is greater than maximum allowed "
"length %u", s, n_chars, c->maxLen);
}
"length %u", s, n_chars, c->maxLen);
}
@@
-783,7
+784,7
@@
ovsdb_atom_check_constraints(const union ovsdb_atom *atom,
switch (base->type) {
case OVSDB_TYPE_VOID:
switch (base->type) {
case OVSDB_TYPE_VOID:
- NOT_REACHED();
+
OVS_
NOT_REACHED();
case OVSDB_TYPE_INTEGER:
if (atom->integer >= base->u.integer.min
case OVSDB_TYPE_INTEGER:
if (atom->integer >= base->u.integer.min
@@
-808,7
+809,7
@@
ovsdb_atom_check_constraints(const union ovsdb_atom *atom,
"value %"PRId64,
atom->integer, base->u.integer.max);
}
"value %"PRId64,
atom->integer, base->u.integer.max);
}
- NOT_REACHED();
+
OVS_
NOT_REACHED();
case OVSDB_TYPE_REAL:
if (atom->real >= base->u.real.min && atom->real <= base->u.real.max) {
case OVSDB_TYPE_REAL:
if (atom->real >= base->u.real.min && atom->real <= base->u.real.max) {
@@
-835,7
+836,7
@@
ovsdb_atom_check_constraints(const union ovsdb_atom *atom,
DBL_DIG, atom->real,
DBL_DIG, base->u.real.max);
}
DBL_DIG, atom->real,
DBL_DIG, base->u.real.max);
}
- NOT_REACHED();
+
OVS_
NOT_REACHED();
case OVSDB_TYPE_BOOLEAN:
return NULL;
case OVSDB_TYPE_BOOLEAN:
return NULL;
@@
-848,7
+849,7
@@
ovsdb_atom_check_constraints(const union ovsdb_atom *atom,
case OVSDB_N_TYPES:
default:
case OVSDB_N_TYPES:
default:
- NOT_REACHED();
+
OVS_
NOT_REACHED();
}
}
\f
}
}
\f
@@
-932,7
+933,7
@@
ovsdb_datum_default(const struct ovsdb_type *type)
}
return d;
} else {
}
return d;
} else {
- NOT_REACHED();
+
OVS_
NOT_REACHED();
}
}
}
}
@@
-1118,7
+1119,7
@@
ovsdb_datum_sort_assert(struct ovsdb_datum *datum,
{
struct ovsdb_error *error = ovsdb_datum_sort(datum, key_type);
if (error) {
{
struct ovsdb_error *error = ovsdb_datum_sort(datum, key_type);
if (error) {
- NOT_REACHED();
+
OVS_
NOT_REACHED();
}
}
}
}
@@
-1223,7
+1224,7
@@
ovsdb_datum_from_json__(struct ovsdb_datum *datum,
n = inner->u.array.n;
if (n < type->n_min || n > type->n_max) {
return ovsdb_syntax_error(json, NULL, "%s must have %u to "
n = inner->u.array.n;
if (n < type->n_min || n > type->n_max) {
return ovsdb_syntax_error(json, NULL, "%s must have %u to "
- "%u members but %
zu
are present",
+ "%u members but %
"PRIuSIZE"
are present",
class, type->n_min, type->n_max, n);
}
class, type->n_min, type->n_max, n);
}