#include "bitmap.h"
#include "column.h"
-#include "dynamic-string.h"
+#include "openvswitch/dynamic-string.h"
#include "json.h"
#include "jsonrpc.h"
#include "ovsdb-error.h"
static void
ovsdb_monitor_json_cache_flush(struct ovsdb_monitor *dbmon)
{
- struct ovsdb_monitor_json_cache_node *node, *next;
+ struct ovsdb_monitor_json_cache_node *node;
- HMAP_FOR_EACH_SAFE(node, next, hmap_node, &dbmon->json_cache) {
- hmap_remove(&dbmon->json_cache, &node->hmap_node);
+ HMAP_FOR_EACH_POP(node, hmap_node, &dbmon->json_cache) {
json_destroy(node->json);
free(node);
}
jm = xzalloc(sizeof *jm);
jm->jsonrpc_monitor = jsonrpc_monitor;
- list_push_back(&dbmon->jsonrpc_monitors, &jm->node);
+ ovs_list_push_back(&dbmon->jsonrpc_monitors, &jm->node);
}
struct ovsdb_monitor *
ovsdb_replica_init(&dbmon->replica, &ovsdb_jsonrpc_replica_class);
ovsdb_add_replica(db, &dbmon->replica);
- list_init(&dbmon->jsonrpc_monitors);
+ ovs_list_init(&dbmon->jsonrpc_monitors);
dbmon->db = db;
dbmon->n_transactions = 0;
shash_init(&dbmon->tables);
{
struct jsonrpc_monitor_node *jm;
- if (list_is_empty(&dbmon->jsonrpc_monitors)) {
+ if (ovs_list_is_empty(&dbmon->jsonrpc_monitors)) {
ovsdb_monitor_destroy(dbmon);
return;
}
struct ovsdb_monitor_table *mt = node->data;
ovsdb_monitor_table_untrack_changes(mt, unflushed);
}
- list_remove(&jm->node);
+ ovs_list_remove(&jm->node);
free(jm);
/* Destroy ovsdb monitor if this is the last user. */
- if (list_is_empty(&dbmon->jsonrpc_monitors)) {
+ if (ovs_list_is_empty(&dbmon->jsonrpc_monitors)) {
ovsdb_monitor_destroy(dbmon);
}
/* New_dbmon should be associated with only one jsonrpc
* connections. */
- ovs_assert(list_is_singleton(&new_dbmon->jsonrpc_monitors));
+ ovs_assert(ovs_list_is_singleton(&new_dbmon->jsonrpc_monitors));
hash = ovsdb_monitor_hash(new_dbmon, 0);
HMAP_FOR_EACH_WITH_HASH(dbmon, hmap_node, hash, &ovsdb_monitors) {
{
struct shash_node *node;
- list_remove(&dbmon->replica.node);
+ ovs_list_remove(&dbmon->replica.node);
if (!hmap_node_is_null(&dbmon->hmap_node)) {
hmap_remove(&ovsdb_monitors, &dbmon->hmap_node);
void
ovsdb_monitor_get_memory_usage(struct simap *usage)
{
+ struct ovsdb_monitor *dbmon;
simap_put(usage, "monitors", hmap_count(&ovsdb_monitors));
+
+ HMAP_FOR_EACH(dbmon, hmap_node, &ovsdb_monitors) {
+ simap_increase(usage, "json-caches", hmap_count(&dbmon->json_cache));
+ }
}
static const struct ovsdb_replica_class ovsdb_jsonrpc_replica_class = {