diff options
author | Ben Pfaff <blp@nicira.com> | 2011-12-02 15:29:19 -0800 |
---|---|---|
committer | Ben Pfaff <blp@nicira.com> | 2011-12-19 14:53:34 -0800 |
commit | 0e15264f96e3caff662c7998cc739a3dd5c1c0f2 (patch) | |
tree | 467de37d55baeb233530bfe948cb9020461b9099 /lib/coverage.c | |
parent | 041dc07fd21b6987ffbcc6a597eb9918d44ae841 (diff) |
unixctl: Implement quoting.
The protocol used by ovs-appctl has a long-standing bug that there
is no way to distinguish "ovs-appctl a b c" from "ovs-appctl 'a b c'".
This isn't a big deal because none of the current commands really
want to accept arguments that include spaces, but it's kind of a silly
limitation.
At the same time, the internal API is awkward because every user is
stuck doing its own argument parsing, which is no fun.
This commit fixes both problems, by adding shell-like quoting to the
protocol and modifying the internal API from one that passes a string
to one that passes in an array of pre-parsed strings. Command
implementations may now specify how many arguments they expect. This
simplifies some command implementations significantly.
Signed-off-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'lib/coverage.c')
-rw-r--r-- | lib/coverage.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/coverage.c b/lib/coverage.c index 105cd37d..c8d8b706 100644 --- a/lib/coverage.c +++ b/lib/coverage.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2010 Nicira Networks. + * Copyright (c) 2009, 2010, 2011 Nicira Networks. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -48,8 +48,8 @@ struct coverage_counter *coverage_counters[] = { static unsigned int epoch; static void -coverage_unixctl_log(struct unixctl_conn *conn, const char *args OVS_UNUSED, - void *aux OVS_UNUSED) +coverage_unixctl_log(struct unixctl_conn *conn, int argc OVS_UNUSED, + const char *argv[] OVS_UNUSED, void *aux OVS_UNUSED) { coverage_log(VLL_WARN, false); unixctl_command_reply(conn, 200, NULL); @@ -58,7 +58,8 @@ coverage_unixctl_log(struct unixctl_conn *conn, const char *args OVS_UNUSED, void coverage_init(void) { - unixctl_command_register("coverage/log", "", coverage_unixctl_log, NULL); + unixctl_command_register("coverage/log", "", 0, 0, + coverage_unixctl_log, NULL); } /* Sorts coverage counters in descending order by count, within equal counts |