Skip to content

Commit

Permalink
json: Move from lib to include/openvswitch.
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Ben Pfaff <[email protected]>
  • Loading branch information
otherwiseguy authored and blp committed Jul 23, 2016
1 parent ab39371 commit ee89ea7
Show file tree
Hide file tree
Showing 141 changed files with 193 additions and 156 deletions.
3 changes: 3 additions & 0 deletions include/openvswitch/automake.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -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 \
Expand Down
2 changes: 1 addition & 1 deletion lib/hmap.h → include/openvswitch/hmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

#include <stdbool.h>
#include <stdlib.h>
#include "util.h"
#include "openvswitch/util.h"

#ifdef __cplusplus
extern "C" {
Expand Down
3 changes: 2 additions & 1 deletion lib/json.h → include/openvswitch/json.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
* "should" be unique).
*/

#include "shash.h"
#include <stdio.h>
#include "openvswitch/shash.h"

#ifdef __cplusplus
extern "C" {
Expand Down
4 changes: 2 additions & 2 deletions lib/shash.h → include/openvswitch/shash.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
#ifndef SHASH_H
#define SHASH_H 1

#include "hmap.h"
#include "util.h"
#include "openvswitch/hmap.h"
#include "openvswitch/util.h"

#ifdef __cplusplus
extern "C" {
Expand Down
3 changes: 0 additions & 3 deletions lib/automake.mk
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,13 @@ 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 \
lib/id-pool.h \
lib/jhash.c \
lib/jhash.h \
lib/json.c \
lib/json.h \
lib/jsonrpc.c \
lib/jsonrpc.h \
lib/lacp.c \
Expand Down Expand Up @@ -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 \
Expand Down
2 changes: 1 addition & 1 deletion lib/bfd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions lib/bundle.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
3 changes: 2 additions & 1 deletion lib/cfm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -38,6 +38,7 @@
#include "timeval.h"
#include "unixctl.h"
#include "openvswitch/vlog.h"
#include "util.h"

VLOG_DEFINE_THIS_MODULE(cfm);

Expand Down
2 changes: 1 addition & 1 deletion lib/cfm.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

#include <stdint.h>

#include "hmap.h"
#include "openvswitch/hmap.h"
#include "openvswitch/types.h"
#include "packets.h"

Expand Down
4 changes: 2 additions & 2 deletions lib/db-ctl-base.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion lib/db-ctl-base.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

#include "compiler.h"
#include "openvswitch/dynamic-string.h"
#include "shash.h"
#include "openvswitch/shash.h"

struct ctl_context;
struct option;
Expand Down
2 changes: 1 addition & 1 deletion lib/dpctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion lib/dpif-netdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion lib/dpif-netlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion lib/dpif.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion lib/fat-rwlock.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion lib/fatal-signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions lib/flow.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion lib/hmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

#include <config.h>
#include "hmap.h"
#include "openvswitch/hmap.h"
#include <stdint.h>
#include <string.h>
#include "coverage.h"
Expand Down
2 changes: 1 addition & 1 deletion lib/hmapx.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion lib/id-pool.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

#include <config.h>
#include "id-pool.h"
#include "hmap.h"
#include "openvswitch/hmap.h"
#include "hash.h"

struct id_node {
Expand Down
4 changes: 2 additions & 2 deletions lib/json.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#include <config.h>

#include "json.h"
#include "openvswitch/json.h"

#include <ctype.h>
#include <errno.h>
Expand All @@ -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"

Expand Down
2 changes: 1 addition & 1 deletion lib/jsonrpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 3 additions & 2 deletions lib/lacp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
4 changes: 2 additions & 2 deletions lib/learning-switch.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"

Expand Down
2 changes: 1 addition & 1 deletion lib/lockfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion lib/mac-learning.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion lib/mcast-snooping.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion lib/meta-flow.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions lib/multipath.c
Original file line number Diff line number Diff line change
Expand Up @@ -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_*. */
Expand Down
2 changes: 1 addition & 1 deletion lib/netdev-bsd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion lib/netdev-dpdk.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion lib/netdev-dummy.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 3 additions & 2 deletions lib/netdev-linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion lib/netdev-provider.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading

0 comments on commit ee89ea7

Please sign in to comment.