[ovs-dev] [PATCH v3 00/21] rework code base for third-party linking

ben at skyportsystems.com ben at skyportsystems.com
Mon Mar 21 18:58:08 UTC 2016


From: Ben Warren <ben at skyportsystems.com>

This patch set is an attempt at making a 'dev' distribution for OpenVswitch
The goal is to provide shared libraries and header files so that third party
applications can link in OVS rather than always using the command line
utilities.

Changes in V3:
- Removed patches that have been applied
- Added 'ovs_' prefix to all functions in openvswitch/list.sh
- Rebased against TOT

Changes in V2:
- Work to move all of ofp-util to public include directory
- Rebased against TOT

Design:

Two patterns have been created:
- some header files have been broken up into private (lib dir)
and public (include/openvswitch dir).
- some header files have been moved from 'lib' to
'include/openvswitch'.  All header files in 'include' are considered
appropriate for third-party inclusion.

Caveats:

- The header files that have been moved to 'include/openvswitch' are the ones
  that I'm using in my current project.  I'm willing to do the work to move
  others, but am looking for direction on what should be moved.
- Little effort has gone into restricting the list of objects that are exported.  All
  public functions make it into the appropriate .so libraries
- This is geared towards Debian, although there's nothing Debian-specific in the
  reworking of header files.
- In the Debian 'openvswitch-common' package, all command line utilities are now
  dynamically-linked agains libopenvswitch.so
- This has only been tested on Linux, although I have it running both against an
  x86_64 target as well as cross-compiled for MIPS64 (Cavium). 
- I'm a newbie with Debian packaging, which you'll find out if you build this.
  While the code compiles, links and runs, there are a ton of 'dpkg-shlibdeps'
  warnings, but I don't know the best practice for declaring symbols.
- I'm unsure how to version the dynamic libraries.  I guess start with 1.0.0?

Going Forward:

- Add explicit namespace to the files in 'include'

Ben Warren (21):
  Move contents of lib/list.h to include/openvswitch directory
  Remove lib/list.h completely
  Rename all functions in list.h with ovs_ prefix
  Move ofp-parse.h to include/openvswitch directory
  Move lib/ofpbuf.h to include/openvswitch directory
  Move BLDASSERT macros to compiler header file
  Break tun-metadata.h into private and public parts
  Misc cleanup with "util.h" header files
  Break packets.h into private and public parts
  Break flow.h into private and public parts
  Move lib/match.h to include/openvswitch directory
  Remove inter-header dependencies in OVN files
  Move lib/meta-flow.h to include/openvswitch directory
  Break uuid.h into private and public parts
  Move lib/type-props.h to include/openvswitch directory
  Break netdev.h into private and public parts
  Assorted #include additions
  Move lib/ofp-util.h to include/openvswitch directory
  Debian: build openvswitch as shared libraries
  Debian: add libopenvswitch-dev build target
  Add Ben Warren to AUTHORS file

 AUTHORS                            |    1 +
 OPENFLOW-1.1+.md                   |    2 +-
 debian/automake.mk                 |    1 +
 debian/control                     |   15 +
 debian/libopenvswitch-dev.install  |    5 +
 debian/openvswitch-common.install  |    3 +
 debian/rules                       |    5 +-
 include/openvswitch/automake.mk    |   11 +
 include/openvswitch/compiler.h     |   33 +
 include/openvswitch/flow.h         |  197 ++++
 include/openvswitch/list.h         |  260 +++++
 include/openvswitch/match.h        |  214 ++++
 include/openvswitch/meta-flow.h    | 2056 ++++++++++++++++++++++++++++++++++++
 include/openvswitch/netdev.h       |   87 ++
 include/openvswitch/ofp-parse.h    |  106 ++
 include/openvswitch/ofp-util.h     | 1419 +++++++++++++++++++++++++
 include/openvswitch/ofpbuf.h       |  277 +++++
 include/openvswitch/packets.h      |   64 ++
 include/openvswitch/tun-metadata.h |  101 ++
 include/openvswitch/type-props.h   |   55 +
 include/openvswitch/util.h         |  149 +++
 include/openvswitch/uuid.h         |   35 +
 lib/automake.mk                    |   11 +-
 lib/bfd.c                          |    4 +-
 lib/bundle.c                       |    6 +-
 lib/classifier.c                   |    2 +-
 lib/classifier.h                   |    6 +-
 lib/dp-packet.h                    |    2 +-
 lib/dpctl.c                        |    6 +-
 lib/dpif-netdev.c                  |   12 +-
 lib/dpif-netlink.c                 |    2 +-
 lib/dpif.c                         |    4 +-
 lib/fat-rwlock.c                   |   10 +-
 lib/fat-rwlock.h                   |    2 +-
 lib/fatal-signal.c                 |    2 +-
 lib/flow.c                         |    2 +-
 lib/flow.h                         |  175 +--
 lib/guarded-list.c                 |   10 +-
 lib/guarded-list.h                 |    2 +-
 lib/jsonrpc.c                      |   16 +-
 lib/lacp.c                         |    4 +-
 lib/learn.c                        |    8 +-
 lib/learning-switch.c              |    6 +-
 lib/learning-switch.h              |    2 +-
 lib/list.h                         |  280 -----
 lib/lldp/aa-structs.h              |    2 +-
 lib/lldp/lldp.c                    |   10 +-
 lib/lldp/lldpd-structs.c           |   12 +-
 lib/lldp/lldpd.c                   |   24 +-
 lib/lldp/lldpd.h                   |    4 +-
 lib/mac-learning.c                 |   28 +-
 lib/mac-learning.h                 |    2 +-
 lib/match.c                        |    5 +-
 lib/match.h                        |  214 ----
 lib/mcast-snooping.c               |   52 +-
 lib/mcast-snooping.h               |    2 +-
 lib/meta-flow.c                    |    4 +-
 lib/meta-flow.h                    | 2056 ------------------------------------
 lib/multipath.c                    |    2 +-
 lib/netdev-dpdk.c                  |   12 +-
 lib/netdev-dummy.c                 |   40 +-
 lib/netdev-linux.c                 |    2 +-
 lib/netdev-provider.h              |    2 +-
 lib/netdev-vport.c                 |    2 +-
 lib/netdev-windows.c               |    2 +-
 lib/netdev.c                       |   10 +-
 lib/netdev.h                       |   66 +-
 lib/netlink-conntrack.c            |    2 +-
 lib/netlink-conntrack.h            |    2 +-
 lib/netlink-notifier.c             |   12 +-
 lib/netlink-notifier.h             |    2 +-
 lib/netlink-socket.c               |    2 +-
 lib/netlink-socket.h               |    2 +-
 lib/netlink.c                      |    2 +-
 lib/nx-match.c                     |   10 +-
 lib/nx-match.h                     |    2 +-
 lib/odp-util.c                     |    2 +-
 lib/ofp-actions.c                  |    8 +-
 lib/ofp-actions.h                  |    4 +-
 lib/ofp-errors.c                   |    4 +-
 lib/ofp-msgs.c                     |   16 +-
 lib/ofp-parse.c                    |   21 +-
 lib/ofp-parse.h                    |  106 --
 lib/ofp-print.c                    |    9 +-
 lib/ofp-prop.c                     |    2 +-
 lib/ofp-util.c                     |   59 +-
 lib/ofp-util.h                     | 1420 -------------------------
 lib/ofp-version-opt.c              |    2 +-
 lib/ofp-version-opt.h              |    2 +-
 lib/ofpbuf.c                       |    4 +-
 lib/ofpbuf.h                       |  275 -----
 lib/ovs-atomic.h                   |    2 +-
 lib/ovs-lldp.c                     |   48 +-
 lib/ovs-lldp.h                     |    2 +-
 lib/ovs-numa.c                     |   14 +-
 lib/ovs-numa.h                     |    2 +-
 lib/ovs-rcu.c                      |   10 +-
 lib/ovs-thread.c                   |   16 +-
 lib/ovsdb-idl-provider.h           |    2 +-
 lib/ovsdb-idl.c                    |   48 +-
 lib/packets.h                      |   43 +-
 lib/pktbuf.c                       |    2 +-
 lib/poll-loop.c                    |    2 +-
 lib/process.c                      |    8 +-
 lib/rconn.c                        |   28 +-
 lib/route-table.c                  |    2 +-
 lib/rstp-common.h                  |    2 +-
 lib/rstp-state-machines.c          |    2 +-
 lib/rstp.c                         |    6 +-
 lib/rtbsd.c                        |    6 +-
 lib/rtbsd.h                        |    2 +-
 lib/rtnetlink.c                    |    3 +-
 lib/seq.c                          |    8 +-
 lib/seq.h                          |    6 +-
 lib/signals.c                      |    2 +-
 lib/signals.h                      |    2 +-
 lib/stp.c                          |    6 +-
 lib/stream-ssl.c                   |    2 +-
 lib/stream.c                       |    2 +-
 lib/timeval.h                      |    2 +-
 lib/tnl-ports.c                    |   16 +-
 lib/tun-metadata.c                 |    8 +-
 lib/tun-metadata.h                 |   82 +-
 lib/type-props.h                   |   55 -
 lib/unaligned.h                    |    2 +-
 lib/unixctl.c                      |    8 +-
 lib/util.h                         |  179 ----
 lib/uuid.h                         |   19 +-
 lib/vconn-stream.c                 |    2 +-
 lib/vconn.c                        |    4 +-
 lib/vlog.c                         |    4 +-
 ofproto/bond.c                     |   48 +-
 ofproto/bundles.c                  |    8 +-
 ofproto/bundles.h                  |    2 +-
 ofproto/connmgr.c                  |   18 +-
 ofproto/connmgr.h                  |    6 +-
 ofproto/fail-open.c                |    4 +-
 ofproto/in-band.c                  |    2 +-
 ofproto/netflow.c                  |    2 +-
 ofproto/ofproto-dpif-ipfix.c       |   13 +-
 ofproto/ofproto-dpif-monitor.c     |    2 +-
 ofproto/ofproto-dpif-rid.c         |   12 +-
 ofproto/ofproto-dpif-rid.h         |    2 +-
 ofproto/ofproto-dpif-sflow.c       |    2 +-
 ofproto/ofproto-dpif-upcall.c      |   12 +-
 ofproto/ofproto-dpif-xlate.c       |   24 +-
 ofproto/ofproto-dpif-xlate.h       |    4 +-
 ofproto/ofproto-dpif.c             |   36 +-
 ofproto/ofproto-dpif.h             |    2 +-
 ofproto/ofproto-provider.h         |    4 +-
 ofproto/ofproto.c                  |   58 +-
 ofproto/ofproto.h                  |    2 +-
 ofproto/pinsched.c                 |   18 +-
 ofproto/tunnel.c                   |    2 +-
 ovn/controller/lflow.c             |    2 +-
 ovn/controller/ofctrl.c            |   13 +-
 ovn/controller/ofctrl.h            |    2 +-
 ovn/controller/ovn-controller.c    |    2 +
 ovn/controller/physical.c          |    6 +-
 ovn/controller/physical.h          |    2 +-
 ovn/controller/pinctrl.c           |    3 +-
 ovn/controller/pinctrl.h           |    2 +-
 ovn/lib/actions.c                  |    3 +-
 ovn/lib/expr.c                     |  141 +--
 ovn/lib/expr.h                     |    6 +-
 ovn/lib/lex.h                      |    2 +-
 ovn/lib/logical-fields.h           |    2 +-
 ovn/northd/ovn-northd.c            |   47 +-
 ovsdb/jsonrpc-server.c             |   18 +-
 ovsdb/monitor.c                    |   14 +-
 ovsdb/ovsdb-server.c               |    2 +-
 ovsdb/ovsdb.c                      |   12 +-
 ovsdb/ovsdb.h                      |    2 +-
 ovsdb/row.c                        |   12 +-
 ovsdb/row.h                        |    2 +-
 ovsdb/server.c                     |   16 +-
 ovsdb/server.h                     |    2 +-
 ovsdb/transaction.c                |   20 +-
 ovsdb/trigger.c                    |    8 +-
 ovsdb/trigger.h                    |    2 +-
 tests/test-aa.c                    |   10 +-
 tests/test-bundle.c                |    2 +-
 tests/test-classifier.c            |    4 +-
 tests/test-flows.c                 |    4 +-
 tests/test-list.c                  |   19 +-
 tests/test-netflow.c               |    2 +-
 tests/test-odp.c                   |    6 +-
 tests/test-ofpbuf.c                |    2 +-
 tests/test-ovn.c                   |    9 +-
 tests/test-ovsdb.c                 |    5 +-
 tests/test-rstp.c                  |    2 +-
 tests/test-sflow.c                 |    2 +-
 tests/test-stp.c                   |    2 +-
 tests/test-type-props.c            |    2 +-
 tests/test-uuid.c                  |    1 +
 tests/test-vconn.c                 |    4 +-
 utilities/nlmon.c                  |    2 +-
 utilities/ovs-dpctl.c              |    2 +-
 utilities/ovs-ofctl.c              |   20 +-
 utilities/ovs-testcontroller.c     |    6 +-
 utilities/ovs-vsctl.c              |   16 +-
 vswitchd/bridge.c                  |   52 +-
 vswitchd/system-stats.c            |    2 +-
 vtep/vtep-ctl.c                    |   18 +-
 204 files changed, 5910 insertions(+), 5762 deletions(-)
 create mode 100644 debian/libopenvswitch-dev.install
 create mode 100644 include/openvswitch/flow.h
 create mode 100644 include/openvswitch/match.h
 create mode 100644 include/openvswitch/meta-flow.h
 create mode 100644 include/openvswitch/netdev.h
 create mode 100644 include/openvswitch/ofp-parse.h
 create mode 100644 include/openvswitch/ofp-util.h
 create mode 100644 include/openvswitch/ofpbuf.h
 create mode 100644 include/openvswitch/packets.h
 create mode 100644 include/openvswitch/tun-metadata.h
 create mode 100644 include/openvswitch/type-props.h
 create mode 100644 include/openvswitch/uuid.h
 delete mode 100644 lib/list.h
 delete mode 100644 lib/match.h
 delete mode 100644 lib/meta-flow.h
 delete mode 100644 lib/ofp-parse.h
 delete mode 100644 lib/ofp-util.h
 delete mode 100644 lib/ofpbuf.h
 delete mode 100644 lib/type-props.h

-- 
2.5.0




More information about the dev mailing list