diff mbox

[ovs-dev,1/2] Move lib/json.h to include/openvswitch

Message ID 1468359455-77353-2-git-send-email-twilson@redhat.com
State Accepted
Headers show

Commit Message

Terry Wilson July 12, 2016, 9:37 p.m. UTC
To easily allow both in- and out-of-tree building of the Python
wrapper for the OVS JSON parser (e.g. w/ pip), move json.h to
include/openvswitch. This also requires moving lib/{hmap,shash}.h.

Both hmap.h and shash.h were #include-ing "util.h" even though the
headers themselves did not use anything from there, but rather from
include/openvswitch/util.h. Fixing that required including util.h
in several C files mostly due to OVS_NOT_REACHED and things like
xmalloc.

Signed-off-by: Terry Wilson <twilson@redhat.com>
---
 include/openvswitch/automake.mk |   3 +
 include/openvswitch/hmap.h      | 407 ++++++++++++++++++++++++++++++++++++++++
 include/openvswitch/json.h      | 141 ++++++++++++++
 include/openvswitch/shash.h     |  81 ++++++++
 lib/automake.mk                 |   3 -
 lib/bfd.c                       |   2 +-
 lib/bundle.c                    |   1 +
 lib/cfm.c                       |   3 +-
 lib/cfm.h                       |   2 +-
 lib/db-ctl-base.c               |   4 +-
 lib/db-ctl-base.h               |   2 +-
 lib/dpctl.c                     |   2 +-
 lib/dpif-netdev.c               |   2 +-
 lib/dpif-netlink.c              |   2 +-
 lib/dpif.c                      |   2 +-
 lib/fat-rwlock.c                |   2 +-
 lib/fatal-signal.c              |   2 +-
 lib/flow.c                      |   1 +
 lib/hmap.c                      |   2 +-
 lib/hmap.h                      | 407 ----------------------------------------
 lib/hmapx.h                     |   2 +-
 lib/id-pool.c                   |   2 +-
 lib/json.c                      |   4 +-
 lib/json.h                      | 140 --------------
 lib/jsonrpc.c                   |   2 +-
 lib/lacp.c                      |   5 +-
 lib/learning-switch.c           |   4 +-
 lib/lockfile.c                  |   2 +-
 lib/mac-learning.h              |   2 +-
 lib/mcast-snooping.h            |   2 +-
 lib/meta-flow.c                 |   2 +-
 lib/multipath.c                 |   1 +
 lib/netdev-bsd.c                |   2 +-
 lib/netdev-dpdk.c               |   2 +-
 lib/netdev-dummy.c              |   2 +-
 lib/netdev-linux.c              |   5 +-
 lib/netdev-provider.h           |   2 +-
 lib/netdev-windows.c            |   2 +-
 lib/netdev.c                    |   2 +-
 lib/netlink-conntrack.h         |   2 +-
 lib/netlink-socket.c            |   2 +-
 lib/netlink.c                   |   1 +
 lib/nx-match.c                  |   4 +-
 lib/odp-util.h                  |   2 +-
 lib/ofp-actions.c               |   2 +-
 lib/ofp-msgs.c                  |   3 +-
 lib/ofp-parse.c                 |   1 +
 lib/ofp-util.c                  |   1 +
 lib/ovs-lldp.h                  |   2 +-
 lib/ovs-numa.c                  |   2 +-
 lib/ovs-rcu.c                   |   1 +
 lib/ovsdb-data.c                |   5 +-
 lib/ovsdb-data.h                |   2 +-
 lib/ovsdb-error.c               |   2 +-
 lib/ovsdb-idl-provider.h        |   4 +-
 lib/ovsdb-idl.c                 |   4 +-
 lib/ovsdb-map-op.c              |   2 +-
 lib/ovsdb-parser.h              |   2 +-
 lib/ovsdb-types.c               |   3 +-
 lib/packets.c                   |   2 +-
 lib/pcap-file.c                 |   3 +-
 lib/perf-counter.c              |   2 +-
 lib/poll-loop.c                 |   2 +-
 lib/reconnect.c                 |   1 +
 lib/rstp-common.h               |   2 +-
 lib/seq.c                       |   2 +-
 lib/shash.c                     |   2 +-
 lib/shash.h                     |  81 --------
 lib/simap.h                     |   2 +-
 lib/smap.c                      |   2 +-
 lib/smap.h                      |   2 +-
 lib/sset.h                      |   2 +-
 lib/stream-ssl.c                |   2 +-
 lib/table.c                     |   2 +-
 lib/timeval.c                   |   2 +-
 lib/tun-metadata.c              |   3 +-
 lib/unixctl.c                   |   4 +-
 lib/util.h                      |   1 +
 ofproto/bond.c                  |   5 +-
 ofproto/bundles.c               |   2 +-
 ofproto/connmgr.c               |   3 +-
 ofproto/connmgr.h               |   2 +-
 ofproto/ofproto-dpif-ipfix.c    |   2 +-
 ofproto/ofproto-dpif-mirror.c   |   2 +-
 ofproto/ofproto-dpif-monitor.c  |   2 +-
 ofproto/ofproto-dpif-sflow.c    |   2 +-
 ofproto/ofproto-dpif-xlate.c    |   1 +
 ofproto/ofproto-dpif.c          |   1 +
 ofproto/ofproto-provider.h      |   2 +-
 ofproto/ofproto.c               |   5 +-
 ofproto/pinsched.c              |   2 +-
 ofproto/tunnel.c                |   2 +-
 ovn/controller-vtep/binding.c   |   2 +-
 ovn/controller-vtep/vtep.c      |   4 +-
 ovn/controller/binding.c        |   2 +-
 ovn/controller/chassis.c        |   1 +
 ovn/controller/lport.h          |   2 +-
 ovn/controller/ofctrl.c         |   2 +-
 ovn/controller/ovn-controller.c |   2 +-
 ovn/controller/patch.c          |   2 +-
 ovn/controller/physical.c       |   3 +-
 ovn/lib/actions.c               |   4 +-
 ovn/lib/actions.h               |   2 +-
 ovn/lib/expr.c                  |   5 +-
 ovn/lib/expr.h                  |   2 +-
 ovn/lib/lex.c                   |   2 +-
 ovn/lib/ovn-dhcp.h              |   2 +-
 ovn/northd/ovn-northd.c         |   4 +-
 ovn/utilities/ovn-nbctl.c       |   2 +-
 ovn/utilities/ovn-sbctl.c       |   4 +-
 ovsdb/column.c                  |   2 +-
 ovsdb/condition.c               |   6 +-
 ovsdb/execution.c               |   2 +-
 ovsdb/file.c                    |   2 +-
 ovsdb/jsonrpc-server.c          |   3 +-
 ovsdb/log.c                     |   2 +-
 ovsdb/monitor.c                 |   3 +-
 ovsdb/mutation.c                |   6 +-
 ovsdb/ovsdb-client.c            |   2 +-
 ovsdb/ovsdb-server.c            |   4 +-
 ovsdb/ovsdb-tool.c              |   2 +-
 ovsdb/ovsdb.c                   |   2 +-
 ovsdb/ovsdb.h                   |   4 +-
 ovsdb/replication.c             |   2 +-
 ovsdb/replication.h             |   2 +-
 ovsdb/row.c                     |   5 +-
 ovsdb/row.h                     |   2 +-
 ovsdb/server.h                  |   4 +-
 ovsdb/table.c                   |   2 +-
 ovsdb/table.h                   |   4 +-
 ovsdb/transaction.c             |   4 +-
 ovsdb/trigger.c                 |   2 +-
 python/ovs/_json.c              |   2 +-
 tests/test-ccmap.c              |   2 +-
 tests/test-cmap.c               |   2 +-
 tests/test-hmap.c               |   2 +-
 tests/test-json.c               |   2 +-
 tests/test-jsonrpc.c            |   2 +-
 tests/test-ovn.c                |   2 +-
 tests/test-ovsdb.c              |   2 +-
 utilities/ovs-vsctl.c           |   2 +-
 vswitchd/bridge.c               |   4 +-
 vswitchd/system-stats.c         |   4 +-
 vtep/vtep-ctl.c                 |   2 +-
 144 files changed, 817 insertions(+), 780 deletions(-)
 create mode 100644 include/openvswitch/hmap.h
 create mode 100644 include/openvswitch/json.h
 create mode 100644 include/openvswitch/shash.h
 delete mode 100644 lib/hmap.h
 delete mode 100644 lib/json.h
 delete mode 100644 lib/shash.h

Comments

Ben Pfaff July 23, 2016, 12:09 a.m. UTC | #1
On Tue, Jul 12, 2016 at 04:37:34PM -0500, Terry Wilson wrote:
> To easily allow both in- and out-of-tree building of the Python
> wrapper for the OVS JSON parser (e.g. w/ pip), move json.h to
> include/openvswitch. This also requires moving lib/{hmap,shash}.h.
> 
> Both hmap.h and shash.h were #include-ing "util.h" even though the
> headers themselves did not use anything from there, but rather from
> include/openvswitch/util.h. Fixing that required including util.h
> in several C files mostly due to OVS_NOT_REACHED and things like
> xmalloc.
> 
> Signed-off-by: Terry Wilson <twilson@redhat.com>

Applied, thanks!
diff mbox

Patch

diff --git a/include/openvswitch/automake.mk b/include/openvswitch/automake.mk
index d8541dc..c0e276f 100644
--- a/include/openvswitch/automake.mk
+++ b/include/openvswitch/automake.mk
@@ -2,8 +2,10 @@  openvswitchincludedir = $(includedir)/openvswitch
 openvswitchinclude_HEADERS = \
 	include/openvswitch/compiler.h \
 	include/openvswitch/dynamic-string.h \
+	include/openvswitch/hmap.h \
 	include/openvswitch/flow.h \
 	include/openvswitch/geneve.h \
+	include/openvswitch/json.h \
 	include/openvswitch/list.h \
 	include/openvswitch/netdev.h \
 	include/openvswitch/match.h \
@@ -17,6 +19,7 @@  openvswitchinclude_HEADERS = \
 	include/openvswitch/ofp-prop.h \
 	include/openvswitch/ofp-util.h \
 	include/openvswitch/packets.h \
+	include/openvswitch/shash.h \
 	include/openvswitch/thread.h \
 	include/openvswitch/token-bucket.h \
 	include/openvswitch/tun-metadata.h \
diff --git a/include/openvswitch/hmap.h b/include/openvswitch/hmap.h
new file mode 100644
index 0000000..ef272a6
--- /dev/null
+++ b/include/openvswitch/hmap.h
@@ -0,0 +1,407 @@ 
+/*
+ * Copyright (c) 2008, 2009, 2010, 2012, 2013, 2015, 2016 Nicira, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef HMAP_H
+#define HMAP_H 1
+
+#include <stdbool.h>
+#include <stdlib.h>
+#include "openvswitch/util.h"
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+/* A hash map node, to be embedded inside the data structure being mapped. */
+struct hmap_node {
+    size_t hash;                /* Hash value. */
+    struct hmap_node *next;     /* Next in linked list. */
+};
+
+/* Returns the hash value embedded in 'node'. */
+static inline size_t hmap_node_hash(const struct hmap_node *node)
+{
+    return node->hash;
+}
+
+#define HMAP_NODE_NULL ((struct hmap_node *) 1)
+#define HMAP_NODE_NULL_INITIALIZER { 0, HMAP_NODE_NULL }
+
+/* Returns true if 'node' has been set to null by hmap_node_nullify() and has
+ * not been un-nullified by being inserted into an hmap. */
+static inline bool
+hmap_node_is_null(const struct hmap_node *node)
+{
+    return node->next == HMAP_NODE_NULL;
+}
+
+/* Marks 'node' with a distinctive value that can be tested with
+ * hmap_node_is_null().  */
+static inline void
+hmap_node_nullify(struct hmap_node *node)
+{
+    node->next = HMAP_NODE_NULL;
+}
+
+/* A hash map. */
+struct hmap {
+    struct hmap_node **buckets; /* Must point to 'one' iff 'mask' == 0. */
+    struct hmap_node *one;
+    size_t mask;
+    size_t n;
+};
+
+/* Initializer for an empty hash map. */
+#define HMAP_INITIALIZER(HMAP) \
+    { (struct hmap_node **const) &(HMAP)->one, NULL, 0, 0 }
+
+/* Initializer for an immutable struct hmap 'HMAP' that contains a single
+ * 'NODE'. */
+#define HMAP_CONST1(HMAP, NODE) {                                   \
+        CONST_CAST(struct hmap_node **, &(HMAP)->one), NODE, 0, 1 }
+#define HMAP_NODE_INIT(HASH) { HASH, NULL }
+
+/* Initialization. */
+void hmap_init(struct hmap *);
+void hmap_destroy(struct hmap *);
+void hmap_clear(struct hmap *);
+void hmap_swap(struct hmap *a, struct hmap *b);
+void hmap_moved(struct hmap *hmap);
+static inline size_t hmap_count(const struct hmap *);
+static inline bool hmap_is_empty(const struct hmap *);
+
+/* Adjusting capacity. */
+void hmap_expand_at(struct hmap *, const char *where);
+#define hmap_expand(HMAP) hmap_expand_at(HMAP, OVS_SOURCE_LOCATOR)
+
+void hmap_shrink_at(struct hmap *, const char *where);
+#define hmap_shrink(HMAP) hmap_shrink_at(HMAP, OVS_SOURCE_LOCATOR)
+
+void hmap_reserve_at(struct hmap *, size_t capacity, const char *where);
+#define hmap_reserve(HMAP, CAPACITY) \
+    hmap_reserve_at(HMAP, CAPACITY, OVS_SOURCE_LOCATOR)
+
+/* Insertion and deletion. */
+static inline void hmap_insert_at(struct hmap *, struct hmap_node *,
+                                  size_t hash, const char *where);
+#define hmap_insert(HMAP, NODE, HASH) \
+    hmap_insert_at(HMAP, NODE, HASH, OVS_SOURCE_LOCATOR)
+
+static inline void hmap_insert_fast(struct hmap *,
+                                    struct hmap_node *, size_t hash);
+static inline void hmap_remove(struct hmap *, struct hmap_node *);
+
+void hmap_node_moved(struct hmap *, struct hmap_node *, struct hmap_node *);
+static inline void hmap_replace(struct hmap *, const struct hmap_node *old,
+                                struct hmap_node *new_node);
+
+struct hmap_node *hmap_random_node(const struct hmap *);
+
+/* Search.
+ *
+ * HMAP_FOR_EACH_WITH_HASH iterates NODE over all of the nodes in HMAP that
+ * have hash value equal to HASH.  HMAP_FOR_EACH_IN_BUCKET iterates NODE over
+ * all of the nodes in HMAP that would fall in the same bucket as HASH.  MEMBER
+ * must be the name of the 'struct hmap_node' member within NODE.
+ *
+ * These macros may be used interchangeably to search for a particular value in
+ * an hmap, see, e.g. shash_find() for an example.  Usually, using
+ * HMAP_FOR_EACH_WITH_HASH provides an optimization, because comparing a hash
+ * value is usually cheaper than comparing an entire hash map key.  But for
+ * simple hash map keys, it makes sense to use HMAP_FOR_EACH_IN_BUCKET because
+ * it avoids doing two comparisons when a single simple comparison suffices.
+ *
+ * The loop should not change NODE to point to a different node or insert or
+ * delete nodes in HMAP (unless it "break"s out of the loop to terminate
+ * iteration).
+ *
+ * HASH is only evaluated once.
+ *
+ * When the loop terminates normally, meaning the iteration has completed
+ * without using 'break', NODE will be NULL.  This is true for all of the
+ * HMAP_FOR_EACH_*() macros.
+ */
+#define HMAP_FOR_EACH_WITH_HASH(NODE, MEMBER, HASH, HMAP)               \
+    for (INIT_CONTAINER(NODE, hmap_first_with_hash(HMAP, HASH), MEMBER); \
+         (NODE != OBJECT_CONTAINING(NULL, NODE, MEMBER)) || (NODE = NULL); \
+         ASSIGN_CONTAINER(NODE, hmap_next_with_hash(&(NODE)->MEMBER),   \
+                          MEMBER))
+#define HMAP_FOR_EACH_IN_BUCKET(NODE, MEMBER, HASH, HMAP)               \
+    for (INIT_CONTAINER(NODE, hmap_first_in_bucket(HMAP, HASH), MEMBER); \
+         (NODE != OBJECT_CONTAINING(NULL, NODE, MEMBER)) || (NODE = NULL); \
+         ASSIGN_CONTAINER(NODE, hmap_next_in_bucket(&(NODE)->MEMBER), MEMBER))
+
+static inline struct hmap_node *hmap_first_with_hash(const struct hmap *,
+                                                     size_t hash);
+static inline struct hmap_node *hmap_next_with_hash(const struct hmap_node *);
+static inline struct hmap_node *hmap_first_in_bucket(const struct hmap *,
+                                                     size_t hash);
+static inline struct hmap_node *hmap_next_in_bucket(const struct hmap_node *);
+
+bool hmap_contains(const struct hmap *, const struct hmap_node *);
+
+/* Iteration.
+ *
+ * The *_INIT variants of these macros additionally evaluate the expressions
+ * supplied following the HMAP argument once during the loop initialization.
+ * This makes it possible for data structures that wrap around hmaps to insert
+ * additional initialization into their iteration macros without having to
+ * completely rewrite them.  In particular, it can be a good idea to insert
+ * BUILD_ASSERT_TYPE checks for map and node types that wrap hmap, since
+ * otherwise it is possible for clients to accidentally confuse two derived
+ * data structures that happen to use the same member names for struct hmap and
+ * struct hmap_node. */
+
+/* Iterates through every node in HMAP. */
+#define HMAP_FOR_EACH(NODE, MEMBER, HMAP) \
+    HMAP_FOR_EACH_INIT(NODE, MEMBER, HMAP, (void) 0)
+#define HMAP_FOR_EACH_INIT(NODE, MEMBER, HMAP, ...)                     \
+    for (INIT_CONTAINER(NODE, hmap_first(HMAP), MEMBER), __VA_ARGS__;   \
+         (NODE != OBJECT_CONTAINING(NULL, NODE, MEMBER)) || (NODE = NULL); \
+         ASSIGN_CONTAINER(NODE, hmap_next(HMAP, &(NODE)->MEMBER), MEMBER))
+
+/* Safe when NODE may be freed (not needed when NODE may be removed from the
+ * hash map but its members remain accessible and intact). */
+#define HMAP_FOR_EACH_SAFE(NODE, NEXT, MEMBER, HMAP) \
+    HMAP_FOR_EACH_SAFE_INIT(NODE, NEXT, MEMBER, HMAP, (void) 0)
+#define HMAP_FOR_EACH_SAFE_INIT(NODE, NEXT, MEMBER, HMAP, ...)          \
+    for (INIT_CONTAINER(NODE, hmap_first(HMAP), MEMBER), __VA_ARGS__;   \
+         ((NODE != OBJECT_CONTAINING(NULL, NODE, MEMBER)) || (NODE = NULL) \
+          ? INIT_CONTAINER(NEXT, hmap_next(HMAP, &(NODE)->MEMBER), MEMBER), 1 \
+          : 0);                                                         \
+         (NODE) = (NEXT))
+
+/* Continues an iteration from just after NODE. */
+#define HMAP_FOR_EACH_CONTINUE(NODE, MEMBER, HMAP) \
+    HMAP_FOR_EACH_CONTINUE_INIT(NODE, MEMBER, HMAP, (void) 0)
+#define HMAP_FOR_EACH_CONTINUE_INIT(NODE, MEMBER, HMAP, ...)            \
+    for (ASSIGN_CONTAINER(NODE, hmap_next(HMAP, &(NODE)->MEMBER), MEMBER), \
+         __VA_ARGS__;                                                   \
+         (NODE != OBJECT_CONTAINING(NULL, NODE, MEMBER)) || (NODE = NULL); \
+         ASSIGN_CONTAINER(NODE, hmap_next(HMAP, &(NODE)->MEMBER), MEMBER))
+
+static inline struct hmap_node *
+hmap_pop_helper__(struct hmap *hmap, size_t *bucket) {
+
+    for (; *bucket <= hmap->mask; (*bucket)++) {
+        struct hmap_node *node = hmap->buckets[*bucket];
+
+        if (node) {
+            hmap_remove(hmap, node);
+            return node;
+        }
+    }
+
+    return NULL;
+}
+
+#define HMAP_FOR_EACH_POP(NODE, MEMBER, HMAP)                               \
+    for (size_t bucket__ = 0;                                               \
+         INIT_CONTAINER(NODE, hmap_pop_helper__(HMAP, &bucket__), MEMBER),  \
+         (NODE != OBJECT_CONTAINING(NULL, NODE, MEMBER)) || (NODE = NULL);)
+
+static inline struct hmap_node *hmap_first(const struct hmap *);
+static inline struct hmap_node *hmap_next(const struct hmap *,
+                                          const struct hmap_node *);
+
+struct hmap_position {
+    unsigned int bucket;
+    unsigned int offset;
+};
+
+struct hmap_node *hmap_at_position(const struct hmap *,
+                                   struct hmap_position *);
+
+/* Returns the number of nodes currently in 'hmap'. */
+static inline size_t
+hmap_count(const struct hmap *hmap)
+{
+    return hmap->n;
+}
+
+/* Returns the maximum number of nodes that 'hmap' may hold before it should be
+ * rehashed. */
+static inline size_t
+hmap_capacity(const struct hmap *hmap)
+{
+    return hmap->mask * 2 + 1;
+}
+
+/* Returns true if 'hmap' currently contains no nodes,
+ * false otherwise.
+ * Note: While hmap in general is not thread-safe without additional locking,
+ * hmap_is_empty() is. */
+static inline bool
+hmap_is_empty(const struct hmap *hmap)
+{
+    return hmap->n == 0;
+}
+
+/* Inserts 'node', with the given 'hash', into 'hmap'.  'hmap' is never
+ * expanded automatically. */
+static inline void
+hmap_insert_fast(struct hmap *hmap, struct hmap_node *node, size_t hash)
+{
+    struct hmap_node **bucket = &hmap->buckets[hash & hmap->mask];
+    node->hash = hash;
+    node->next = *bucket;
+    *bucket = node;
+    hmap->n++;
+}
+
+/* Inserts 'node', with the given 'hash', into 'hmap', and expands 'hmap' if
+ * necessary to optimize search performance.
+ *
+ * ('where' is used in debug logging.  Commonly one would use hmap_insert() to
+ * automatically provide the caller's source file and line number for
+ * 'where'.) */
+static inline void
+hmap_insert_at(struct hmap *hmap, struct hmap_node *node, size_t hash,
+               const char *where)
+{
+    hmap_insert_fast(hmap, node, hash);
+    if (hmap->n / 2 > hmap->mask) {
+        hmap_expand_at(hmap, where);
+    }
+}
+
+/* Removes 'node' from 'hmap'.  Does not shrink the hash table; call
+ * hmap_shrink() directly if desired. */
+static inline void
+hmap_remove(struct hmap *hmap, struct hmap_node *node)
+{
+    struct hmap_node **bucket = &hmap->buckets[node->hash & hmap->mask];
+    while (*bucket != node) {
+        bucket = &(*bucket)->next;
+    }
+    *bucket = node->next;
+    hmap->n--;
+}
+
+/* Puts 'new_node' in the position in 'hmap' currently occupied by 'old_node'.
+ * The 'new_node' must hash to the same value as 'old_node'.  The client is
+ * responsible for ensuring that the replacement does not violate any
+ * client-imposed invariants (e.g. uniqueness of keys within a map).
+ *
+ * Afterward, 'old_node' is not part of 'hmap', and the client is responsible
+ * for freeing it (if this is desirable). */
+static inline void
+hmap_replace(struct hmap *hmap,
+             const struct hmap_node *old_node, struct hmap_node *new_node)
+{
+    struct hmap_node **bucket = &hmap->buckets[old_node->hash & hmap->mask];
+    while (*bucket != old_node) {
+        bucket = &(*bucket)->next;
+    }
+    *bucket = new_node;
+    new_node->hash = old_node->hash;
+    new_node->next = old_node->next;
+}
+
+static inline struct hmap_node *
+hmap_next_with_hash__(const struct hmap_node *node, size_t hash)
+{
+    while (node != NULL && node->hash != hash) {
+        node = node->next;
+    }
+    return CONST_CAST(struct hmap_node *, node);
+}
+
+/* Returns the first node in 'hmap' with the given 'hash', or a null pointer if
+ * no nodes have that hash value. */
+static inline struct hmap_node *
+hmap_first_with_hash(const struct hmap *hmap, size_t hash)
+{
+    return hmap_next_with_hash__(hmap->buckets[hash & hmap->mask], hash);
+}
+
+/* Returns the first node in 'hmap' in the bucket in which the given 'hash'
+ * would land, or a null pointer if that bucket is empty. */
+static inline struct hmap_node *
+hmap_first_in_bucket(const struct hmap *hmap, size_t hash)
+{
+    return hmap->buckets[hash & hmap->mask];
+}
+
+/* Returns the next node in the same bucket as 'node', or a null pointer if
+ * there are no more nodes in that bucket.
+ *
+ * If the hash map has been reallocated since 'node' was visited, some nodes
+ * may be skipped; if new nodes with the same hash value have been added, they
+ * will be skipped.  (Removing 'node' from the hash map does not prevent
+ * calling this function, since node->next is preserved, although freeing
+ * 'node' of course does.) */
+static inline struct hmap_node *
+hmap_next_in_bucket(const struct hmap_node *node)
+{
+    return node->next;
+}
+
+/* Returns the next node in the same hash map as 'node' with the same hash
+ * value, or a null pointer if no more nodes have that hash value.
+ *
+ * If the hash map has been reallocated since 'node' was visited, some nodes
+ * may be skipped; if new nodes with the same hash value have been added, they
+ * will be skipped.  (Removing 'node' from the hash map does not prevent
+ * calling this function, since node->next is preserved, although freeing
+ * 'node' of course does.) */
+static inline struct hmap_node *
+hmap_next_with_hash(const struct hmap_node *node)
+{
+    return hmap_next_with_hash__(node->next, node->hash);
+}
+
+static inline struct hmap_node *
+hmap_next__(const struct hmap *hmap, size_t start)
+{
+    size_t i;
+    for (i = start; i <= hmap->mask; i++) {
+        struct hmap_node *node = hmap->buckets[i];
+        if (node) {
+            return node;
+        }
+    }
+    return NULL;
+}
+
+/* Returns the first node in 'hmap', in arbitrary order, or a null pointer if
+ * 'hmap' is empty. */
+static inline struct hmap_node *
+hmap_first(const struct hmap *hmap)
+{
+    return hmap_next__(hmap, 0);
+}
+
+/* Returns the next node in 'hmap' following 'node', in arbitrary order, or a
+ * null pointer if 'node' is the last node in 'hmap'.
+ *
+ * If the hash map has been reallocated since 'node' was visited, some nodes
+ * may be skipped or visited twice.  (Removing 'node' from the hash map does
+ * not prevent calling this function, since node->next is preserved, although
+ * freeing 'node' of course does.) */
+static inline struct hmap_node *
+hmap_next(const struct hmap *hmap, const struct hmap_node *node)
+{
+    return (node->next
+            ? node->next
+            : hmap_next__(hmap, (node->hash & hmap->mask) + 1));
+}
+
+#ifdef  __cplusplus
+}
+#endif
+
+#endif /* hmap.h */
diff --git a/include/openvswitch/json.h b/include/openvswitch/json.h
new file mode 100644
index 0000000..13f346c
--- /dev/null
+++ b/include/openvswitch/json.h
@@ -0,0 +1,141 @@ 
+/*
+ * Copyright (c) 2009, 2010, 2015 Nicira, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef JSON_H
+#define JSON_H 1
+
+/* This is an implementation of JavaScript Object Notation (JSON) as specified
+ * by RFC 4627.  It is intended to fully comply with RFC 4627, with the
+ * following known exceptions and clarifications:
+ *
+ *      - Null bytes (\u0000) are not allowed in strings.
+ *
+ *      - Only UTF-8 encoding is supported (RFC 4627 allows for other Unicode
+ *        encodings).
+ *
+ *      - Names within an object must be unique (RFC 4627 says that they
+ *        "should" be unique).
+ */
+
+#include <stdio.h>
+#include "openvswitch/shash.h"
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+struct ds;
+
+/* Type of a JSON value. */
+enum json_type {
+    JSON_NULL,                  /* null */
+    JSON_FALSE,                 /* false */
+    JSON_TRUE,                  /* true */
+    JSON_OBJECT,                /* {"a": b, "c": d, ...} */
+    JSON_ARRAY,                 /* [1, 2, 3, ...] */
+    JSON_INTEGER,               /* 123. */
+    JSON_REAL,                  /* 123.456. */
+    JSON_STRING,                /* "..." */
+    JSON_N_TYPES
+};
+
+const char *json_type_to_string(enum json_type);
+
+/* A JSON array. */
+struct json_array {
+    size_t n, n_allocated;
+    struct json **elems;
+};
+
+/* A JSON value. */
+struct json {
+    enum json_type type;
+    union {
+        struct shash *object;   /* Contains "struct json *"s. */
+        struct json_array array;
+        long long int integer;
+        double real;
+        char *string;
+    } u;
+};
+
+struct json *json_null_create(void);
+struct json *json_boolean_create(bool);
+struct json *json_string_create(const char *);
+struct json *json_string_create_nocopy(char *);
+struct json *json_integer_create(long long int);
+struct json *json_real_create(double);
+
+struct json *json_array_create_empty(void);
+void json_array_add(struct json *, struct json *element);
+void json_array_trim(struct json *);
+struct json *json_array_create(struct json **, size_t n);
+struct json *json_array_create_1(struct json *);
+struct json *json_array_create_2(struct json *, struct json *);
+struct json *json_array_create_3(struct json *, struct json *, struct json *);
+
+struct json *json_object_create(void);
+void json_object_put(struct json *, const char *name, struct json *value);
+void json_object_put_string(struct json *,
+                            const char *name, const char *value);
+
+const char *json_string(const struct json *);
+struct json_array *json_array(const struct json *);
+struct shash *json_object(const struct json *);
+bool json_boolean(const struct json *);
+double json_real(const struct json *);
+int64_t json_integer(const struct json *);
+
+struct json *json_clone(const struct json *);
+void json_destroy(struct json *);
+
+size_t json_hash(const struct json *, size_t basis);
+bool json_equal(const struct json *, const struct json *);
+
+/* Parsing JSON. */
+enum {
+    JSPF_TRAILER = 1 << 0       /* Check for garbage following input.  */
+};
+
+struct json_parser *json_parser_create(int flags);
+size_t json_parser_feed(struct json_parser *, const char *, size_t);
+bool json_parser_is_done(const struct json_parser *);
+struct json *json_parser_finish(struct json_parser *);
+void json_parser_abort(struct json_parser *);
+
+struct json *json_from_string(const char *string);
+struct json *json_from_file(const char *file_name);
+struct json *json_from_stream(FILE *stream);
+
+/* Serializing JSON. */
+
+enum {
+    JSSF_PRETTY = 1 << 0,       /* Multiple lines with indentation, if true. */
+    JSSF_SORT = 1 << 1          /* Object members in sorted order, if true. */
+};
+char *json_to_string(const struct json *, int flags);
+void json_to_ds(const struct json *, int flags, struct ds *);
+
+/* JSON string formatting operations. */
+
+bool json_string_unescape(const char *in, size_t in_len, char **outp);
+void json_string_escape(const char *in, struct ds *out);
+
+#ifdef  __cplusplus
+}
+#endif
+
+#endif /* json.h */
diff --git a/include/openvswitch/shash.h b/include/openvswitch/shash.h
new file mode 100644
index 0000000..afc4823
--- /dev/null
+++ b/include/openvswitch/shash.h
@@ -0,0 +1,81 @@ 
+/*
+ * Copyright (c) 2009, 2010, 2011, 2016 Nicira, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef SHASH_H
+#define SHASH_H 1
+
+#include "openvswitch/hmap.h"
+#include "openvswitch/util.h"
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+struct shash_node {
+    struct hmap_node node;
+    char *name;
+    void *data;
+};
+
+struct shash {
+    struct hmap map;
+};
+
+#define SHASH_INITIALIZER(SHASH) { HMAP_INITIALIZER(&(SHASH)->map) }
+
+#define SHASH_FOR_EACH(SHASH_NODE, SHASH)                               \
+    HMAP_FOR_EACH_INIT (SHASH_NODE, node, &(SHASH)->map,                \
+                        BUILD_ASSERT_TYPE(SHASH_NODE, struct shash_node *), \
+                        BUILD_ASSERT_TYPE(SHASH, struct shash *))
+
+#define SHASH_FOR_EACH_SAFE(SHASH_NODE, NEXT, SHASH)        \
+    HMAP_FOR_EACH_SAFE_INIT (                               \
+        SHASH_NODE, NEXT, node, &(SHASH)->map,              \
+        BUILD_ASSERT_TYPE(SHASH_NODE, struct shash_node *), \
+        BUILD_ASSERT_TYPE(NEXT, struct shash_node *),       \
+        BUILD_ASSERT_TYPE(SHASH, struct shash *))
+
+void shash_init(struct shash *);
+void shash_destroy(struct shash *);
+void shash_destroy_free_data(struct shash *);
+void shash_swap(struct shash *, struct shash *);
+void shash_moved(struct shash *);
+void shash_clear(struct shash *);
+void shash_clear_free_data(struct shash *);
+bool shash_is_empty(const struct shash *);
+size_t shash_count(const struct shash *);
+struct shash_node *shash_add(struct shash *, const char *, const void *);
+struct shash_node *shash_add_nocopy(struct shash *, char *, const void *);
+bool shash_add_once(struct shash *, const char *, const void *);
+void shash_add_assert(struct shash *, const char *, const void *);
+void *shash_replace(struct shash *, const char *, const void *data);
+void shash_delete(struct shash *, struct shash_node *);
+char *shash_steal(struct shash *, struct shash_node *);
+struct shash_node *shash_find(const struct shash *, const char *);
+struct shash_node *shash_find_len(const struct shash *, const char *, size_t);
+void *shash_find_data(const struct shash *, const char *);
+void *shash_find_and_delete(struct shash *, const char *);
+void *shash_find_and_delete_assert(struct shash *, const char *);
+struct shash_node *shash_first(const struct shash *);
+const struct shash_node **shash_sort(const struct shash *);
+bool shash_equal_keys(const struct shash *, const struct shash *);
+struct shash_node *shash_random_node(struct shash *);
+
+#ifdef  __cplusplus
+}
+#endif
+
+#endif /* shash.h */
diff --git a/lib/automake.mk b/lib/automake.mk
index 4d4ee01..3aaf2c5 100644
--- a/lib/automake.mk
+++ b/lib/automake.mk
@@ -94,7 +94,6 @@  lib_libopenvswitch_la_SOURCES = \
 	lib/hindex.c \
 	lib/hindex.h \
 	lib/hmap.c \
-	lib/hmap.h \
 	lib/hmapx.c \
 	lib/hmapx.h \
 	lib/id-pool.c \
@@ -102,7 +101,6 @@  lib_libopenvswitch_la_SOURCES = \
 	lib/jhash.c \
 	lib/jhash.h \
 	lib/json.c \
-	lib/json.h \
 	lib/jsonrpc.c \
 	lib/jsonrpc.h \
 	lib/lacp.c \
@@ -217,7 +215,6 @@  lib_libopenvswitch_la_SOURCES = \
 	lib/sha1.c \
 	lib/sha1.h \
 	lib/shash.c \
-	lib/shash.h \
 	lib/simap.c \
 	lib/simap.h \
 	lib/smap.c \
diff --git a/lib/bfd.c b/lib/bfd.c
index 9616c90..8dac953 100644
--- a/lib/bfd.c
+++ b/lib/bfd.c
@@ -29,7 +29,7 @@ 
 #include "openvswitch/dynamic-string.h"
 #include "flow.h"
 #include "hash.h"
-#include "hmap.h"
+#include "openvswitch/hmap.h"
 #include "openvswitch/list.h"
 #include "netdev.h"
 #include "odp-util.h"
diff --git a/lib/bundle.c b/lib/bundle.c
index eaaf068..7fc02e2 100644
--- a/lib/bundle.c
+++ b/lib/bundle.c
@@ -31,6 +31,7 @@ 
 #include "openvswitch/ofp-util.h"
 #include "openvswitch/ofpbuf.h"
 #include "openvswitch/vlog.h"
+#include "util.h"
 
 VLOG_DEFINE_THIS_MODULE(bundle);
 
diff --git a/lib/cfm.c b/lib/cfm.c
index fb077de..7bc22e3 100644
--- a/lib/cfm.c
+++ b/lib/cfm.c
@@ -27,7 +27,7 @@ 
 #include "openvswitch/dynamic-string.h"
 #include "flow.h"
 #include "hash.h"
-#include "hmap.h"
+#include "openvswitch/hmap.h"
 #include "netdev.h"
 #include "ovs-atomic.h"
 #include "packets.h"
@@ -38,6 +38,7 @@ 
 #include "timeval.h"
 #include "unixctl.h"
 #include "openvswitch/vlog.h"
+#include "util.h"
 
 VLOG_DEFINE_THIS_MODULE(cfm);
 
diff --git a/lib/cfm.h b/lib/cfm.h
index 98d48b3..5710c99 100644
--- a/lib/cfm.h
+++ b/lib/cfm.h
@@ -18,7 +18,7 @@ 
 
 #include <stdint.h>
 
-#include "hmap.h"
+#include "openvswitch/hmap.h"
 #include "openvswitch/types.h"
 #include "packets.h"
 
diff --git a/lib/db-ctl-base.c b/lib/db-ctl-base.c
index 9f50c6c..02eb328 100644
--- a/lib/db-ctl-base.c
+++ b/lib/db-ctl-base.c
@@ -28,12 +28,12 @@ 
 #include "openvswitch/dynamic-string.h"
 #include "fatal-signal.h"
 #include "hash.h"
-#include "json.h"
+#include "openvswitch/json.h"
 #include "openvswitch/vlog.h"
 #include "ovsdb-data.h"
 #include "ovsdb-idl.h"
 #include "ovsdb-idl-provider.h"
-#include "shash.h"
+#include "openvswitch/shash.h"
 #include "sset.h"
 #include "string.h"
 #include "table.h"
diff --git a/lib/db-ctl-base.h b/lib/db-ctl-base.h
index f8f576b..0f4658e 100644
--- a/lib/db-ctl-base.h
+++ b/lib/db-ctl-base.h
@@ -19,7 +19,7 @@ 
 
 #include "compiler.h"
 #include "openvswitch/dynamic-string.h"
-#include "shash.h"
+#include "openvswitch/shash.h"
 
 struct ctl_context;
 struct option;
diff --git a/lib/dpctl.c b/lib/dpctl.c
index b870e30..79eb0f7 100644
--- a/lib/dpctl.c
+++ b/lib/dpctl.c
@@ -42,7 +42,7 @@ 
 #include "openvswitch/ofpbuf.h"
 #include "ovs-numa.h"
 #include "packets.h"
-#include "shash.h"
+#include "openvswitch/shash.h"
 #include "simap.h"
 #include "smap.h"
 #include "sset.h"
diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index e0107b7..d5d7b7e 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -62,7 +62,7 @@ 
 #include "pvector.h"
 #include "random.h"
 #include "seq.h"
-#include "shash.h"
+#include "openvswitch/shash.h"
 #include "sset.h"
 #include "timeval.h"
 #include "tnl-neigh-cache.h"
diff --git a/lib/dpif-netlink.c b/lib/dpif-netlink.c
index e2bea23..d544072 100644
--- a/lib/dpif-netlink.c
+++ b/lib/dpif-netlink.c
@@ -49,7 +49,7 @@ 
 #include "packets.h"
 #include "poll-loop.h"
 #include "random.h"
-#include "shash.h"
+#include "openvswitch/shash.h"
 #include "sset.h"
 #include "timeval.h"
 #include "unaligned.h"
diff --git a/lib/dpif.c b/lib/dpif.c
index 5f1be41..bb2c4e6 100644
--- a/lib/dpif.c
+++ b/lib/dpif.c
@@ -40,7 +40,7 @@ 
 #include "poll-loop.h"
 #include "route-table.h"
 #include "seq.h"
-#include "shash.h"
+#include "openvswitch/shash.h"
 #include "sset.h"
 #include "timeval.h"
 #include "tnl-neigh-cache.h"
diff --git a/lib/fat-rwlock.c b/lib/fat-rwlock.c
index 2f42b05..19b7149 100644
--- a/lib/fat-rwlock.c
+++ b/lib/fat-rwlock.c
@@ -20,7 +20,7 @@ 
 
 #include <errno.h>
 
-#include "hmap.h"
+#include "openvswitch/hmap.h"
 #include "openvswitch/list.h"
 #include "ovs-thread.h"
 #include "random.h"
diff --git a/lib/fatal-signal.c b/lib/fatal-signal.c
index 021c869..7b9813d 100644
--- a/lib/fatal-signal.c
+++ b/lib/fatal-signal.c
@@ -25,7 +25,7 @@ 
 #include <unistd.h>
 #include "ovs-thread.h"
 #include "poll-loop.h"
-#include "shash.h"
+#include "openvswitch/shash.h"
 #include "sset.h"
 #include "signals.h"
 #include "socket-util.h"
diff --git a/lib/flow.c b/lib/flow.c
index a4c1215..37af208 100644
--- a/lib/flow.c
+++ b/lib/flow.c
@@ -39,6 +39,7 @@ 
 #include "odp-util.h"
 #include "random.h"
 #include "unaligned.h"
+#include "util.h"
 
 COVERAGE_DEFINE(flow_extract);
 COVERAGE_DEFINE(miniflow_malloc);
diff --git a/lib/hmap.c b/lib/hmap.c
index 9462c5e..1ba4a57 100644
--- a/lib/hmap.c
+++ b/lib/hmap.c
@@ -15,7 +15,7 @@ 
  */
 
 #include <config.h>
-#include "hmap.h"
+#include "openvswitch/hmap.h"
 #include <stdint.h>
 #include <string.h>
 #include "coverage.h"
diff --git a/lib/hmap.h b/lib/hmap.h
deleted file mode 100644
index ea6c4e0..0000000
--- a/lib/hmap.h
+++ /dev/null
@@ -1,407 +0,0 @@ 
-/*
- * Copyright (c) 2008, 2009, 2010, 2012, 2013, 2015, 2016 Nicira, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef HMAP_H
-#define HMAP_H 1
-
-#include <stdbool.h>
-#include <stdlib.h>
-#include "util.h"
-
-#ifdef  __cplusplus
-extern "C" {
-#endif
-
-/* A hash map node, to be embedded inside the data structure being mapped. */
-struct hmap_node {
-    size_t hash;                /* Hash value. */
-    struct hmap_node *next;     /* Next in linked list. */
-};
-
-/* Returns the hash value embedded in 'node'. */
-static inline size_t hmap_node_hash(const struct hmap_node *node)
-{
-    return node->hash;
-}
-
-#define HMAP_NODE_NULL ((struct hmap_node *) 1)
-#define HMAP_NODE_NULL_INITIALIZER { 0, HMAP_NODE_NULL }
-
-/* Returns true if 'node' has been set to null by hmap_node_nullify() and has
- * not been un-nullified by being inserted into an hmap. */
-static inline bool
-hmap_node_is_null(const struct hmap_node *node)
-{
-    return node->next == HMAP_NODE_NULL;
-}
-
-/* Marks 'node' with a distinctive value that can be tested with
- * hmap_node_is_null().  */
-static inline void
-hmap_node_nullify(struct hmap_node *node)
-{
-    node->next = HMAP_NODE_NULL;
-}
-
-/* A hash map. */
-struct hmap {
-    struct hmap_node **buckets; /* Must point to 'one' iff 'mask' == 0. */
-    struct hmap_node *one;
-    size_t mask;
-    size_t n;
-};
-
-/* Initializer for an empty hash map. */
-#define HMAP_INITIALIZER(HMAP) \
-    { (struct hmap_node **const) &(HMAP)->one, NULL, 0, 0 }
-
-/* Initializer for an immutable struct hmap 'HMAP' that contains a single
- * 'NODE'. */
-#define HMAP_CONST1(HMAP, NODE) {                                   \
-        CONST_CAST(struct hmap_node **, &(HMAP)->one), NODE, 0, 1 }
-#define HMAP_NODE_INIT(HASH) { HASH, NULL }
-
-/* Initialization. */
-void hmap_init(struct hmap *);
-void hmap_destroy(struct hmap *);
-void hmap_clear(struct hmap *);
-void hmap_swap(struct hmap *a, struct hmap *b);
-void hmap_moved(struct hmap *hmap);
-static inline size_t hmap_count(const struct hmap *);
-static inline bool hmap_is_empty(const struct hmap *);
-
-/* Adjusting capacity. */
-void hmap_expand_at(struct hmap *, const char *where);
-#define hmap_expand(HMAP) hmap_expand_at(HMAP, OVS_SOURCE_LOCATOR)
-
-void hmap_shrink_at(struct hmap *, const char *where);
-#define hmap_shrink(HMAP) hmap_shrink_at(HMAP, OVS_SOURCE_LOCATOR)
-
-void hmap_reserve_at(struct hmap *, size_t capacity, const char *where);
-#define hmap_reserve(HMAP, CAPACITY) \
-    hmap_reserve_at(HMAP, CAPACITY, OVS_SOURCE_LOCATOR)
-
-/* Insertion and deletion. */
-static inline void hmap_insert_at(struct hmap *, struct hmap_node *,
-                                  size_t hash, const char *where);
-#define hmap_insert(HMAP, NODE, HASH) \
-    hmap_insert_at(HMAP, NODE, HASH, OVS_SOURCE_LOCATOR)
-
-static inline void hmap_insert_fast(struct hmap *,
-                                    struct hmap_node *, size_t hash);
-static inline void hmap_remove(struct hmap *, struct hmap_node *);
-
-void hmap_node_moved(struct hmap *, struct hmap_node *, struct hmap_node *);
-static inline void hmap_replace(struct hmap *, const struct hmap_node *old,
-                                struct hmap_node *new_node);
-
-struct hmap_node *hmap_random_node(const struct hmap *);
-
-/* Search.
- *
- * HMAP_FOR_EACH_WITH_HASH iterates NODE over all of the nodes in HMAP that
- * have hash value equal to HASH.  HMAP_FOR_EACH_IN_BUCKET iterates NODE over
- * all of the nodes in HMAP that would fall in the same bucket as HASH.  MEMBER
- * must be the name of the 'struct hmap_node' member within NODE.
- *
- * These macros may be used interchangeably to search for a particular value in
- * an hmap, see, e.g. shash_find() for an example.  Usually, using
- * HMAP_FOR_EACH_WITH_HASH provides an optimization, because comparing a hash
- * value is usually cheaper than comparing an entire hash map key.  But for
- * simple hash map keys, it makes sense to use HMAP_FOR_EACH_IN_BUCKET because
- * it avoids doing two comparisons when a single simple comparison suffices.
- *
- * The loop should not change NODE to point to a different node or insert or
- * delete nodes in HMAP (unless it "break"s out of the loop to terminate
- * iteration).
- *
- * HASH is only evaluated once.
- *
- * When the loop terminates normally, meaning the iteration has completed
- * without using 'break', NODE will be NULL.  This is true for all of the
- * HMAP_FOR_EACH_*() macros.
- */
-#define HMAP_FOR_EACH_WITH_HASH(NODE, MEMBER, HASH, HMAP)               \
-    for (INIT_CONTAINER(NODE, hmap_first_with_hash(HMAP, HASH), MEMBER); \
-         (NODE != OBJECT_CONTAINING(NULL, NODE, MEMBER)) || (NODE = NULL); \
-         ASSIGN_CONTAINER(NODE, hmap_next_with_hash(&(NODE)->MEMBER),   \
-                          MEMBER))
-#define HMAP_FOR_EACH_IN_BUCKET(NODE, MEMBER, HASH, HMAP)               \
-    for (INIT_CONTAINER(NODE, hmap_first_in_bucket(HMAP, HASH), MEMBER); \
-         (NODE != OBJECT_CONTAINING(NULL, NODE, MEMBER)) || (NODE = NULL); \
-         ASSIGN_CONTAINER(NODE, hmap_next_in_bucket(&(NODE)->MEMBER), MEMBER))
-
-static inline struct hmap_node *hmap_first_with_hash(const struct hmap *,
-                                                     size_t hash);
-static inline struct hmap_node *hmap_next_with_hash(const struct hmap_node *);
-static inline struct hmap_node *hmap_first_in_bucket(const struct hmap *,
-                                                     size_t hash);
-static inline struct hmap_node *hmap_next_in_bucket(const struct hmap_node *);
-
-bool hmap_contains(const struct hmap *, const struct hmap_node *);
-
-/* Iteration.
- *
- * The *_INIT variants of these macros additionally evaluate the expressions
- * supplied following the HMAP argument once during the loop initialization.
- * This makes it possible for data structures that wrap around hmaps to insert
- * additional initialization into their iteration macros without having to
- * completely rewrite them.  In particular, it can be a good idea to insert
- * BUILD_ASSERT_TYPE checks for map and node types that wrap hmap, since
- * otherwise it is possible for clients to accidentally confuse two derived
- * data structures that happen to use the same member names for struct hmap and
- * struct hmap_node. */
-
-/* Iterates through every node in HMAP. */
-#define HMAP_FOR_EACH(NODE, MEMBER, HMAP) \
-    HMAP_FOR_EACH_INIT(NODE, MEMBER, HMAP, (void) 0)
-#define HMAP_FOR_EACH_INIT(NODE, MEMBER, HMAP, ...)                     \
-    for (INIT_CONTAINER(NODE, hmap_first(HMAP), MEMBER), __VA_ARGS__;   \
-         (NODE != OBJECT_CONTAINING(NULL, NODE, MEMBER)) || (NODE = NULL); \
-         ASSIGN_CONTAINER(NODE, hmap_next(HMAP, &(NODE)->MEMBER), MEMBER))
-
-/* Safe when NODE may be freed (not needed when NODE may be removed from the
- * hash map but its members remain accessible and intact). */
-#define HMAP_FOR_EACH_SAFE(NODE, NEXT, MEMBER, HMAP) \
-    HMAP_FOR_EACH_SAFE_INIT(NODE, NEXT, MEMBER, HMAP, (void) 0)
-#define HMAP_FOR_EACH_SAFE_INIT(NODE, NEXT, MEMBER, HMAP, ...)          \
-    for (INIT_CONTAINER(NODE, hmap_first(HMAP), MEMBER), __VA_ARGS__;   \
-         ((NODE != OBJECT_CONTAINING(NULL, NODE, MEMBER)) || (NODE = NULL) \
-          ? INIT_CONTAINER(NEXT, hmap_next(HMAP, &(NODE)->MEMBER), MEMBER), 1 \
-          : 0);                                                         \
-         (NODE) = (NEXT))
-
-/* Continues an iteration from just after NODE. */
-#define HMAP_FOR_EACH_CONTINUE(NODE, MEMBER, HMAP) \
-    HMAP_FOR_EACH_CONTINUE_INIT(NODE, MEMBER, HMAP, (void) 0)
-#define HMAP_FOR_EACH_CONTINUE_INIT(NODE, MEMBER, HMAP, ...)            \
-    for (ASSIGN_CONTAINER(NODE, hmap_next(HMAP, &(NODE)->MEMBER), MEMBER), \
-         __VA_ARGS__;                                                   \
-         (NODE != OBJECT_CONTAINING(NULL, NODE, MEMBER)) || (NODE = NULL); \
-         ASSIGN_CONTAINER(NODE, hmap_next(HMAP, &(NODE)->MEMBER), MEMBER))
-
-static inline struct hmap_node *
-hmap_pop_helper__(struct hmap *hmap, size_t *bucket) {
-
-    for (; *bucket <= hmap->mask; (*bucket)++) {
-        struct hmap_node *node = hmap->buckets[*bucket];
-
-        if (node) {
-            hmap_remove(hmap, node);
-            return node;
-        }
-    }
-
-    return NULL;
-}
-
-#define HMAP_FOR_EACH_POP(NODE, MEMBER, HMAP)                               \
-    for (size_t bucket__ = 0;                                               \
-         INIT_CONTAINER(NODE, hmap_pop_helper__(HMAP, &bucket__), MEMBER),  \
-         (NODE != OBJECT_CONTAINING(NULL, NODE, MEMBER)) || (NODE = NULL);)
-
-static inline struct hmap_node *hmap_first(const struct hmap *);
-static inline struct hmap_node *hmap_next(const struct hmap *,
-                                          const struct hmap_node *);
-
-struct hmap_position {
-    unsigned int bucket;
-    unsigned int offset;
-};
-
-struct hmap_node *hmap_at_position(const struct hmap *,
-                                   struct hmap_position *);
-
-/* Returns the number of nodes currently in 'hmap'. */
-static inline size_t
-hmap_count(const struct hmap *hmap)
-{
-    return hmap->n;
-}
-
-/* Returns the maximum number of nodes that 'hmap' may hold before it should be
- * rehashed. */
-static inline size_t
-hmap_capacity(const struct hmap *hmap)
-{
-    return hmap->mask * 2 + 1;
-}
-
-/* Returns true if 'hmap' currently contains no nodes,
- * false otherwise.
- * Note: While hmap in general is not thread-safe without additional locking,
- * hmap_is_empty() is. */
-static inline bool
-hmap_is_empty(const struct hmap *hmap)
-{
-    return hmap->n == 0;
-}
-
-/* Inserts 'node', with the given 'hash', into 'hmap'.  'hmap' is never
- * expanded automatically. */
-static inline void
-hmap_insert_fast(struct hmap *hmap, struct hmap_node *node, size_t hash)
-{
-    struct hmap_node **bucket = &hmap->buckets[hash & hmap->mask];
-    node->hash = hash;
-    node->next = *bucket;
-    *bucket = node;
-    hmap->n++;
-}
-
-/* Inserts 'node', with the given 'hash', into 'hmap', and expands 'hmap' if
- * necessary to optimize search performance.
- *
- * ('where' is used in debug logging.  Commonly one would use hmap_insert() to
- * automatically provide the caller's source file and line number for
- * 'where'.) */
-static inline void
-hmap_insert_at(struct hmap *hmap, struct hmap_node *node, size_t hash,
-               const char *where)
-{
-    hmap_insert_fast(hmap, node, hash);
-    if (hmap->n / 2 > hmap->mask) {
-        hmap_expand_at(hmap, where);
-    }
-}
-
-/* Removes 'node' from 'hmap'.  Does not shrink the hash table; call
- * hmap_shrink() directly if desired. */
-static inline void
-hmap_remove(struct hmap *hmap, struct hmap_node *node)
-{
-    struct hmap_node **bucket = &hmap->buckets[node->hash & hmap->mask];
-    while (*bucket != node) {
-        bucket = &(*bucket)->next;
-    }
-    *bucket = node->next;
-    hmap->n--;
-}
-
-/* Puts 'new_node' in the position in 'hmap' currently occupied by 'old_node'.
- * The 'new_node' must hash to the same value as 'old_node'.  The client is
- * responsible for ensuring that the replacement does not violate any
- * client-imposed invariants (e.g. uniqueness of keys within a map).
- *
- * Afterward, 'old_node' is not part of 'hmap', and the client is responsible
- * for freeing it (if this is desirable). */
-static inline void
-hmap_replace(struct hmap *hmap,
-             const struct hmap_node *old_node, struct hmap_node *new_node)
-{
-    struct hmap_node **bucket = &hmap->buckets[old_node->hash & hmap->mask];
-    while (*bucket != old_node) {
-        bucket = &(*bucket)->next;
-    }
-    *bucket = new_node;
-    new_node->hash = old_node->hash;
-    new_node->next = old_node->next;
-}
-
-static inline struct hmap_node *
-hmap_next_with_hash__(const struct hmap_node *node, size_t hash)
-{
-    while (node != NULL && node->hash != hash) {
-        node = node->next;
-    }
-    return CONST_CAST(struct hmap_node *, node);
-}
-
-/* Returns the first node in 'hmap' with the given 'hash', or a null pointer if
- * no nodes have that hash value. */
-static inline struct hmap_node *
-hmap_first_with_hash(const struct hmap *hmap, size_t hash)
-{
-    return hmap_next_with_hash__(hmap->buckets[hash & hmap->mask], hash);
-}
-
-/* Returns the first node in 'hmap' in the bucket in which the given 'hash'
- * would land, or a null pointer if that bucket is empty. */
-static inline struct hmap_node *
-hmap_first_in_bucket(const struct hmap *hmap, size_t hash)
-{
-    return hmap->buckets[hash & hmap->mask];
-}
-
-/* Returns the next node in the same bucket as 'node', or a null pointer if
- * there are no more nodes in that bucket.
- *
- * If the hash map has been reallocated since 'node' was visited, some nodes
- * may be skipped; if new nodes with the same hash value have been added, they
- * will be skipped.  (Removing 'node' from the hash map does not prevent
- * calling this function, since node->next is preserved, although freeing
- * 'node' of course does.) */
-static inline struct hmap_node *
-hmap_next_in_bucket(const struct hmap_node *node)
-{
-    return node->next;
-}
-
-/* Returns the next node in the same hash map as 'node' with the same hash
- * value, or a null pointer if no more nodes have that hash value.
- *
- * If the hash map has been reallocated since 'node' was visited, some nodes
- * may be skipped; if new nodes with the same hash value have been added, they
- * will be skipped.  (Removing 'node' from the hash map does not prevent
- * calling this function, since node->next is preserved, although freeing
- * 'node' of course does.) */
-static inline struct hmap_node *
-hmap_next_with_hash(const struct hmap_node *node)
-{
-    return hmap_next_with_hash__(node->next, node->hash);
-}
-
-static inline struct hmap_node *
-hmap_next__(const struct hmap *hmap, size_t start)
-{
-    size_t i;
-    for (i = start; i <= hmap->mask; i++) {
-        struct hmap_node *node = hmap->buckets[i];
-        if (node) {
-            return node;
-        }
-    }
-    return NULL;
-}
-
-/* Returns the first node in 'hmap', in arbitrary order, or a null pointer if
- * 'hmap' is empty. */
-static inline struct hmap_node *
-hmap_first(const struct hmap *hmap)
-{
-    return hmap_next__(hmap, 0);
-}
-
-/* Returns the next node in 'hmap' following 'node', in arbitrary order, or a
- * null pointer if 'node' is the last node in 'hmap'.
- *
- * If the hash map has been reallocated since 'node' was visited, some nodes
- * may be skipped or visited twice.  (Removing 'node' from the hash map does
- * not prevent calling this function, since node->next is preserved, although
- * freeing 'node' of course does.) */
-static inline struct hmap_node *
-hmap_next(const struct hmap *hmap, const struct hmap_node *node)
-{
-    return (node->next
-            ? node->next
-            : hmap_next__(hmap, (node->hash & hmap->mask) + 1));
-}
-
-#ifdef  __cplusplus
-}
-#endif
-
-#endif /* hmap.h */
diff --git a/lib/hmapx.h b/lib/hmapx.h
index f977d9e..06a6bbe 100644
--- a/lib/hmapx.h
+++ b/lib/hmapx.h
@@ -17,7 +17,7 @@ 
 #ifndef HMAPX_H
 #define HMAPX_H
 
-#include "hmap.h"
+#include "openvswitch/hmap.h"
 
 struct hmapx_node {
     struct hmap_node hmap_node;
diff --git a/lib/id-pool.c b/lib/id-pool.c
index f32c008..62a6b33 100644
--- a/lib/id-pool.c
+++ b/lib/id-pool.c
@@ -17,7 +17,7 @@ 
 
 #include <config.h>
 #include "id-pool.h"
-#include "hmap.h"
+#include "openvswitch/hmap.h"
 #include "hash.h"
 
 struct id_node {
diff --git a/lib/json.c b/lib/json.c
index 4ac250b..995f3c2 100644
--- a/lib/json.c
+++ b/lib/json.c
@@ -16,7 +16,7 @@ 
 
 #include <config.h>
 
-#include "json.h"
+#include "openvswitch/json.h"
 
 #include <ctype.h>
 #include <errno.h>
@@ -26,7 +26,7 @@ 
 
 #include "openvswitch/dynamic-string.h"
 #include "hash.h"
-#include "shash.h"
+#include "openvswitch/shash.h"
 #include "unicode.h"
 #include "util.h"
 
diff --git a/lib/json.h b/lib/json.h
deleted file mode 100644
index 3497035..0000000
--- a/lib/json.h
+++ /dev/null
@@ -1,140 +0,0 @@ 
-/*
- * Copyright (c) 2009, 2010, 2015 Nicira, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef JSON_H
-#define JSON_H 1
-
-/* This is an implementation of JavaScript Object Notation (JSON) as specified
- * by RFC 4627.  It is intended to fully comply with RFC 4627, with the
- * following known exceptions and clarifications:
- *
- *      - Null bytes (\u0000) are not allowed in strings.
- *
- *      - Only UTF-8 encoding is supported (RFC 4627 allows for other Unicode
- *        encodings).
- *
- *      - Names within an object must be unique (RFC 4627 says that they
- *        "should" be unique).
- */
-
-#include "shash.h"
-
-#ifdef  __cplusplus
-extern "C" {
-#endif
-
-struct ds;
-
-/* Type of a JSON value. */
-enum json_type {
-    JSON_NULL,                  /* null */
-    JSON_FALSE,                 /* false */
-    JSON_TRUE,                  /* true */
-    JSON_OBJECT,                /* {"a": b, "c": d, ...} */
-    JSON_ARRAY,                 /* [1, 2, 3, ...] */
-    JSON_INTEGER,               /* 123. */
-    JSON_REAL,                  /* 123.456. */
-    JSON_STRING,                /* "..." */
-    JSON_N_TYPES
-};
-
-const char *json_type_to_string(enum json_type);
-
-/* A JSON array. */
-struct json_array {
-    size_t n, n_allocated;
-    struct json **elems;
-};
-
-/* A JSON value. */
-struct json {
-    enum json_type type;
-    union {
-        struct shash *object;   /* Contains "struct json *"s. */
-        struct json_array array;
-        long long int integer;
-        double real;
-        char *string;
-    } u;
-};
-
-struct json *json_null_create(void);
-struct json *json_boolean_create(bool);
-struct json *json_string_create(const char *);
-struct json *json_string_create_nocopy(char *);
-struct json *json_integer_create(long long int);
-struct json *json_real_create(double);
-
-struct json *json_array_create_empty(void);
-void json_array_add(struct json *, struct json *element);
-void json_array_trim(struct json *);
-struct json *json_array_create(struct json **, size_t n);
-struct json *json_array_create_1(struct json *);
-struct json *json_array_create_2(struct json *, struct json *);
-struct json *json_array_create_3(struct json *, struct json *, struct json *);
-
-struct json *json_object_create(void);
-void json_object_put(struct json *, const char *name, struct json *value);
-void json_object_put_string(struct json *,
-                            const char *name, const char *value);
-
-const char *json_string(const struct json *);
-struct json_array *json_array(const struct json *);
-struct shash *json_object(const struct json *);
-bool json_boolean(const struct json *);
-double json_real(const struct json *);
-int64_t json_integer(const struct json *);
-
-struct json *json_clone(const struct json *);
-void json_destroy(struct json *);
-
-size_t json_hash(const struct json *, size_t basis);
-bool json_equal(const struct json *, const struct json *);
-
-/* Parsing JSON. */
-enum {
-    JSPF_TRAILER = 1 << 0       /* Check for garbage following input.  */
-};
-
-struct json_parser *json_parser_create(int flags);
-size_t json_parser_feed(struct json_parser *, const char *, size_t);
-bool json_parser_is_done(const struct json_parser *);
-struct json *json_parser_finish(struct json_parser *);
-void json_parser_abort(struct json_parser *);
-
-struct json *json_from_string(const char *string);
-struct json *json_from_file(const char *file_name);
-struct json *json_from_stream(FILE *stream);
-
-/* Serializing JSON. */
-
-enum {
-    JSSF_PRETTY = 1 << 0,       /* Multiple lines with indentation, if true. */
-    JSSF_SORT = 1 << 1          /* Object members in sorted order, if true. */
-};
-char *json_to_string(const struct json *, int flags);
-void json_to_ds(const struct json *, int flags, struct ds *);
-
-/* JSON string formatting operations. */
-
-bool json_string_unescape(const char *in, size_t in_len, char **outp);
-void json_string_escape(const char *in, struct ds *out);
-
-#ifdef  __cplusplus
-}
-#endif
-
-#endif /* json.h */
diff --git a/lib/jsonrpc.c b/lib/jsonrpc.c
index aba742c..1841568 100644
--- a/lib/jsonrpc.c
+++ b/lib/jsonrpc.c
@@ -23,7 +23,7 @@ 
 #include "byteq.h"
 #include "openvswitch/dynamic-string.h"
 #include "fatal-signal.h"
-#include "json.h"
+#include "openvswitch/json.h"
 #include "openvswitch/list.h"
 #include "openvswitch/ofpbuf.h"
 #include "ovs-thread.h"
diff --git a/lib/lacp.c b/lib/lacp.c
index a9d6e1e..ad6ef8e 100644
--- a/lib/lacp.c
+++ b/lib/lacp.c
@@ -21,17 +21,18 @@ 
 #include "connectivity.h"
 #include "openvswitch/dynamic-string.h"
 #include "hash.h"
-#include "hmap.h"
+#include "openvswitch/hmap.h"
 #include "dp-packet.h"
 #include "ovs-atomic.h"
 #include "packets.h"
 #include "poll-loop.h"
 #include "seq.h"
-#include "shash.h"
+#include "openvswitch/shash.h"
 #include "timer.h"
 #include "timeval.h"
 #include "unixctl.h"
 #include "openvswitch/vlog.h"
+#include "util.h"
 
 VLOG_DEFINE_THIS_MODULE(lacp);
 
diff --git a/lib/learning-switch.c b/lib/learning-switch.c
index b420fe5..82609e8 100644
--- a/lib/learning-switch.c
+++ b/lib/learning-switch.c
@@ -27,7 +27,7 @@ 
 #include "classifier.h"
 #include "dp-packet.h"
 #include "flow.h"
-#include "hmap.h"
+#include "openvswitch/hmap.h"
 #include "mac-learning.h"
 #include "openflow/openflow.h"
 #include "openvswitch/ofp-actions.h"
@@ -41,7 +41,7 @@ 
 #include "openvswitch/vlog.h"
 #include "poll-loop.h"
 #include "rconn.h"
-#include "shash.h"
+#include "openvswitch/shash.h"
 #include "simap.h"
 #include "timeval.h"
 
diff --git a/lib/lockfile.c b/lib/lockfile.c
index 864d3ef..36728ff 100644
--- a/lib/lockfile.c
+++ b/lib/lockfile.c
@@ -26,7 +26,7 @@ 
 
 #include "coverage.h"
 #include "hash.h"
-#include "hmap.h"
+#include "openvswitch/hmap.h"
 #include "ovs-thread.h"
 #include "timeval.h"
 #include "util.h"
diff --git a/lib/mac-learning.h b/lib/mac-learning.h
index 0b62d09..d09e895 100644
--- a/lib/mac-learning.h
+++ b/lib/mac-learning.h
@@ -19,7 +19,7 @@ 
 
 #include <time.h>
 #include "heap.h"
-#include "hmap.h"
+#include "openvswitch/hmap.h"
 #include "openvswitch/list.h"
 #include "ovs-atomic.h"
 #include "ovs-thread.h"
diff --git a/lib/mcast-snooping.h b/lib/mcast-snooping.h
index 84b9c57..af7fb93 100644
--- a/lib/mcast-snooping.h
+++ b/lib/mcast-snooping.h
@@ -21,7 +21,7 @@ 
 
 #include <time.h>
 #include "dp-packet.h"
-#include "hmap.h"
+#include "openvswitch/hmap.h"
 #include "openvswitch/list.h"
 #include "ovs-atomic.h"
 #include "ovs-thread.h"
diff --git a/lib/meta-flow.c b/lib/meta-flow.c
index e160de1..8e1447d 100644
--- a/lib/meta-flow.c
+++ b/lib/meta-flow.c
@@ -30,7 +30,7 @@ 
 #include "ovs-thread.h"
 #include "packets.h"
 #include "random.h"
-#include "shash.h"
+#include "openvswitch/shash.h"
 #include "socket-util.h"
 #include "tun-metadata.h"
 #include "unaligned.h"
diff --git a/lib/multipath.c b/lib/multipath.c
index 30bab14..8a1d1fa 100644
--- a/lib/multipath.c
+++ b/lib/multipath.c
@@ -29,6 +29,7 @@ 
 #include "openvswitch/ofp-errors.h"
 #include "openvswitch/ofp-util.h"
 #include "packets.h"
+#include "util.h"
 
 /* Checks that 'mp' is valid on flow.  Returns 0 if it is valid, otherwise an
  * OFPERR_*. */
diff --git a/lib/netdev-bsd.c b/lib/netdev-bsd.c
index 2e92d97..fdce241 100644
--- a/lib/netdev-bsd.c
+++ b/lib/netdev-bsd.c
@@ -57,7 +57,7 @@ 
 #include "ovs-thread.h"
 #include "packets.h"
 #include "poll-loop.h"
-#include "shash.h"
+#include "openvswitch/shash.h"
 #include "socket-util.h"
 #include "svec.h"
 #include "util.h"
diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index 85b18fd..c712991 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -48,7 +48,7 @@ 
 #include "ovs-thread.h"
 #include "ovs-rcu.h"
 #include "packets.h"
-#include "shash.h"
+#include "openvswitch/shash.h"
 #include "smap.h"
 #include "sset.h"
 #include "unaligned.h"
diff --git a/lib/netdev-dummy.c b/lib/netdev-dummy.c
index 9ea765b..a370f84 100644
--- a/lib/netdev-dummy.c
+++ b/lib/netdev-dummy.c
@@ -36,7 +36,7 @@ 
 #include "packets.h"
 #include "pcap-file.h"
 #include "poll-loop.h"
-#include "shash.h"
+#include "openvswitch/shash.h"
 #include "sset.h"
 #include "stream.h"
 #include "unaligned.h"
diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
index 486910a..eefd0b5 100644
--- a/lib/netdev-linux.c
+++ b/lib/netdev-linux.c
@@ -55,7 +55,7 @@ 
 #include "openvswitch/dynamic-string.h"
 #include "fatal-signal.h"
 #include "hash.h"
-#include "hmap.h"
+#include "openvswitch/hmap.h"
 #include "netdev-provider.h"
 #include "netdev-vport.h"
 #include "netlink-notifier.h"
@@ -67,12 +67,13 @@ 
 #include "packets.h"
 #include "poll-loop.h"
 #include "rtnetlink.h"
-#include "shash.h"
+#include "openvswitch/shash.h"
 #include "socket-util.h"
 #include "sset.h"
 #include "timer.h"
 #include "unaligned.h"
 #include "openvswitch/vlog.h"
+#include "util.h"
 
 VLOG_DEFINE_THIS_MODULE(netdev_linux);
 
diff --git a/lib/netdev-provider.h b/lib/netdev-provider.h
index 5da377f..95449bb 100644
--- a/lib/netdev-provider.h
+++ b/lib/netdev-provider.h
@@ -25,7 +25,7 @@ 
 #include "ovs-numa.h"
 #include "packets.h"
 #include "seq.h"
-#include "shash.h"
+#include "openvswitch/shash.h"
 #include "smap.h"
 
 #ifdef  __cplusplus
diff --git a/lib/netdev-windows.c b/lib/netdev-windows.c
index c21ffe7..3218490 100644
--- a/lib/netdev-windows.c
+++ b/lib/netdev-windows.c
@@ -27,7 +27,7 @@ 
 #include "openvswitch/ofpbuf.h"
 #include "packets.h"
 #include "poll-loop.h"
-#include "shash.h"
+#include "openvswitch/shash.h"
 #include "svec.h"
 #include "openvswitch/vlog.h"
 #include "odp-netlink.h"
diff --git a/lib/netdev.c b/lib/netdev.c
index 6651173..37c9998 100644
--- a/lib/netdev.c
+++ b/lib/netdev.c
@@ -47,7 +47,7 @@ 
 #include "packets.h"
 #include "poll-loop.h"
 #include "seq.h"
-#include "shash.h"
+#include "openvswitch/shash.h"
 #include "smap.h"
 #include "sset.h"
 #include "svec.h"
diff --git a/lib/netlink-conntrack.h b/lib/netlink-conntrack.h
index f75259c..1263b21 100644
--- a/lib/netlink-conntrack.h
+++ b/lib/netlink-conntrack.h
@@ -21,7 +21,7 @@ 
 #include "compiler.h"
 #include "ct-dpif.h"
 #include "openvswitch/dynamic-string.h"
-#include "hmap.h"
+#include "openvswitch/hmap.h"
 #include "openvswitch/ofpbuf.h"
 #include "timeval.h"
 #include "unixctl.h"
diff --git a/lib/netlink-socket.c b/lib/netlink-socket.c
index 32b0cc3..25bad38 100644
--- a/lib/netlink-socket.c
+++ b/lib/netlink-socket.c
@@ -25,7 +25,7 @@ 
 #include "coverage.h"
 #include "openvswitch/dynamic-string.h"
 #include "hash.h"
-#include "hmap.h"
+#include "openvswitch/hmap.h"
 #include "netlink.h"
 #include "netlink-protocol.h"
 #include "odp-netlink.h"
diff --git a/lib/netlink.c b/lib/netlink.c
index fbdb78e..4715d68 100644
--- a/lib/netlink.c
+++ b/lib/netlink.c
@@ -27,6 +27,7 @@ 
 #include "timeval.h"
 #include "unaligned.h"
 #include "openvswitch/vlog.h"
+#include "util.h"
 
 VLOG_DEFINE_THIS_MODULE(netlink);
 
diff --git a/lib/nx-match.c b/lib/nx-match.c
index 9a2ada9..2715626 100644
--- a/lib/nx-match.c
+++ b/lib/nx-match.c
@@ -22,7 +22,7 @@ 
 
 #include "classifier.h"
 #include "colors.h"
-#include "hmap.h"
+#include "openvswitch/hmap.h"
 #include "openflow/nicira-ext.h"
 #include "openvswitch/dynamic-string.h"
 #include "openvswitch/meta-flow.h"
@@ -32,7 +32,7 @@ 
 #include "openvswitch/ofpbuf.h"
 #include "openvswitch/vlog.h"
 #include "packets.h"
-#include "shash.h"
+#include "openvswitch/shash.h"
 #include "tun-metadata.h"
 #include "unaligned.h"
 #include "util.h"
diff --git a/lib/odp-util.h b/lib/odp-util.h
index 53ee661..51a4c02 100644
--- a/lib/odp-util.h
+++ b/lib/odp-util.h
@@ -23,7 +23,7 @@ 
 #include <string.h>
 #include "flow.h"
 #include "hash.h"
-#include "hmap.h"
+#include "openvswitch/hmap.h"
 #include "odp-netlink.h"
 #include "openflow/openflow.h"
 #include "util.h"
diff --git a/lib/ofp-actions.c b/lib/ofp-actions.c
index 997cc15..59c9bc1 100644
--- a/lib/ofp-actions.c
+++ b/lib/ofp-actions.c
@@ -22,7 +22,7 @@ 
 #include "colors.h"
 #include "compiler.h"
 #include "dummy.h"
-#include "hmap.h"
+#include "openvswitch/hmap.h"
 #include "learn.h"
 #include "multipath.h"
 #include "nx-match.h"
diff --git a/lib/ofp-msgs.c b/lib/ofp-msgs.c
index 8154539..f9660fc 100644
--- a/lib/ofp-msgs.c
+++ b/lib/ofp-msgs.c
@@ -17,7 +17,7 @@ 
 #include <config.h>
 #include "byte-order.h"
 #include "hash.h"
-#include "hmap.h"
+#include "openvswitch/hmap.h"
 #include "openflow/nicira-ext.h"
 #include "openflow/openflow.h"
 #include "openvswitch/dynamic-string.h"
@@ -25,6 +25,7 @@ 
 #include "openvswitch/ofpbuf.h"
 #include "openvswitch/vlog.h"
 #include "ovs-thread.h"
+#include "util.h"
 
 VLOG_DEFINE_THIS_MODULE(ofp_msgs);
 
diff --git a/lib/ofp-parse.c b/lib/ofp-parse.c
index 4af6d9b..370e3e5 100644
--- a/lib/ofp-parse.c
+++ b/lib/ofp-parse.c
@@ -38,6 +38,7 @@ 
 #include "packets.h"
 #include "simap.h"
 #include "socket-util.h"
+#include "util.h"
 
 /* Parses 'str' as an 8-bit unsigned integer into '*valuep'.
  *
diff --git a/lib/ofp-util.c b/lib/ofp-util.c
index 2b214ea..33f6ff8 100644
--- a/lib/ofp-util.c
+++ b/lib/ofp-util.c
@@ -49,6 +49,7 @@ 
 #include "random.h"
 #include "tun-metadata.h"
 #include "unaligned.h"
+#include "util.h"
 #include "uuid.h"
 
 VLOG_DEFINE_THIS_MODULE(ofp_util);
diff --git a/lib/ovs-lldp.h b/lib/ovs-lldp.h
index b5c3a48..0e536e8 100644
--- a/lib/ovs-lldp.h
+++ b/lib/ovs-lldp.h
@@ -21,7 +21,7 @@ 
 
 #include <stdint.h>
 #include "dp-packet.h"
-#include "hmap.h"
+#include "openvswitch/hmap.h"
 #include "openvswitch/list.h"
 #include "lldp/lldpd.h"
 #include "ovs-atomic.h"
diff --git a/lib/ovs-numa.c b/lib/ovs-numa.c
index 7652636..c8173e0 100644
--- a/lib/ovs-numa.c
+++ b/lib/ovs-numa.c
@@ -28,7 +28,7 @@ 
 #endif /* __linux__ */
 
 #include "hash.h"
-#include "hmap.h"
+#include "openvswitch/hmap.h"
 #include "openvswitch/list.h"
 #include "ovs-thread.h"
 #include "openvswitch/vlog.h"
diff --git a/lib/ovs-rcu.c b/lib/ovs-rcu.c
index 8aef1f1..0614d98 100644
--- a/lib/ovs-rcu.c
+++ b/lib/ovs-rcu.c
@@ -24,6 +24,7 @@ 
 #include "poll-loop.h"
 #include "seq.h"
 #include "timeval.h"
+#include "util.h"
 #include "openvswitch/vlog.h"
 
 VLOG_DEFINE_THIS_MODULE(ovs_rcu);
diff --git a/lib/ovsdb-data.c b/lib/ovsdb-data.c
index 22176cd..266a3e4 100644
--- a/lib/ovsdb-data.c
+++ b/lib/ovsdb-data.c
@@ -27,11 +27,12 @@ 
 #include "ovs-thread.h"
 #include "ovsdb-error.h"
 #include "ovsdb-parser.h"
-#include "json.h"
-#include "shash.h"
+#include "openvswitch/json.h"
+#include "openvswitch/shash.h"
 #include "smap.h"
 #include "sort.h"
 #include "unicode.h"
+#include "util.h"
 
 static struct json *
 wrap_json(const char *name, struct json *wrapped)
diff --git a/lib/ovsdb-data.h b/lib/ovsdb-data.h
index 2789540..98633ef 100644
--- a/lib/ovsdb-data.h
+++ b/lib/ovsdb-data.h
@@ -19,7 +19,7 @@ 
 #include <stdlib.h>
 #include "compiler.h"
 #include "ovsdb-types.h"
-#include "shash.h"
+#include "openvswitch/shash.h"
 
 struct ds;
 struct ovsdb_symbol_table;
diff --git a/lib/ovsdb-error.c b/lib/ovsdb-error.c
index dbe8149..dfa4249 100644
--- a/lib/ovsdb-error.c
+++ b/lib/ovsdb-error.c
@@ -21,7 +21,7 @@ 
 
 #include "backtrace.h"
 #include "openvswitch/dynamic-string.h"
-#include "json.h"
+#include "openvswitch/json.h"
 #include "util.h"
 #include "openvswitch/vlog.h"
 
diff --git a/lib/ovsdb-idl-provider.h b/lib/ovsdb-idl-provider.h
index 04cf419..075adbb 100644
--- a/lib/ovsdb-idl-provider.h
+++ b/lib/ovsdb-idl-provider.h
@@ -16,12 +16,12 @@ 
 #ifndef OVSDB_IDL_PROVIDER_H
 #define OVSDB_IDL_PROVIDER_H 1
 
-#include "hmap.h"
+#include "openvswitch/hmap.h"
 #include "openvswitch/list.h"
 #include "ovsdb-idl.h"
 #include "ovsdb-map-op.h"
 #include "ovsdb-types.h"
-#include "shash.h"
+#include "openvswitch/shash.h"
 #include "uuid.h"
 
 struct ovsdb_idl_row {
diff --git a/lib/ovsdb-idl.c b/lib/ovsdb-idl.c
index 9b3e933..a47a091 100644
--- a/lib/ovsdb-idl.c
+++ b/lib/ovsdb-idl.c
@@ -26,7 +26,7 @@ 
 #include "coverage.h"
 #include "openvswitch/dynamic-string.h"
 #include "fatal-signal.h"
-#include "json.h"
+#include "openvswitch/json.h"
 #include "jsonrpc.h"
 #include "ovsdb/ovsdb.h"
 #include "ovsdb/table.h"
@@ -35,7 +35,7 @@ 
 #include "ovsdb-idl-provider.h"
 #include "ovsdb-parser.h"
 #include "poll-loop.h"
-#include "shash.h"
+#include "openvswitch/shash.h"
 #include "sset.h"
 #include "util.h"
 #include "openvswitch/vlog.h"
diff --git a/lib/ovsdb-map-op.c b/lib/ovsdb-map-op.c
index 23fc5f5..7b90ba8 100644
--- a/lib/ovsdb-map-op.c
+++ b/lib/ovsdb-map-op.c
@@ -17,7 +17,7 @@ 
 #include <config.h>
 #include "ovsdb-map-op.h"
 #include "util.h"
-#include "hmap.h"
+#include "openvswitch/hmap.h"
 #include "hash.h"
 
 /* Map Operation: a Partial Map Update */
diff --git a/lib/ovsdb-parser.h b/lib/ovsdb-parser.h
index 2f9f483..31c5a60 100644
--- a/lib/ovsdb-parser.h
+++ b/lib/ovsdb-parser.h
@@ -18,7 +18,7 @@ 
 
 #include <stdbool.h>
 #include "compiler.h"
-#include "json.h"
+#include "openvswitch/json.h"
 #include "sset.h"
 #include "util.h"
 
diff --git a/lib/ovsdb-types.c b/lib/ovsdb-types.c
index 91d5216..20a8444 100644
--- a/lib/ovsdb-types.c
+++ b/lib/ovsdb-types.c
@@ -21,11 +21,12 @@ 
 #include <limits.h>
 
 #include "openvswitch/dynamic-string.h"
-#include "json.h"
+#include "openvswitch/json.h"
 #include "ovs-thread.h"
 #include "ovsdb-data.h"
 #include "ovsdb-error.h"
 #include "ovsdb-parser.h"
+#include "util.h"
 
 const struct ovsdb_type ovsdb_type_integer =
     OVSDB_TYPE_SCALAR_INITIALIZER(OVSDB_BASE_INTEGER_INIT);
diff --git a/lib/packets.c b/lib/packets.c
index a27264c..f9efc05 100644
--- a/lib/packets.c
+++ b/lib/packets.c
@@ -26,7 +26,7 @@ 
 #include "csum.h"
 #include "crc32c.h"
 #include "flow.h"
-#include "hmap.h"
+#include "openvswitch/hmap.h"
 #include "openvswitch/dynamic-string.h"
 #include "ovs-thread.h"
 #include "odp-util.h"
diff --git a/lib/pcap-file.c b/lib/pcap-file.c
index a850d21..dd4d229 100644
--- a/lib/pcap-file.c
+++ b/lib/pcap-file.c
@@ -25,10 +25,11 @@ 
 #include "compiler.h"
 #include "dp-packet.h"
 #include "flow.h"
-#include "hmap.h"
+#include "openvswitch/hmap.h"
 #include "packets.h"
 #include "timeval.h"
 #include "unaligned.h"
+#include "util.h"
 #include "openvswitch/vlog.h"
 
 VLOG_DEFINE_THIS_MODULE(pcap);
diff --git a/lib/perf-counter.c b/lib/perf-counter.c
index c5144e7..da60df7 100644
--- a/lib/perf-counter.c
+++ b/lib/perf-counter.c
@@ -28,7 +28,7 @@ 
 #include <asm/unistd.h>
 #include "openvswitch/dynamic-string.h"
 #include "perf-counter.h"
-#include "shash.h"
+#include "openvswitch/shash.h"
 #include "util.h"
 
 static struct shash perf_counters = SHASH_INITIALIZER(&perf_counters);
diff --git a/lib/poll-loop.c b/lib/poll-loop.c
index 925198f..4f32189 100644
--- a/lib/poll-loop.c
+++ b/lib/poll-loop.c
@@ -30,7 +30,7 @@ 
 #include "socket-util.h"
 #include "timeval.h"
 #include "openvswitch/vlog.h"
-#include "hmap.h"
+#include "openvswitch/hmap.h"
 #include "hash.h"
 
 VLOG_DEFINE_THIS_MODULE(poll_loop);
diff --git a/lib/reconnect.c b/lib/reconnect.c
index bab821e..471fb7f 100644
--- a/lib/reconnect.c
+++ b/lib/reconnect.c
@@ -20,6 +20,7 @@ 
 #include <stdlib.h>
 
 #include "poll-loop.h"
+#include "util.h"
 #include "openvswitch/vlog.h"
 
 VLOG_DEFINE_THIS_MODULE(reconnect);
diff --git a/lib/rstp-common.h b/lib/rstp-common.h
index 6d5acfc..27e8079 100644
--- a/lib/rstp-common.h
+++ b/lib/rstp-common.h
@@ -33,7 +33,7 @@ 
 #include "rstp.h"
 #include <stdbool.h>
 #include <stdint.h>
-#include "hmap.h"
+#include "openvswitch/hmap.h"
 #include "openvswitch/list.h"
 #include "ovs-atomic.h"
 #include "packets.h"
diff --git a/lib/seq.c b/lib/seq.c
index b8b5b65..6e2f596 100644
--- a/lib/seq.c
+++ b/lib/seq.c
@@ -22,7 +22,7 @@ 
 
 #include "coverage.h"
 #include "hash.h"
-#include "hmap.h"
+#include "openvswitch/hmap.h"
 #include "latch.h"
 #include "openvswitch/list.h"
 #include "ovs-thread.h"
diff --git a/lib/shash.c b/lib/shash.c
index 4285c07..3e94b17 100644
--- a/lib/shash.c
+++ b/lib/shash.c
@@ -15,7 +15,7 @@ 
  */
 
 #include <config.h>
-#include "shash.h"
+#include "openvswitch/shash.h"
 #include "hash.h"
 
 static struct shash_node *shash_find__(const struct shash *,
diff --git a/lib/shash.h b/lib/shash.h
deleted file mode 100644
index 5f94725..0000000
--- a/lib/shash.h
+++ /dev/null
@@ -1,81 +0,0 @@ 
-/*
- * Copyright (c) 2009, 2010, 2011, 2016 Nicira, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef SHASH_H
-#define SHASH_H 1
-
-#include "hmap.h"
-#include "util.h"
-
-#ifdef  __cplusplus
-extern "C" {
-#endif
-
-struct shash_node {
-    struct hmap_node node;
-    char *name;
-    void *data;
-};
-
-struct shash {
-    struct hmap map;
-};
-
-#define SHASH_INITIALIZER(SHASH) { HMAP_INITIALIZER(&(SHASH)->map) }
-
-#define SHASH_FOR_EACH(SHASH_NODE, SHASH)                               \
-    HMAP_FOR_EACH_INIT (SHASH_NODE, node, &(SHASH)->map,                \
-                        BUILD_ASSERT_TYPE(SHASH_NODE, struct shash_node *), \
-                        BUILD_ASSERT_TYPE(SHASH, struct shash *))
-
-#define SHASH_FOR_EACH_SAFE(SHASH_NODE, NEXT, SHASH)        \
-    HMAP_FOR_EACH_SAFE_INIT (                               \
-        SHASH_NODE, NEXT, node, &(SHASH)->map,              \
-        BUILD_ASSERT_TYPE(SHASH_NODE, struct shash_node *), \
-        BUILD_ASSERT_TYPE(NEXT, struct shash_node *),       \
-        BUILD_ASSERT_TYPE(SHASH, struct shash *))
-
-void shash_init(struct shash *);
-void shash_destroy(struct shash *);
-void shash_destroy_free_data(struct shash *);
-void shash_swap(struct shash *, struct shash *);
-void shash_moved(struct shash *);
-void shash_clear(struct shash *);
-void shash_clear_free_data(struct shash *);
-bool shash_is_empty(const struct shash *);
-size_t shash_count(const struct shash *);
-struct shash_node *shash_add(struct shash *, const char *, const void *);
-struct shash_node *shash_add_nocopy(struct shash *, char *, const void *);
-bool shash_add_once(struct shash *, const char *, const void *);
-void shash_add_assert(struct shash *, const char *, const void *);
-void *shash_replace(struct shash *, const char *, const void *data);
-void shash_delete(struct shash *, struct shash_node *);
-char *shash_steal(struct shash *, struct shash_node *);
-struct shash_node *shash_find(const struct shash *, const char *);
-struct shash_node *shash_find_len(const struct shash *, const char *, size_t);
-void *shash_find_data(const struct shash *, const char *);
-void *shash_find_and_delete(struct shash *, const char *);
-void *shash_find_and_delete_assert(struct shash *, const char *);
-struct shash_node *shash_first(const struct shash *);
-const struct shash_node **shash_sort(const struct shash *);
-bool shash_equal_keys(const struct shash *, const struct shash *);
-struct shash_node *shash_random_node(struct shash *);
-
-#ifdef  __cplusplus
-}
-#endif
-
-#endif /* shash.h */
diff --git a/lib/simap.h b/lib/simap.h
index 113db93..9486080 100644
--- a/lib/simap.h
+++ b/lib/simap.h
@@ -17,7 +17,7 @@ 
 #ifndef SIMAP_H
 #define SIMAP_H 1
 
-#include "hmap.h"
+#include "openvswitch/hmap.h"
 
 #ifdef  __cplusplus
 extern "C" {
diff --git a/lib/smap.c b/lib/smap.c
index 07dd23a..aff7eb0 100644
--- a/lib/smap.c
+++ b/lib/smap.c
@@ -18,7 +18,7 @@ 
 #include <strings.h>
 
 #include "hash.h"
-#include "json.h"
+#include "openvswitch/json.h"
 #include "packets.h"
 #include "uuid.h"
 
diff --git a/lib/smap.h b/lib/smap.h
index 038b769..29f99e6 100644
--- a/lib/smap.h
+++ b/lib/smap.h
@@ -17,7 +17,7 @@ 
 
 #include <netinet/in.h>
 #include "hash.h"
-#include "hmap.h"
+#include "openvswitch/hmap.h"
 
 struct json;
 struct uuid;
diff --git a/lib/sset.h b/lib/sset.h
index 9c2f703..aa57521 100644
--- a/lib/sset.h
+++ b/lib/sset.h
@@ -17,7 +17,7 @@ 
 #ifndef SSET_H
 #define SSET_H
 
-#include "hmap.h"
+#include "openvswitch/hmap.h"
 #include "util.h"
 
 #ifdef __cplusplus
diff --git a/lib/stream-ssl.c b/lib/stream-ssl.c
index bf80fc8..a5c32a1 100644
--- a/lib/stream-ssl.c
+++ b/lib/stream-ssl.c
@@ -39,7 +39,7 @@ 
 #include "openflow/openflow.h"
 #include "packets.h"
 #include "poll-loop.h"
-#include "shash.h"
+#include "openvswitch/shash.h"
 #include "socket-util.h"
 #include "util.h"
 #include "stream-provider.h"
diff --git a/lib/table.c b/lib/table.c
index a2cfe3d..9158499 100644
--- a/lib/table.c
+++ b/lib/table.c
@@ -19,7 +19,7 @@ 
 #include "table.h"
 
 #include "openvswitch/dynamic-string.h"
-#include "json.h"
+#include "openvswitch/json.h"
 #include "ovsdb-data.h"
 #include "ovsdb-error.h"
 #include "timeval.h"
diff --git a/lib/timeval.c b/lib/timeval.c
index 8e5f971..0e8709a 100644
--- a/lib/timeval.c
+++ b/lib/timeval.c
@@ -30,7 +30,7 @@ 
 #include "openvswitch/dynamic-string.h"
 #include "fatal-signal.h"
 #include "hash.h"
-#include "hmap.h"
+#include "openvswitch/hmap.h"
 #include "ovs-rcu.h"
 #include "ovs-thread.h"
 #include "signals.h"
diff --git a/lib/tun-metadata.c b/lib/tun-metadata.c
index 7a2a84f..36006e3 100644
--- a/lib/tun-metadata.c
+++ b/lib/tun-metadata.c
@@ -20,7 +20,7 @@ 
 
 #include "bitmap.h"
 #include "compiler.h"
-#include "hmap.h"
+#include "openvswitch/hmap.h"
 #include "openvswitch/match.h"
 #include "nx-match.h"
 #include "odp-netlink.h"
@@ -29,6 +29,7 @@ 
 #include "ovs-rcu.h"
 #include "packets.h"
 #include "tun-metadata.h"
+#include "util.h"
 
 struct tun_meta_entry {
     struct hmap_node node;      /* In struct tun_table's key_hmap. */
diff --git a/lib/unixctl.c b/lib/unixctl.c
index 935c145..5e5d26c 100644
--- a/lib/unixctl.c
+++ b/lib/unixctl.c
@@ -21,11 +21,11 @@ 
 #include "coverage.h"
 #include "dirs.h"
 #include "openvswitch/dynamic-string.h"
-#include "json.h"
+#include "openvswitch/json.h"
 #include "jsonrpc.h"
 #include "openvswitch/list.h"
 #include "poll-loop.h"
-#include "shash.h"
+#include "openvswitch/shash.h"
 #include "stream.h"
 #include "stream-provider.h"
 #include "svec.h"
diff --git a/lib/util.h b/lib/util.h
index e738c9f..5049d15 100644
--- a/lib/util.h
+++ b/lib/util.h
@@ -25,6 +25,7 @@ 
 #include <stdlib.h>
 #include <string.h>
 #include "compiler.h"
+#include "util.h"
 #include "openvswitch/util.h"
 
 extern char *program_name;
diff --git a/ofproto/bond.c b/ofproto/bond.c
index 032b8f6..1d0c3ce 100644
--- a/ofproto/bond.c
+++ b/ofproto/bond.c
@@ -27,7 +27,7 @@ 
 #include "coverage.h"
 #include "dp-packet.h"
 #include "flow.h"
-#include "hmap.h"
+#include "openvswitch/hmap.h"
 #include "lacp.h"
 #include "netdev.h"
 #include "odp-util.h"
@@ -44,9 +44,10 @@ 
 #include "packets.h"
 #include "poll-loop.h"
 #include "seq.h"
-#include "shash.h"
+#include "openvswitch/shash.h"
 #include "timeval.h"
 #include "unixctl.h"
+#include "util.h"
 
 VLOG_DEFINE_THIS_MODULE(bond);
 
diff --git a/ofproto/bundles.c b/ofproto/bundles.c
index 232cc15..aa8e58c 100644
--- a/ofproto/bundles.c
+++ b/ofproto/bundles.c
@@ -34,7 +34,7 @@ 
 #include "poll-loop.h"
 #include "pktbuf.h"
 #include "rconn.h"
-#include "shash.h"
+#include "openvswitch/shash.h"
 #include "simap.h"
 #include "stream.h"
 #include "timeval.h"
diff --git a/ofproto/connmgr.c b/ofproto/connmgr.c
index 0c48b77..d70d990 100644
--- a/ofproto/connmgr.c
+++ b/ofproto/connmgr.c
@@ -36,10 +36,11 @@ 
 #include "poll-loop.h"
 #include "pktbuf.h"
 #include "rconn.h"
-#include "shash.h"
+#include "openvswitch/shash.h"
 #include "simap.h"
 #include "stream.h"
 #include "timeval.h"
+#include "util.h"
 
 VLOG_DEFINE_THIS_MODULE(connmgr);
 static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5);
diff --git a/ofproto/connmgr.h b/ofproto/connmgr.h
index 30e7ae5..be4ce28 100644
--- a/ofproto/connmgr.h
+++ b/ofproto/connmgr.h
@@ -18,7 +18,7 @@ 
 #define CONNMGR_H 1
 
 #include "classifier.h"
-#include "hmap.h"
+#include "openvswitch/hmap.h"
 #include "openvswitch/list.h"
 #include "openvswitch/match.h"
 #include "openvswitch/ofp-util.h"
diff --git a/ofproto/ofproto-dpif-ipfix.c b/ofproto/ofproto-dpif-ipfix.c
index 5744abb..0128c91 100644
--- a/ofproto/ofproto-dpif-ipfix.c
+++ b/ofproto/ofproto-dpif-ipfix.c
@@ -21,7 +21,7 @@ 
 #include "collectors.h"
 #include "flow.h"
 #include "hash.h"
-#include "hmap.h"
+#include "openvswitch/hmap.h"
 #include "netdev.h"
 #include "openvswitch/list.h"
 #include "openvswitch/ofpbuf.h"
diff --git a/ofproto/ofproto-dpif-mirror.c b/ofproto/ofproto-dpif-mirror.c
index 84b7845..675adf3 100644
--- a/ofproto/ofproto-dpif-mirror.c
+++ b/ofproto/ofproto-dpif-mirror.c
@@ -18,7 +18,7 @@ 
 
 #include <errno.h>
 
-#include "hmap.h"
+#include "openvswitch/hmap.h"
 #include "hmapx.h"
 #include "ofproto.h"
 #include "vlan-bitmap.h"
diff --git a/ofproto/ofproto-dpif-monitor.c b/ofproto/ofproto-dpif-monitor.c
index 11d7a54..623d517 100644
--- a/ofproto/ofproto-dpif-monitor.c
+++ b/ofproto/ofproto-dpif-monitor.c
@@ -25,7 +25,7 @@ 
 #include "guarded-list.h"
 #include "hash.h"
 #include "heap.h"
-#include "hmap.h"
+#include "openvswitch/hmap.h"
 #include "latch.h"
 #include "openvswitch/ofpbuf.h"
 #include "ofproto-dpif.h"
diff --git a/ofproto/ofproto-dpif-sflow.c b/ofproto/ofproto-dpif-sflow.c
index 7d0aa36..8a19d15 100644
--- a/ofproto/ofproto-dpif-sflow.c
+++ b/ofproto/ofproto-dpif-sflow.c
@@ -26,7 +26,7 @@ 
 #include "compiler.h"
 #include "dpif.h"
 #include "hash.h"
-#include "hmap.h"
+#include "openvswitch/hmap.h"
 #include "netdev.h"
 #include "netlink.h"
 #include "openvswitch/ofpbuf.h"
diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c
index 1977b6b..fec7544 100644
--- a/ofproto/ofproto-dpif-xlate.c
+++ b/ofproto/ofproto-dpif-xlate.c
@@ -59,6 +59,7 @@ 
 #include "tnl-neigh-cache.h"
 #include "tnl-ports.h"
 #include "tunnel.h"
+#include "util.h"
 
 COVERAGE_DEFINE(xlate_actions);
 COVERAGE_DEFINE(xlate_actions_oversize);
diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
index ce9383a..faff1c7 100644
--- a/ofproto/ofproto-dpif.c
+++ b/ofproto/ofproto-dpif.c
@@ -68,6 +68,7 @@ 
 #include "tunnel.h"
 #include "unaligned.h"
 #include "unixctl.h"
+#include "util.h"
 #include "vlan-bitmap.h"
 
 VLOG_DEFINE_THIS_MODULE(ofproto_dpif);
diff --git a/ofproto/ofproto-provider.h b/ofproto/ofproto-provider.h
index ae6c08d..25f8dc0 100644
--- a/ofproto/ofproto-provider.h
+++ b/ofproto/ofproto-provider.h
@@ -46,7 +46,7 @@ 
 #include "ovs-atomic.h"
 #include "ovs-rcu.h"
 #include "ovs-thread.h"
-#include "shash.h"
+#include "openvswitch/shash.h"
 #include "simap.h"
 #include "timeval.h"
 
diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index 5f84aa1..dcb0a08 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -31,7 +31,7 @@ 
 #include "coverage.h"
 #include "dp-packet.h"
 #include "hash.h"
-#include "hmap.h"
+#include "openvswitch/hmap.h"
 #include "netdev.h"
 #include "nx-match.h"
 #include "ofproto.h"
@@ -54,7 +54,7 @@ 
 #include "poll-loop.h"
 #include "random.h"
 #include "seq.h"
-#include "shash.h"
+#include "openvswitch/shash.h"
 #include "simap.h"
 #include "smap.h"
 #include "sset.h"
@@ -62,6 +62,7 @@ 
 #include "tun-metadata.h"
 #include "unaligned.h"
 #include "unixctl.h"
+#include "util.h"
 
 VLOG_DEFINE_THIS_MODULE(ofproto);
 
diff --git a/ofproto/pinsched.c b/ofproto/pinsched.c
index ee252f4..51f1760 100644
--- a/ofproto/pinsched.c
+++ b/ofproto/pinsched.c
@@ -23,7 +23,7 @@ 
 #include <stdlib.h>
 #include "flow.h"
 #include "hash.h"
-#include "hmap.h"
+#include "openvswitch/hmap.h"
 #include "openvswitch/ofpbuf.h"
 #include "openflow/openflow.h"
 #include "poll-loop.h"
diff --git a/ofproto/tunnel.c b/ofproto/tunnel.c
index 9695c54..fd48d6c 100644
--- a/ofproto/tunnel.c
+++ b/ofproto/tunnel.c
@@ -24,7 +24,7 @@ 
 #include "openvswitch/dynamic-string.h"
 #include "fat-rwlock.h"
 #include "hash.h"
-#include "hmap.h"
+#include "openvswitch/hmap.h"
 #include "netdev.h"
 #include "odp-util.h"
 #include "openvswitch/ofpbuf.h"
diff --git a/ovn/controller-vtep/binding.c b/ovn/controller-vtep/binding.c
index 65070d6..9cbfadc 100644
--- a/ovn/controller-vtep/binding.c
+++ b/ovn/controller-vtep/binding.c
@@ -16,7 +16,7 @@ 
 #include <config.h>
 #include "binding.h"
 
-#include "lib/shash.h"
+#include "openvswitch/shash.h"
 #include "lib/smap.h"
 #include "lib/util.h"
 #include "openvswitch/vlog.h"
diff --git a/ovn/controller-vtep/vtep.c b/ovn/controller-vtep/vtep.c
index 9e11e28..976e933 100644
--- a/ovn/controller-vtep/vtep.c
+++ b/ovn/controller-vtep/vtep.c
@@ -18,8 +18,8 @@ 
 #include "vtep.h"
 
 #include "lib/hash.h"
-#include "lib/hmap.h"
-#include "lib/shash.h"
+#include "openvswitch/hmap.h"
+#include "openvswitch/shash.h"
 #include "lib/smap.h"
 #include "lib/sset.h"
 #include "lib/util.h"
diff --git a/ovn/controller/binding.c b/ovn/controller/binding.c
index 4704226..101864b 100644
--- a/ovn/controller/binding.c
+++ b/ovn/controller/binding.c
@@ -17,7 +17,7 @@ 
 #include "binding.h"
 
 #include "lib/bitmap.h"
-#include "lib/hmap.h"
+#include "openvswitch/hmap.h"
 #include "lib/sset.h"
 #include "lib/util.h"
 #include "lib/vswitch-idl.h"
diff --git a/ovn/controller/chassis.c b/ovn/controller/chassis.c
index d40181b..502e74d 100644
--- a/ovn/controller/chassis.c
+++ b/ovn/controller/chassis.c
@@ -24,6 +24,7 @@ 
 #include "openvswitch/vlog.h"
 #include "ovn/lib/ovn-sb-idl.h"
 #include "ovn-controller.h"
+#include "lib/util.h"
 
 VLOG_DEFINE_THIS_MODULE(chassis);
 
diff --git a/ovn/controller/lport.h b/ovn/controller/lport.h
index 33f81d5..f681cb3 100644
--- a/ovn/controller/lport.h
+++ b/ovn/controller/lport.h
@@ -17,7 +17,7 @@ 
 #define OVN_LPORT_H 1
 
 #include <stdint.h>
-#include "hmap.h"
+#include "openvswitch/hmap.h"
 #include "uuid.h"
 
 struct ovsdb_idl;
diff --git a/ovn/controller/ofctrl.c b/ovn/controller/ofctrl.c
index 4c410da..bbc580d 100644
--- a/ovn/controller/ofctrl.c
+++ b/ovn/controller/ofctrl.c
@@ -18,7 +18,7 @@ 
 #include "byte-order.h"
 #include "dirs.h"
 #include "hash.h"
-#include "hmap.h"
+#include "openvswitch/hmap.h"
 #include "ofctrl.h"
 #include "openflow/openflow.h"
 #include "openvswitch/dynamic-string.h"
diff --git a/ovn/controller/ovn-controller.c b/ovn/controller/ovn-controller.c
index 28ee13e..bd88c7d 100644
--- a/ovn/controller/ovn-controller.c
+++ b/ovn/controller/ovn-controller.c
@@ -32,7 +32,7 @@ 
 #include "openvswitch/dynamic-string.h"
 #include "encaps.h"
 #include "fatal-signal.h"
-#include "hmap.h"
+#include "openvswitch/hmap.h"
 #include "lflow.h"
 #include "lib/vswitch-idl.h"
 #include "lport.h"
diff --git a/ovn/controller/patch.c b/ovn/controller/patch.c
index 52d9e8d..eab3c1e 100644
--- a/ovn/controller/patch.c
+++ b/ovn/controller/patch.c
@@ -18,7 +18,7 @@ 
 #include "patch.h"
 
 #include "hash.h"
-#include "lib/hmap.h"
+#include "openvswitch/hmap.h"
 #include "lib/vswitch-idl.h"
 #include "openvswitch/vlog.h"
 #include "ovn-controller.h"
diff --git a/ovn/controller/physical.c b/ovn/controller/physical.c
index d1b40c2..cb4da3a 100644
--- a/ovn/controller/physical.c
+++ b/ovn/controller/physical.c
@@ -26,10 +26,11 @@ 
 #include "ovn/lib/ovn-sb-idl.h"
 #include "ovn/lib/ovn-util.h"
 #include "physical.h"
-#include "shash.h"
+#include "openvswitch/shash.h"
 #include "simap.h"
 #include "smap.h"
 #include "sset.h"
+#include "util.h"
 #include "vswitch-idl.h"
 
 VLOG_DEFINE_THIS_MODULE(physical);
diff --git a/ovn/lib/actions.c b/ovn/lib/actions.c
index 3d10d61..6819a45 100644
--- a/ovn/lib/actions.c
+++ b/ovn/lib/actions.c
@@ -24,7 +24,7 @@ 
 #include "ovn-dhcp.h"
 #include "expr.h"
 #include "hash.h"
-#include "hmap.h"
+#include "openvswitch/hmap.h"
 #include "lex.h"
 #include "logical-fields.h"
 #include "nx-match.h"
@@ -32,7 +32,7 @@ 
 #include "openvswitch/ofp-actions.h"
 #include "openvswitch/ofpbuf.h"
 #include "packets.h"
-#include "shash.h"
+#include "openvswitch/shash.h"
 #include "simap.h"
 
 /* Context maintained during actions_parse(). */
diff --git a/ovn/lib/actions.h b/ovn/lib/actions.h
index 48f0140..114c71e 100644
--- a/ovn/lib/actions.h
+++ b/ovn/lib/actions.h
@@ -20,7 +20,7 @@ 
 #include <stdbool.h>
 #include <stdint.h>
 #include "compiler.h"
-#include "hmap.h"
+#include "openvswitch/hmap.h"
 #include "openvswitch/dynamic-string.h"
 #include "util.h"
 
diff --git a/ovn/lib/expr.c b/ovn/lib/expr.c
index 8c0768d..1c38b99 100644
--- a/ovn/lib/expr.c
+++ b/ovn/lib/expr.c
@@ -17,16 +17,17 @@ 
 #include <config.h>
 #include "byte-order.h"
 #include "expr.h"
-#include "json.h"
+#include "openvswitch/json.h"
 #include "lex.h"
 #include "logical-fields.h"
 #include "openvswitch/dynamic-string.h"
 #include "openvswitch/match.h"
 #include "openvswitch/ofp-actions.h"
 #include "openvswitch/vlog.h"
-#include "shash.h"
+#include "openvswitch/shash.h"
 #include "simap.h"
 #include "sset.h"
+#include "util.h"
 
 VLOG_DEFINE_THIS_MODULE(expr);
 
diff --git a/ovn/lib/expr.h b/ovn/lib/expr.h
index ed5300f..d790c49 100644
--- a/ovn/lib/expr.h
+++ b/ovn/lib/expr.h
@@ -54,7 +54,7 @@ 
 
 #include "classifier.h"
 #include "lex.h"
-#include "hmap.h"
+#include "openvswitch/hmap.h"
 #include "openvswitch/list.h"
 #include "openvswitch/match.h"
 #include "openvswitch/meta-flow.h"
diff --git a/ovn/lib/lex.c b/ovn/lib/lex.c
index 52c0946..79aa221 100644
--- a/ovn/lib/lex.c
+++ b/ovn/lib/lex.c
@@ -20,7 +20,7 @@ 
 #include <errno.h>
 #include <stdarg.h>
 #include "openvswitch/dynamic-string.h"
-#include "json.h"
+#include "openvswitch/json.h"
 #include "packets.h"
 #include "util.h"
 
diff --git a/ovn/lib/ovn-dhcp.h b/ovn/lib/ovn-dhcp.h
index 4da614b..6750f95 100644
--- a/ovn/lib/ovn-dhcp.h
+++ b/ovn/lib/ovn-dhcp.h
@@ -17,7 +17,7 @@ 
 #ifndef OVN_DHCP_H
 #define OVN_DHCP_H 1
 
-#include "hmap.h"
+#include "openvswitch/hmap.h"
 #include "hash.h"
 
 struct dhcp_opts_map {
diff --git a/ovn/northd/ovn-northd.c b/ovn/northd/ovn-northd.c
index f4b4435..292bcef 100644
--- a/ovn/northd/ovn-northd.c
+++ b/ovn/northd/ovn-northd.c
@@ -24,8 +24,8 @@ 
 #include "openvswitch/dynamic-string.h"
 #include "fatal-signal.h"
 #include "hash.h"
-#include "hmap.h"
-#include "json.h"
+#include "openvswitch/hmap.h"
+#include "openvswitch/json.h"
 #include "ovn/lib/lex.h"
 #include "ovn/lib/ovn-nb-idl.h"
 #include "ovn/lib/ovn-sb-idl.h"
diff --git a/ovn/utilities/ovn-nbctl.c b/ovn/utilities/ovn-nbctl.c
index ad70a05..48a7469 100644
--- a/ovn/utilities/ovn-nbctl.c
+++ b/ovn/utilities/ovn-nbctl.c
@@ -23,7 +23,7 @@ 
 #include "db-ctl-base.h"
 #include "dirs.h"
 #include "fatal-signal.h"
-#include "json.h"
+#include "openvswitch/json.h"
 #include "ovn/lib/ovn-nb-idl.h"
 #include "packets.h"
 #include "poll-loop.h"
diff --git a/ovn/utilities/ovn-sbctl.c b/ovn/utilities/ovn-sbctl.c
index 37e4bce..815f3fb 100644
--- a/ovn/utilities/ovn-sbctl.c
+++ b/ovn/utilities/ovn-sbctl.c
@@ -34,13 +34,13 @@ 
 #include "compiler.h"
 #include "openvswitch/dynamic-string.h"
 #include "fatal-signal.h"
-#include "json.h"
+#include "openvswitch/json.h"
 #include "ovsdb-data.h"
 #include "ovsdb-idl.h"
 #include "poll-loop.h"
 #include "process.h"
 #include "sset.h"
-#include "shash.h"
+#include "openvswitch/shash.h"
 #include "stream-ssl.h"
 #include "stream.h"
 #include "table.h"
diff --git a/ovsdb/column.c b/ovsdb/column.c
index b41df2e..8838df3 100644
--- a/ovsdb/column.c
+++ b/ovsdb/column.c
@@ -21,7 +21,7 @@ 
 
 #include "column.h"
 #include "openvswitch/dynamic-string.h"
-#include "json.h"
+#include "openvswitch/json.h"
 #include "ovsdb-error.h"
 #include "ovsdb-parser.h"
 #include "table.h"
diff --git a/ovsdb/condition.c b/ovsdb/condition.c
index 4baf1bb..a76c168 100644
--- a/ovsdb/condition.c
+++ b/ovsdb/condition.c
@@ -20,10 +20,14 @@ 
 #include <limits.h>
 
 #include "column.h"
-#include "json.h"
+#include "openvswitch/json.h"
 #include "ovsdb-error.h"
 #include "row.h"
+
+#include <string.h>
+
 #include "table.h"
+#include "util.h"
 
 struct ovsdb_error *
 ovsdb_function_from_string(const char *name, enum ovsdb_function *function)
diff --git a/ovsdb/execution.c b/ovsdb/execution.c
index de25a87..83f7cfb 100644
--- a/ovsdb/execution.c
+++ b/ovsdb/execution.c
@@ -20,7 +20,7 @@ 
 #include "column.h"
 #include "condition.h"
 #include "file.h"
-#include "json.h"
+#include "openvswitch/json.h"
 #include "mutation.h"
 #include "ovsdb-data.h"
 #include "ovsdb-error.h"
diff --git a/ovsdb/file.c b/ovsdb/file.c
index 2894f30..7f8554a 100644
--- a/ovsdb/file.c
+++ b/ovsdb/file.c
@@ -24,7 +24,7 @@ 
 #include "bitmap.h"
 #include "column.h"
 #include "log.h"
-#include "json.h"
+#include "openvswitch/json.h"
 #include "lockfile.h"
 #include "ovsdb.h"
 #include "ovsdb-error.h"
diff --git a/ovsdb/jsonrpc-server.c b/ovsdb/jsonrpc-server.c
index 4913d7e..b11791f 100644
--- a/ovsdb/jsonrpc-server.c
+++ b/ovsdb/jsonrpc-server.c
@@ -23,7 +23,7 @@ 
 #include "column.h"
 #include "openvswitch/dynamic-string.h"
 #include "monitor.h"
-#include "json.h"
+#include "openvswitch/json.h"
 #include "jsonrpc.h"
 #include "ovsdb-error.h"
 #include "ovsdb-parser.h"
@@ -38,6 +38,7 @@ 
 #include "timeval.h"
 #include "transaction.h"
 #include "trigger.h"
+#include "util.h"
 #include "openvswitch/vlog.h"
 
 VLOG_DEFINE_THIS_MODULE(ovsdb_jsonrpc_server);
diff --git a/ovsdb/log.c b/ovsdb/log.c
index 8004d3d..380f5e9 100644
--- a/ovsdb/log.c
+++ b/ovsdb/log.c
@@ -24,7 +24,7 @@ 
 #include <sys/stat.h>
 #include <unistd.h>
 
-#include "json.h"
+#include "openvswitch/json.h"
 #include "lockfile.h"
 #include "ovsdb.h"
 #include "ovsdb-error.h"
diff --git a/ovsdb/monitor.c b/ovsdb/monitor.c
index e910e3f..949f77c 100644
--- a/ovsdb/monitor.c
+++ b/ovsdb/monitor.c
@@ -21,7 +21,7 @@ 
 #include "bitmap.h"
 #include "column.h"
 #include "openvswitch/dynamic-string.h"
-#include "json.h"
+#include "openvswitch/json.h"
 #include "jsonrpc.h"
 #include "ovsdb-error.h"
 #include "ovsdb-parser.h"
@@ -35,6 +35,7 @@ 
 #include "transaction.h"
 #include "jsonrpc-server.h"
 #include "monitor.h"
+#include "util.h"
 #include "openvswitch/vlog.h"
 
 
diff --git a/ovsdb/mutation.c b/ovsdb/mutation.c
index 6a43e34..e5d192e 100644
--- a/ovsdb/mutation.c
+++ b/ovsdb/mutation.c
@@ -22,9 +22,13 @@ 
 
 #include "column.h"
 #include "ovsdb-error.h"
-#include "json.h"
+#include "openvswitch/json.h"
 #include "row.h"
+
+#include <string.h>
+
 #include "table.h"
+#include "util.h"
 
 struct ovsdb_error *
 ovsdb_mutator_from_string(const char *name, enum ovsdb_mutator *mutator)
diff --git a/ovsdb/ovsdb-client.c b/ovsdb/ovsdb-client.c
index 80819a8..16dadea 100644
--- a/ovsdb/ovsdb-client.c
+++ b/ovsdb/ovsdb-client.c
@@ -32,7 +32,7 @@ 
 #include "dirs.h"
 #include "openvswitch/dynamic-string.h"
 #include "fatal-signal.h"
-#include "json.h"
+#include "openvswitch/json.h"
 #include "jsonrpc.h"
 #include "lib/table.h"
 #include "ovsdb.h"
diff --git a/ovsdb/ovsdb-server.c b/ovsdb/ovsdb-server.c
index 1b9de19..10ebb5e 100644
--- a/ovsdb/ovsdb-server.c
+++ b/ovsdb/ovsdb-server.c
@@ -30,7 +30,7 @@ 
 #include "fatal-signal.h"
 #include "file.h"
 #include "hash.h"
-#include "json.h"
+#include "openvswitch/json.h"
 #include "jsonrpc.h"
 #include "jsonrpc-server.h"
 #include "openvswitch/list.h"
@@ -45,7 +45,7 @@ 
 #include "replication.h"
 #include "row.h"
 #include "simap.h"
-#include "shash.h"
+#include "openvswitch/shash.h"
 #include "stream-ssl.h"
 #include "stream.h"
 #include "sset.h"
diff --git a/ovsdb/ovsdb-tool.c b/ovsdb/ovsdb-tool.c
index 37e219f..af83da2 100644
--- a/ovsdb/ovsdb-tool.c
+++ b/ovsdb/ovsdb-tool.c
@@ -31,7 +31,7 @@ 
 #include "file.h"
 #include "lockfile.h"
 #include "log.h"
-#include "json.h"
+#include "openvswitch/json.h"
 #include "ovsdb.h"
 #include "ovsdb-data.h"
 #include "ovsdb-error.h"
diff --git a/ovsdb/ovsdb.c b/ovsdb/ovsdb.c
index b7cc655..0391900 100644
--- a/ovsdb/ovsdb.c
+++ b/ovsdb/ovsdb.c
@@ -18,7 +18,7 @@ 
 #include "ovsdb.h"
 
 #include "column.h"
-#include "json.h"
+#include "openvswitch/json.h"
 #include "ovsdb-error.h"
 #include "ovsdb-parser.h"
 #include "ovsdb-types.h"
diff --git a/ovsdb/ovsdb.h b/ovsdb/ovsdb.h
index b3eaf15..418805c 100644
--- a/ovsdb/ovsdb.h
+++ b/ovsdb/ovsdb.h
@@ -17,9 +17,9 @@ 
 #define OVSDB_OVSDB_H 1
 
 #include "compiler.h"
-#include "hmap.h"
+#include "openvswitch/hmap.h"
 #include "openvswitch/list.h"
-#include "shash.h"
+#include "openvswitch/shash.h"
 
 struct json;
 struct ovsdb_log;
diff --git a/ovsdb/replication.c b/ovsdb/replication.c
index a267a3a..ee0548a 100644
--- a/ovsdb/replication.c
+++ b/ovsdb/replication.c
@@ -20,7 +20,7 @@ 
 #include "replication.h"
 
 #include "condition.h"
-#include "json.h"
+#include "openvswitch/json.h"
 #include "jsonrpc.h"
 #include "ovsdb.h"
 #include "ovsdb-error.h"
diff --git a/ovsdb/replication.h b/ovsdb/replication.h
index 74acdba..b2e2c77 100644
--- a/ovsdb/replication.h
+++ b/ovsdb/replication.h
@@ -18,7 +18,7 @@ 
 #ifndef REPLICATION_H
 #define REPLICATION_H 1
 
-#include "shash.h"
+#include "openvswitch/shash.h"
 
 struct db {
     /* Initialized in main(). */
diff --git a/ovsdb/row.c b/ovsdb/row.c
index 572c103..9c31294 100644
--- a/ovsdb/row.c
+++ b/ovsdb/row.c
@@ -20,11 +20,12 @@ 
 #include <stddef.h>
 
 #include "openvswitch/dynamic-string.h"
-#include "json.h"
+#include "openvswitch/json.h"
 #include "ovsdb-error.h"
-#include "shash.h"
+#include "openvswitch/shash.h"
 #include "sort.h"
 #include "table.h"
+#include "util.h"
 
 static struct ovsdb_row *
 allocate_row(const struct ovsdb_table *table)
diff --git a/ovsdb/row.h b/ovsdb/row.h
index b1d1edd..83024bc 100644
--- a/ovsdb/row.h
+++ b/ovsdb/row.h
@@ -19,7 +19,7 @@ 
 #include <stddef.h>
 #include <stdint.h>
 #include "column.h"
-#include "hmap.h"
+#include "openvswitch/hmap.h"
 #include "openvswitch/list.h"
 #include "ovsdb-data.h"
 
diff --git a/ovsdb/server.h b/ovsdb/server.h
index 667fce9..c0bbb69 100644
--- a/ovsdb/server.h
+++ b/ovsdb/server.h
@@ -16,9 +16,9 @@ 
 #ifndef SERVER_H
 #define SERVER_H 1
 
-#include "hmap.h"
+#include "openvswitch/hmap.h"
 #include "openvswitch/list.h"
-#include "shash.h"
+#include "openvswitch/shash.h"
 
 struct ovsdb;
 struct ovsdb_server;
diff --git a/ovsdb/table.c b/ovsdb/table.c
index e7545ad..7ec55d6 100644
--- a/ovsdb/table.c
+++ b/ovsdb/table.c
@@ -19,7 +19,7 @@ 
 
 #include <limits.h>
 
-#include "json.h"
+#include "openvswitch/json.h"
 #include "column.h"
 #include "ovsdb-error.h"
 #include "ovsdb-parser.h"
diff --git a/ovsdb/table.h b/ovsdb/table.h
index 68a59ad..f910d18 100644
--- a/ovsdb/table.h
+++ b/ovsdb/table.h
@@ -18,8 +18,8 @@ 
 
 #include <stdbool.h>
 #include "compiler.h"
-#include "hmap.h"
-#include "shash.h"
+#include "openvswitch/hmap.h"
+#include "openvswitch/shash.h"
 
 struct json;
 struct uuid;
diff --git a/ovsdb/transaction.c b/ovsdb/transaction.c
index 9e12a62..865e9b6 100644
--- a/ovsdb/transaction.c
+++ b/ovsdb/transaction.c
@@ -20,8 +20,8 @@ 
 #include "bitmap.h"
 #include "openvswitch/dynamic-string.h"
 #include "hash.h"
-#include "hmap.h"
-#include "json.h"
+#include "openvswitch/hmap.h"
+#include "openvswitch/json.h"
 #include "openvswitch/list.h"
 #include "ovsdb-error.h"
 #include "ovsdb.h"
diff --git a/ovsdb/trigger.c b/ovsdb/trigger.c
index 3392fb7..0fbe949 100644
--- a/ovsdb/trigger.c
+++ b/ovsdb/trigger.c
@@ -19,7 +19,7 @@ 
 
 #include <limits.h>
 
-#include "json.h"
+#include "openvswitch/json.h"
 #include "jsonrpc.h"
 #include "ovsdb.h"
 #include "poll-loop.h"
diff --git a/python/ovs/_json.c b/python/ovs/_json.c
index c4e2af3..7067ce2 100644
--- a/python/ovs/_json.c
+++ b/python/ovs/_json.c
@@ -1,5 +1,5 @@ 
 #include "Python.h"
-#include <openvswitch/lib/json.h>
+#include <openvswitch/json.h>
 #include "structmember.h"
 
 #if PY_MAJOR_VERSION >= 3
diff --git a/tests/test-ccmap.c b/tests/test-ccmap.c
index 2f2cdd6..4efe1b9 100644
--- a/tests/test-ccmap.c
+++ b/tests/test-ccmap.c
@@ -27,7 +27,7 @@ 
 #include "command-line.h"
 #include "fat-rwlock.h"
 #include "hash.h"
-#include "hmap.h"
+#include "openvswitch/hmap.h"
 #include "ovstest.h"
 #include "ovs-thread.h"
 #include "random.h"
diff --git a/tests/test-cmap.c b/tests/test-cmap.c
index 05aba00..4cac7de 100644
--- a/tests/test-cmap.c
+++ b/tests/test-cmap.c
@@ -27,7 +27,7 @@ 
 #include "command-line.h"
 #include "fat-rwlock.h"
 #include "hash.h"
-#include "hmap.h"
+#include "openvswitch/hmap.h"
 #include "ovstest.h"
 #include "ovs-thread.h"
 #include "random.h"
diff --git a/tests/test-hmap.c b/tests/test-hmap.c
index c63bd80..9259b0b 100644
--- a/tests/test-hmap.c
+++ b/tests/test-hmap.c
@@ -19,7 +19,7 @@ 
 
 #include <config.h>
 #undef NDEBUG
-#include "hmap.h"
+#include "openvswitch/hmap.h"
 #include <assert.h>
 #include <string.h>
 #include "hash.h"
diff --git a/tests/test-json.c b/tests/test-json.c
index 692013e..2819210 100644
--- a/tests/test-json.c
+++ b/tests/test-json.c
@@ -16,7 +16,7 @@ 
 
 #include <config.h>
 #undef NDEBUG
-#include "json.h"
+#include "openvswitch/json.h"
 #include <ctype.h>
 #include <errno.h>
 #include <getopt.h>
diff --git a/tests/test-jsonrpc.c b/tests/test-jsonrpc.c
index feac0b0..be79064 100644
--- a/tests/test-jsonrpc.c
+++ b/tests/test-jsonrpc.c
@@ -24,7 +24,7 @@ 
 #include <stdlib.h>
 #include "command-line.h"
 #include "daemon.h"
-#include "json.h"
+#include "openvswitch/json.h"
 #include "ovstest.h"
 #include "poll-loop.h"
 #include "stream-ssl.h"
diff --git a/tests/test-ovn.c b/tests/test-ovn.c
index 1291d04..87b7725 100644
--- a/tests/test-ovn.c
+++ b/tests/test-ovn.c
@@ -32,7 +32,7 @@ 
 #include "ovn/lib/ovn-dhcp.h"
 #include "ovs-thread.h"
 #include "ovstest.h"
-#include "shash.h"
+#include "openvswitch/shash.h"
 #include "simap.h"
 #include "util.h"
 
diff --git a/tests/test-ovsdb.c b/tests/test-ovsdb.c
index 61ba7d8..29fb88d 100644
--- a/tests/test-ovsdb.c
+++ b/tests/test-ovsdb.c
@@ -26,7 +26,7 @@ 
 #include "byte-order.h"
 #include "command-line.h"
 #include "openvswitch/dynamic-string.h"
-#include "json.h"
+#include "openvswitch/json.h"
 #include "jsonrpc.h"
 #include "ovsdb-data.h"
 #include "ovsdb-error.h"
diff --git a/utilities/ovs-vsctl.c b/utilities/ovs-vsctl.c
index c4ae692..47797bd 100644
--- a/utilities/ovs-vsctl.c
+++ b/utilities/ovs-vsctl.c
@@ -34,7 +34,7 @@ 
 #include "openvswitch/dynamic-string.h"
 #include "fatal-signal.h"
 #include "hash.h"
-#include "json.h"
+#include "openvswitch/json.h"
 #include "ovsdb-data.h"
 #include "ovsdb-idl.h"
 #include "poll-loop.h"
diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
index a5de84e..03c5004 100644
--- a/vswitchd/bridge.c
+++ b/vswitchd/bridge.c
@@ -29,7 +29,7 @@ 
 #include "dirs.h"
 #include "dpif.h"
 #include "hash.h"
-#include "hmap.h"
+#include "openvswitch/hmap.h"
 #include "hmapx.h"
 #include "if-notifier.h"
 #include "jsonrpc.h"
@@ -55,7 +55,7 @@ 
 #include "seq.h"
 #include "sflow_api.h"
 #include "sha1.h"
-#include "shash.h"
+#include "openvswitch/shash.h"
 #include "smap.h"
 #include "socket-util.h"
 #include "stream.h"
diff --git a/vswitchd/system-stats.c b/vswitchd/system-stats.c
index 129f0cf..49e5419 100644
--- a/vswitchd/system-stats.c
+++ b/vswitchd/system-stats.c
@@ -34,13 +34,13 @@ 
 #include "daemon.h"
 #include "dirs.h"
 #include "openvswitch/dynamic-string.h"
-#include "json.h"
+#include "openvswitch/json.h"
 #include "latch.h"
 #include "openvswitch/ofpbuf.h"
 #include "ovs-rcu.h"
 #include "ovs-thread.h"
 #include "poll-loop.h"
-#include "shash.h"
+#include "openvswitch/shash.h"
 #include "smap.h"
 #include "timeval.h"
 #include "openvswitch/vlog.h"
diff --git a/vtep/vtep-ctl.c b/vtep/vtep-ctl.c
index 759150f..245ba0d 100644
--- a/vtep/vtep-ctl.c
+++ b/vtep/vtep-ctl.c
@@ -34,7 +34,7 @@ 
 #include "openvswitch/dynamic-string.h"
 #include "fatal-signal.h"
 #include "hash.h"
-#include "json.h"
+#include "openvswitch/json.h"
 #include "ovsdb-data.h"
 #include "ovsdb-idl.h"
 #include "poll-loop.h"