json: Move from lib to include/openvswitch.
authorTerry Wilson <twilson@redhat.com>
Tue, 12 Jul 2016 21:37:34 +0000 (16:37 -0500)
committerBen Pfaff <blp@ovn.org>
Sat, 23 Jul 2016 00:09:17 +0000 (17:09 -0700)
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>
Signed-off-by: Ben Pfaff <blp@ovn.org>
144 files changed:
include/openvswitch/automake.mk
include/openvswitch/hmap.h [new file with mode: 0644]
include/openvswitch/json.h [new file with mode: 0644]
include/openvswitch/shash.h [new file with mode: 0644]
lib/automake.mk
lib/bfd.c
lib/bundle.c
lib/cfm.c
lib/cfm.h
lib/db-ctl-base.c
lib/db-ctl-base.h
lib/dpctl.c
lib/dpif-netdev.c
lib/dpif-netlink.c
lib/dpif.c
lib/fat-rwlock.c
lib/fatal-signal.c
lib/flow.c
lib/hmap.c
lib/hmap.h [deleted file]
lib/hmapx.h
lib/id-pool.c
lib/json.c
lib/json.h [deleted file]
lib/jsonrpc.c
lib/lacp.c
lib/learning-switch.c
lib/lockfile.c
lib/mac-learning.h
lib/mcast-snooping.h
lib/meta-flow.c
lib/multipath.c
lib/netdev-bsd.c
lib/netdev-dpdk.c
lib/netdev-dummy.c
lib/netdev-linux.c
lib/netdev-provider.h
lib/netdev-windows.c
lib/netdev.c
lib/netlink-conntrack.h
lib/netlink-socket.c
lib/netlink.c
lib/nx-match.c
lib/odp-util.h
lib/ofp-actions.c
lib/ofp-msgs.c
lib/ofp-parse.c
lib/ofp-util.c
lib/ovs-lldp.h
lib/ovs-numa.c
lib/ovs-rcu.c
lib/ovsdb-data.c
lib/ovsdb-data.h
lib/ovsdb-error.c
lib/ovsdb-idl-provider.h
lib/ovsdb-idl.c
lib/ovsdb-map-op.c
lib/ovsdb-parser.h
lib/ovsdb-types.c
lib/packets.c
lib/pcap-file.c
lib/perf-counter.c
lib/poll-loop.c
lib/reconnect.c
lib/rstp-common.h
lib/seq.c
lib/shash.c
lib/shash.h [deleted file]
lib/simap.h
lib/smap.c
lib/smap.h
lib/sset.h
lib/stream-ssl.c
lib/table.c
lib/timeval.c
lib/tun-metadata.c
lib/unixctl.c
lib/util.h
ofproto/bond.c
ofproto/bundles.c
ofproto/connmgr.c
ofproto/connmgr.h
ofproto/ofproto-dpif-ipfix.c
ofproto/ofproto-dpif-mirror.c
ofproto/ofproto-dpif-monitor.c
ofproto/ofproto-dpif-sflow.c
ofproto/ofproto-dpif-xlate.c
ofproto/ofproto-dpif.c
ofproto/ofproto-provider.h
ofproto/ofproto.c
ofproto/pinsched.c
ofproto/tunnel.c
ovn/controller-vtep/binding.c
ovn/controller-vtep/vtep.c
ovn/controller/binding.c
ovn/controller/chassis.c
ovn/controller/lport.h
ovn/controller/ofctrl.c
ovn/controller/ovn-controller.c
ovn/controller/patch.c
ovn/controller/physical.c
ovn/lib/actions.c
ovn/lib/actions.h
ovn/lib/expr.c
ovn/lib/expr.h
ovn/lib/lex.c
ovn/lib/ovn-dhcp.h
ovn/northd/ovn-northd.c
ovn/utilities/ovn-nbctl.c
ovn/utilities/ovn-sbctl.c
ovsdb/column.c
ovsdb/condition.c
ovsdb/execution.c
ovsdb/file.c
ovsdb/jsonrpc-server.c
ovsdb/log.c
ovsdb/monitor.c
ovsdb/mutation.c
ovsdb/ovsdb-client.c
ovsdb/ovsdb-server.c
ovsdb/ovsdb-tool.c
ovsdb/ovsdb.c
ovsdb/ovsdb.h
ovsdb/replication.c
ovsdb/replication.h
ovsdb/row.c
ovsdb/row.h
ovsdb/server.h
ovsdb/table.c
ovsdb/table.h
ovsdb/transaction.c
ovsdb/trigger.c
python/ovs/_json.c
tests/test-ccmap.c
tests/test-cmap.c
tests/test-hmap.c
tests/test-json.c
tests/test-jsonrpc.c
tests/test-ovn.c
tests/test-ovsdb.c
utilities/ovs-vsctl.c
vswitchd/bridge.c
vswitchd/system-stats.c
vtep/vtep-ctl.c

index d8541dc..c0e276f 100644 (file)
@@ -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 (file)
index 0000000..ef272a6
--- /dev/null
@@ -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 (file)
index 0000000..13f346c
--- /dev/null
@@ -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 *);
+\f
+/* 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);
+\f
+/* 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 *);
+\f
+/* 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 (file)
index 0000000..afc4823
--- /dev/null
@@ -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 */
index 1a44cc0..71c9d41 100644 (file)
@@ -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 \
@@ -219,7 +217,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 \
index 9616c90..8dac953 100644 (file)
--- 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"
index eaaf068..7fc02e2 100644 (file)
@@ -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);
 
index fb077de..7bc22e3 100644 (file)
--- 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);
 
index 98d48b3..5710c99 100644 (file)
--- 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"
 
index 9f50c6c..02eb328 100644 (file)
 #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"
index f8f576b..0f4658e 100644 (file)
@@ -19,7 +19,7 @@
 
 #include "compiler.h"
 #include "openvswitch/dynamic-string.h"
-#include "shash.h"
+#include "openvswitch/shash.h"
 
 struct ctl_context;
 struct option;
index 003602a..76b701c 100644 (file)
@@ -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"
index e0107b7..d5d7b7e 100644 (file)
@@ -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"
index e2bea23..d544072 100644 (file)
@@ -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"
index 5f1be41..bb2c4e6 100644 (file)
@@ -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"
index 2f42b05..19b7149 100644 (file)
@@ -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"
index 021c869..7b9813d 100644 (file)
@@ -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"
index 8842e8d..1fa3bf4 100644 (file)
@@ -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);
index 9462c5e..1ba4a57 100644 (file)
@@ -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 (file)
index ea6c4e0..0000000
+++ /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 */
index f977d9e..06a6bbe 100644 (file)
@@ -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;
index f32c008..62a6b33 100644 (file)
@@ -17,7 +17,7 @@
 
 #include <config.h>
 #include "id-pool.h"
-#include "hmap.h"
+#include "openvswitch/hmap.h"
 #include "hash.h"
 
 struct id_node {
index 4ac250b..995f3c2 100644 (file)
@@ -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 (file)
index 3497035..0000000
+++ /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 *);
-\f
-/* 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);
-\f
-/* 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 *);
-\f
-/* 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 */
index aba742c..1841568 100644 (file)
@@ -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"
index a9d6e1e..ad6ef8e 100644 (file)
 #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);
 
index b420fe5..82609e8 100644 (file)
@@ -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"
 
index 864d3ef..36728ff 100644 (file)
@@ -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"
index 0b62d09..d09e895 100644 (file)
@@ -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"
index 84b9c57..af7fb93 100644 (file)
@@ -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"
index af579a2..503da0c 100644 (file)
@@ -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"
index 30bab14..8a1d1fa 100644 (file)
@@ -29,6 +29,7 @@
 #include "openvswitch/ofp-errors.h"
 #include "openvswitch/ofp-util.h"
 #include "packets.h"
+#include "util.h"
 \f
 /* Checks that 'mp' is valid on flow.  Returns 0 if it is valid, otherwise an
  * OFPERR_*. */
index 869d54d..f963c6e 100644 (file)
@@ -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"
index 7fb6457..9a9ac45 100644 (file)
@@ -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"
index 2e7b7e9..a95f7bb 100644 (file)
@@ -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"
index 60ad38b..c71a3df 100644 (file)
@@ -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"
 #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);
 
index c62dbd5..915a5a5 100644 (file)
@@ -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
index c21ffe7..3218490 100644 (file)
@@ -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"
index 405bf41..31a6a46 100644 (file)
@@ -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"
index f75259c..1263b21 100644 (file)
@@ -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"
index 26d909b..7502764 100644 (file)
@@ -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"
index fbdb78e..4715d68 100644 (file)
@@ -27,6 +27,7 @@
 #include "timeval.h"
 #include "unaligned.h"
 #include "openvswitch/vlog.h"
+#include "util.h"
 
 VLOG_DEFINE_THIS_MODULE(netlink);
 
index 505c6f9..c71ff0d 100644 (file)
@@ -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"
index 50e52e4..a41bc76 100644 (file)
@@ -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"
index 8e41f7c..4900add 100644 (file)
@@ -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"
index 8154539..f9660fc 100644 (file)
@@ -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);
 
index 4af6d9b..370e3e5 100644 (file)
@@ -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'.
  *
index 4ae83df..6d73e69 100644 (file)
@@ -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);
index b5c3a48..0e536e8 100644 (file)
@@ -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"
index 7652636..c8173e0 100644 (file)
@@ -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"
index 8aef1f1..0614d98 100644 (file)
@@ -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);
index 22176cd..266a3e4 100644 (file)
 #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)
index 2789540..98633ef 100644 (file)
@@ -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;
index dbe8149..dfa4249 100644 (file)
@@ -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"
 
index 1f249c0..55ed793 100644 (file)
 #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 {
index f8e980b..15002fa 100644 (file)
@@ -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"
index 23fc5f5..7b90ba8 100644 (file)
@@ -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 */
index 2f9f483..31c5a60 100644 (file)
@@ -18,7 +18,7 @@
 
 #include <stdbool.h>
 #include "compiler.h"
-#include "json.h"
+#include "openvswitch/json.h"
 #include "sset.h"
 #include "util.h"
 
index 91d5216..20a8444 100644 (file)
 #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);
index b5b23a6..1bf887e 100644 (file)
@@ -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"
index a850d21..dd4d229 100644 (file)
 #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);
index c5144e7..da60df7 100644 (file)
@@ -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);
index 925198f..4f32189 100644 (file)
@@ -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);
index bab821e..471fb7f 100644 (file)
@@ -20,6 +20,7 @@
 #include <stdlib.h>
 
 #include "poll-loop.h"
+#include "util.h"
 #include "openvswitch/vlog.h"
 
 VLOG_DEFINE_THIS_MODULE(reconnect);
index 6d5acfc..27e8079 100644 (file)
@@ -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"
index b8b5b65..6e2f596 100644 (file)
--- 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"
index 4285c07..3e94b17 100644 (file)
@@ -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 (file)
index 5f94725..0000000
+++ /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 */
index 113db93..9486080 100644 (file)
@@ -17,7 +17,7 @@
 #ifndef SIMAP_H
 #define SIMAP_H 1
 
-#include "hmap.h"
+#include "openvswitch/hmap.h"
 
 #ifdef  __cplusplus
 extern "C" {
index 07dd23a..aff7eb0 100644 (file)
@@ -18,7 +18,7 @@
 #include <strings.h>
 
 #include "hash.h"
-#include "json.h"
+#include "openvswitch/json.h"
 #include "packets.h"
 #include "uuid.h"
 
index 038b769..29f99e6 100644 (file)
@@ -17,7 +17,7 @@
 
 #include <netinet/in.h>
 #include "hash.h"
-#include "hmap.h"
+#include "openvswitch/hmap.h"
 
 struct json;
 struct uuid;
index c3b5e97..768d0cf 100644 (file)
@@ -17,7 +17,7 @@
 #ifndef SSET_H
 #define SSET_H
 
-#include "hmap.h"
+#include "openvswitch/hmap.h"
 #include "util.h"
 
 #ifdef __cplusplus
index bf80fc8..a5c32a1 100644 (file)
@@ -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"
index a2cfe3d..9158499 100644 (file)
@@ -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"
index 8e5f971..0e8709a 100644 (file)
@@ -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"
index 7a2a84f..36006e3 100644 (file)
@@ -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. */
index 935c145..5e5d26c 100644 (file)
 #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"
index e738c9f..5049d15 100644 (file)
@@ -25,6 +25,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include "compiler.h"
+#include "util.h"
 #include "openvswitch/util.h"
 
 extern char *program_name;
index 032b8f6..1d0c3ce 100644 (file)
@@ -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"
 #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);
 
index 232cc15..aa8e58c 100644 (file)
@@ -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"
index 0c48b77..d70d990 100644 (file)
 #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);
index 30e7ae5..be4ce28 100644 (file)
@@ -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"
index 5744abb..0128c91 100644 (file)
@@ -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"
index 84b7845..675adf3 100644 (file)
@@ -18,7 +18,7 @@
 
 #include <errno.h>
 
-#include "hmap.h"
+#include "openvswitch/hmap.h"
 #include "hmapx.h"
 #include "ofproto.h"
 #include "vlan-bitmap.h"
index 11d7a54..623d517 100644 (file)
@@ -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"
index 7d0aa36..8a19d15 100644 (file)
@@ -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"
index 3ff7a6b..160da5b 100644 (file)
@@ -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);
index ce9383a..faff1c7 100644 (file)
@@ -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);
index ae6c08d..25f8dc0 100644 (file)
@@ -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"
 
index 5f84aa1..dcb0a08 100644 (file)
@@ -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);
 
index ee252f4..51f1760 100644 (file)
@@ -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"
index 85a485c..9a69071 100644 (file)
@@ -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"
index 65070d6..9cbfadc 100644 (file)
@@ -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"
index 9e11e28..976e933 100644 (file)
@@ -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"
index 0dea828..e83c1d5 100644 (file)
 #include "lport.h"
 
 #include "lib/bitmap.h"
-#include "lib/hmap.h"
 #include "lib/poll-loop.h"
 #include "lib/sset.h"
 #include "lib/util.h"
 #include "lib/vswitch-idl.h"
+#include "openvswitch/hmap.h"
 #include "openvswitch/vlog.h"
 #include "ovn/lib/ovn-sb-idl.h"
 #include "ovn-controller.h"
index d40181b..502e74d 100644 (file)
@@ -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);
 
index bb8d8cd..9e9c6d3 100644 (file)
@@ -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;
index 5b55597..184e86f 100644 (file)
 #include "flow.h"
 #include "hash.h"
 #include "hindex.h"
-#include "hmap.h"
 #include "ofctrl.h"
 #include "openflow/openflow.h"
 #include "openvswitch/dynamic-string.h"
+#include "openvswitch/hmap.h"
 #include "openvswitch/list.h"
 #include "openvswitch/match.h"
 #include "openvswitch/ofp-actions.h"
index 72b1c48..dcab918 100644 (file)
@@ -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"
index fa38f78..707d08b 100644 (file)
@@ -19,9 +19,9 @@
 
 #include "hash.h"
 #include "lflow.h"
-#include "lib/hmap.h"
 #include "lib/vswitch-idl.h"
 #include "lport.h"
+#include "openvswitch/hmap.h"
 #include "openvswitch/vlog.h"
 #include "ovn-controller.h"
 
index 11b2c2b..a104e33 100644 (file)
 #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);
index dda8959..6e2bf93 100644 (file)
@@ -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(). */
index 48f0140..114c71e 100644 (file)
@@ -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"
 
index 8c0768d..1c38b99 100644 (file)
 #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);
 \f
index ed5300f..d790c49 100644 (file)
@@ -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"
index 52c0946..79aa221 100644 (file)
@@ -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"
 \f
index 4da614b..6750f95 100644 (file)
@@ -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 {
index e030a4f..a3d1672 100644 (file)
@@ -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"
index 25916da..d523eec 100644 (file)
@@ -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"
index 21ae98d..85dab06 100644 (file)
 #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"
index b41df2e..8838df3 100644 (file)
@@ -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"
index 39a0977..6da3b08 100644 (file)
 #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)
index d3fc8b9..e972ce7 100644 (file)
@@ -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"
index 2894f30..7f8554a 100644 (file)
@@ -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"
index 864fb03..bde9122 100644 (file)
@@ -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"
@@ -39,6 +39,7 @@
 #include "timeval.h"
 #include "transaction.h"
 #include "trigger.h"
+#include "util.h"
 #include "openvswitch/vlog.h"
 
 VLOG_DEFINE_THIS_MODULE(ovsdb_jsonrpc_server);
index 8004d3d..380f5e9 100644 (file)
@@ -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"
index 54c27c4..99083e1 100644 (file)
@@ -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"
@@ -36,6 +36,7 @@
 #include "transaction.h"
 #include "jsonrpc-server.h"
 #include "monitor.h"
+#include "util.h"
 #include "openvswitch/vlog.h"
 
 VLOG_DEFINE_THIS_MODULE(ovsdb_monitor);
index 6a43e34..e5d192e 100644 (file)
 
 #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)
index 4105d47..7dcc07c 100644 (file)
@@ -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"
index 1180118..239cca8 100644 (file)
@@ -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"
index 37e219f..af83da2 100644 (file)
@@ -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"
index b7cc655..0391900 100644 (file)
@@ -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"
index b3eaf15..418805c 100644 (file)
@@ -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;
index 7367714..52b7085 100644 (file)
@@ -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"
index 012ca09..93ac22b 100644 (file)
@@ -18,7 +18,7 @@
 #ifndef REPLICATION_H
 #define REPLICATION_H 1
 
-#include "shash.h"
+#include "openvswitch/shash.h"
 
 struct db {
     /* Initialized in main(). */
index 572c103..9c31294 100644 (file)
 #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)
index b1d1edd..83024bc 100644 (file)
@@ -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"
 
index 667fce9..c0bbb69 100644 (file)
@@ -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;
index e7545ad..7ec55d6 100644 (file)
@@ -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"
index 68a59ad..f910d18 100644 (file)
@@ -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;
index 9e12a62..865e9b6 100644 (file)
@@ -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"
index 3392fb7..0fbe949 100644 (file)
@@ -19,7 +19,7 @@
 
 #include <limits.h>
 
-#include "json.h"
+#include "openvswitch/json.h"
 #include "jsonrpc.h"
 #include "ovsdb.h"
 #include "poll-loop.h"
index c4e2af3..7067ce2 100644 (file)
@@ -1,5 +1,5 @@
 #include "Python.h"
-#include <openvswitch/lib/json.h>
+#include <openvswitch/json.h>
 #include "structmember.h"
 
 #if PY_MAJOR_VERSION >= 3
index 2f2cdd6..4efe1b9 100644 (file)
@@ -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"
index 05aba00..4cac7de 100644 (file)
@@ -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"
index c63bd80..9259b0b 100644 (file)
@@ -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"
index 692013e..2819210 100644 (file)
@@ -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>
index feac0b0..be79064 100644 (file)
@@ -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"
index fd004c9..26055bb 100644 (file)
@@ -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"
 
index 6357c9c..c21001e 100644 (file)
@@ -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"
index c98dd3f..722dcd9 100644 (file)
@@ -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"
index a5de84e..03c5004 100644 (file)
@@ -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"
index 129f0cf..49e5419 100644 (file)
 #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"
index 759150f..245ba0d 100644 (file)
@@ -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"