#include <fcntl.h>
-#include "file.h"
+#include "log.h"
#include "json.h"
#include "ovsdb-error.h"
#include "ovsdb-parser.h"
}
\f
struct ovsdb *
-ovsdb_create(struct ovsdb_file *file, struct ovsdb_schema *schema)
+ovsdb_create(struct ovsdb_log *log, struct ovsdb_schema *schema)
{
struct shash_node *node;
struct ovsdb *db;
db = xmalloc(sizeof *db);
db->schema = schema;
- db->file = file;
+ db->log = log;
list_init(&db->triggers);
db->run_triggers = false;
{
struct ovsdb_schema *schema;
struct ovsdb_error *error;
- struct ovsdb_file *file;
+ struct ovsdb_log *log;
struct json *json;
struct ovsdb *db;
- error = ovsdb_file_open(file_name, read_only ? O_RDONLY : O_RDWR, &file);
+ error = ovsdb_log_open(file_name, read_only ? O_RDONLY : O_RDWR, &log);
if (error) {
return error;
}
- error = ovsdb_file_read(file, &json);
+ error = ovsdb_log_read(log, &json);
if (error) {
return error;
} else if (!json) {
}
json_destroy(json);
- db = ovsdb_create(read_only ? NULL : file, schema);
- while ((error = ovsdb_file_read(file, &json)) == NULL && json) {
+ db = ovsdb_create(read_only ? NULL : log, schema);
+ while ((error = ovsdb_log_read(log, &json)) == NULL && json) {
struct ovsdb_txn *txn;
error = ovsdb_txn_from_json(db, json, &txn);
}
if (read_only) {
- ovsdb_file_close(file);
+ ovsdb_log_close(log);
}
*dbp = db;
shash_clear(&db->schema->tables);
ovsdb_schema_destroy(db->schema);
- ovsdb_file_close(db->file);
+ ovsdb_log_close(db->log);
free(db);
}
}