[ovs-git] [openvswitch/ovs] 1636c7: command-line: add ovs_cmdl_context

GitHub noreply at github.com
Tue Mar 17 15:15:36 UTC 2015


  Branch: refs/heads/master
  Home:   https://github.com/openvswitch/ovs
  Commit: 1636c76112b63c50bb586186eb0c3aa16f9541c7
      https://github.com/openvswitch/ovs/commit/1636c76112b63c50bb586186eb0c3aa16f9541c7
  Author: Russell Bryant <rbryant at redhat.com>
  Date:   2015-03-17 (Tue, 17 Mar 2015)

  Changed paths:
    M lib/command-line.c
    M lib/command-line.h
    M ovsdb/ovsdb-tool.c
    M tests/ovstest.c
    M tests/ovstest.h
    M tests/test-bitmap.c
    M tests/test-classifier.c
    M tests/test-cmap.c
    M tests/test-heap.c
    M tests/test-jsonrpc.c
    M tests/test-ovsdb.c
    M tests/test-reconnect.c
    M tests/test-util.c
    M tests/test-vconn.c
    M utilities/ovs-benchmark.c
    M utilities/ovs-ofctl.c

  Log Message:
  -----------
  command-line: add ovs_cmdl_context

I started working on a new command line utility that used this shared
code.  I wanted the ability to pass some data from common
initialization code to all of the commands.  You can find a similar
pattern in ovs-vsctl.

This patch updates the command handler to take a new struct,
ovs_cmdl_context, instead of argc and argv directly.  It includes argc
and argv, but also includes an opaque type (void *), where the user of
this API can attach its custom data it wants passed along to command
handlers.

This patch affected the ovstest sub-programs, as well.  The patch
includes a bit of an odd hack to OVSTEST_REGISTER() to avoid making
the main() function of the sub-programs take a ovs_cmdl_context.
The test main() functions still receive argc and argv directly, as
that seems more natural.  The test-subprograms themselves are able to
make use of a context internally, though.

Signed-off-by: Russell Bryant <rbryant at redhat.com>
Signed-off-by: Ben Pfaff <blp at nicira.com>




More information about the git mailing list