projects
/
openvswitch
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
stream-ssl: Fix unimportant memory leak.
[openvswitch]
/
ovsdb
/
file.c
diff --git
a/ovsdb/file.c
b/ovsdb/file.c
index 377ca280f5bb57a8966421ba9d9b8fdd8ed35571..716ea89c5c7ea2c01be234ef86dd75feac4394e6 100644
(file)
--- a/
ovsdb/file.c
+++ b/
ovsdb/file.c
@@
-1,4
+1,4
@@
-/* Copyright (c) 2009 Nicira Networks
+/* Copyright (c) 2009
, 2010
Nicira Networks
*
* 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.
@@
-27,6
+27,7
@@
#include "ovsdb-error.h"
#include "row.h"
#include "table.h"
#include "ovsdb-error.h"
#include "row.h"
#include "table.h"
+#include "timeval.h"
#include "transaction.h"
#include "uuid.h"
#include "util.h"
#include "transaction.h"
#include "uuid.h"
#include "util.h"
@@
-185,6
+186,11
@@
ovsdb_file_txn_from_json(struct ovsdb *db, const struct json *json,
table = shash_find_data(&db->tables, table_name);
if (!table) {
table = shash_find_data(&db->tables, table_name);
if (!table) {
+ if (!strcmp(table_name, "_date")
+ || !strcmp(table_name, "_comment")) {
+ continue;
+ }
+
error = ovsdb_syntax_error(json, "unknown table",
"No table named %s.", table_name);
goto error;
error = ovsdb_syntax_error(json, "unknown table",
"No table named %s.", table_name);
goto error;
@@
-255,8
+261,10
@@
ovsdb_file_replica_change_cb(const struct ovsdb_row *old,
unsigned int idx = column->index;
if (idx != OVSDB_COL_UUID && column->persistent
unsigned int idx = column->index;
if (idx != OVSDB_COL_UUID && column->persistent
- && (!old || !ovsdb_datum_equals(&old->fields[idx],
- &new->fields[idx], type)))
+ && (old
+ ? !ovsdb_datum_equals(&old->fields[idx], &new->fields[idx],
+ type)
+ : !ovsdb_datum_is_default(&new->fields[idx], type)))
{
if (!row) {
row = json_object_create();
{
if (!row) {
row = json_object_create();
@@
-299,6
+307,7
@@
ovsdb_file_replica_commit(struct ovsdb_replica *r_,
struct ovsdb_file_replica *r = ovsdb_file_replica_cast(r_);
struct ovsdb_file_replica_aux aux;
struct ovsdb_error *error;
struct ovsdb_file_replica *r = ovsdb_file_replica_cast(r_);
struct ovsdb_file_replica_aux aux;
struct ovsdb_error *error;
+ const char *comment;
aux.json = NULL;
aux.table_json = NULL;
aux.json = NULL;
aux.table_json = NULL;
@@
-310,6
+319,13
@@
ovsdb_file_replica_commit(struct ovsdb_replica *r_,
return NULL;
}
return NULL;
}
+ comment = ovsdb_txn_get_comment(txn);
+ if (comment) {
+ json_object_put_string(aux.json, "_comment", comment);
+ }
+
+ json_object_put(aux.json, "_date", json_integer_create(time_now()));
+
error = ovsdb_log_write(r->log, aux.json);
json_destroy(aux.json);
if (error) {
error = ovsdb_log_write(r->log, aux.json);
json_destroy(aux.json);
if (error) {