aboutsummaryrefslogtreecommitdiff
path: root/ovsdb
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2012-03-28 14:13:02 -0700
committerBen Pfaff <blp@nicira.com>2012-03-28 14:55:27 -0700
commit6e492d81450217a5c90cbb4ad31d81b1e611989b (patch)
tree6882ef2d7c93c6887a8fcc48dbed3a7b55084b95 /ovsdb
parent94c336723ca2228cfd60d2207775871e4b773c8b (diff)
Rearrange structures to better fit valgrind's memory leak heuristics.
valgrind's memory leak detector considers a pointer to the head of a memory block to be "definitely" a pointer to that memory block but a pointer to the interior of a memory block only "possibly" a pointer to that memory block. Open vSwitch hmap_node and list data structures can go anywhere inside a structure; if they are in the middle of a structure then valgrind considers pointers to them to be possible leaks. Therefore, this commit moves some of these from the middle of data structures to the head, to reduce valgrind's uncertainty. Signed-off-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'ovsdb')
-rw-r--r--ovsdb/jsonrpc-server.c4
-rw-r--r--ovsdb/row.h4
-rw-r--r--ovsdb/server.h12
3 files changed, 10 insertions, 10 deletions
diff --git a/ovsdb/jsonrpc-server.c b/ovsdb/jsonrpc-server.c
index 9e6ed257..1848bb98 100644
--- a/ovsdb/jsonrpc-server.c
+++ b/ovsdb/jsonrpc-server.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2009, 2010, 2011 Nicira Networks
+/* Copyright (c) 2009, 2010, 2011, 2012 Nicira Networks
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -295,9 +295,9 @@ ovsdb_jsonrpc_server_wait(struct ovsdb_jsonrpc_server *svr)
/* JSON-RPC database server session. */
struct ovsdb_jsonrpc_session {
+ struct list node; /* Element in remote's sessions list. */
struct ovsdb_session up;
struct ovsdb_jsonrpc_remote *remote;
- struct list node; /* Element in remote's sessions list. */
/* Triggers. */
struct hmap triggers; /* Hmap of "struct ovsdb_jsonrpc_trigger"s. */
diff --git a/ovsdb/row.h b/ovsdb/row.h
index 2fdc72ef..306a56da 100644
--- a/ovsdb/row.h
+++ b/ovsdb/row.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2009, 2010, 2011 Nicira Networks
+/* Copyright (c) 2009, 2010, 2011, 2012 Nicira Networks
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -43,8 +43,8 @@ struct ovsdb_weak_ref {
/* A row in a database table. */
struct ovsdb_row {
- struct ovsdb_table *table; /* Table to which this belongs. */
struct hmap_node hmap_node; /* Element in ovsdb_table's 'rows' hmap. */
+ struct ovsdb_table *table; /* Table to which this belongs. */
struct ovsdb_txn_row *txn_row; /* Transaction that row is in, if any. */
/* Weak references. */
diff --git a/ovsdb/server.h b/ovsdb/server.h
index a9285f79..17e42221 100644
--- a/ovsdb/server.h
+++ b/ovsdb/server.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011 Nicira Networks
+/* Copyright (c) 2011, 2012 Nicira Networks
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -39,9 +39,9 @@ struct ovsdb_lock_waiter *ovsdb_session_get_lock_waiter(
* A lock always has one or more "lock waiters" kept on a list. The waiter at
* the head of the list owns the lock. */
struct ovsdb_lock {
+ struct hmap_node hmap_node; /* In ovsdb_server's "locks" hmap. */
struct ovsdb_server *server; /* The containing server. */
char *name; /* Unique name. */
- struct hmap_node hmap_node; /* In ovsdb_server's "locks" hmap. */
struct list waiters; /* Contains "struct ovsdb_lock_waiter"s. */
};
@@ -55,14 +55,14 @@ enum ovsdb_lock_mode {
/* A session's request for a database lock. */
struct ovsdb_lock_waiter {
+ struct hmap_node session_node; /* In ->session->locks's hmap. */
+ struct ovsdb_lock *lock; /* The lock being waited for. */
+
enum ovsdb_lock_mode mode;
char *lock_name;
- struct ovsdb_lock *lock; /* The lock being waited for. */
- struct list lock_node; /* In ->lock->waiters's list. */
-
struct ovsdb_session *session;
- struct hmap_node session_node; /* In ->session->locks's hmap. */
+ struct list lock_node; /* In ->lock->waiters's list. */
};
struct ovsdb_session *ovsdb_lock_waiter_remove(struct ovsdb_lock_waiter *);