From: Ben Pfaff Date: Fri, 28 Jan 2011 20:39:15 +0000 (-0800) Subject: daemon: Define daemon options enums the same way as other option enums. X-Git-Tag: v2.12.3~14471 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=8274ae959ac0b158c3e3206b3810af608fb93785;p=mirror_ovs.git daemon: Define daemon options enums the same way as other option enums. Other modules that accept options use this style and I don't see a reason for the daemon code to be different. The style used by the daemon code until now runs the risk of ending up with conflicting values accidentally, which would be confusing. --- diff --git a/lib/daemon.h b/lib/daemon.h index 1d630768e..dd85b4631 100644 --- a/lib/daemon.h +++ b/lib/daemon.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009, 2010 Nicira Networks. + * Copyright (c) 2008, 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. @@ -21,13 +21,12 @@ #include #include -enum { - OPT_DETACH = UCHAR_MAX + 2048, - OPT_NO_CHDIR, - OPT_OVERWRITE_PIDFILE, - OPT_PIDFILE, +#define DAEMON_OPTION_ENUMS \ + OPT_DETACH, \ + OPT_NO_CHDIR, \ + OPT_OVERWRITE_PIDFILE, \ + OPT_PIDFILE, \ OPT_MONITOR -}; #define DAEMON_LONG_OPTIONS \ {"detach", no_argument, 0, OPT_DETACH}, \ diff --git a/ovsdb/ovsdb-client.c b/ovsdb/ovsdb-client.c index da6a6d6d7..295a9be5f 100644 --- a/ovsdb/ovsdb-client.c +++ b/ovsdb/ovsdb-client.c @@ -85,7 +85,8 @@ static void parse_options(int argc, char *argv[]) { enum { - OPT_BOOTSTRAP_CA_CERT = UCHAR_MAX + 1 + OPT_BOOTSTRAP_CA_CERT = UCHAR_MAX + 1, + DAEMON_OPTION_ENUMS, }; static struct option long_options[] = { {"format", required_argument, 0, 'f'}, diff --git a/ovsdb/ovsdb-server.c b/ovsdb/ovsdb-server.c index 41f1146cc..1dc9b7def 100644 --- a/ovsdb/ovsdb-server.c +++ b/ovsdb/ovsdb-server.c @@ -1,4 +1,4 @@ -/* 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. @@ -658,7 +658,8 @@ parse_options(int argc, char *argv[], char **file_namep, OPT_RUN, OPT_BOOTSTRAP_CA_CERT, VLOG_OPTION_ENUMS, - LEAK_CHECKER_OPTION_ENUMS + LEAK_CHECKER_OPTION_ENUMS, + DAEMON_OPTION_ENUMS }; static struct option long_options[] = { {"remote", required_argument, 0, OPT_REMOTE}, diff --git a/tests/test-jsonrpc.c b/tests/test-jsonrpc.c index e8edec064..44edda84a 100644 --- a/tests/test-jsonrpc.c +++ b/tests/test-jsonrpc.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. @@ -53,7 +53,8 @@ static void parse_options(int argc, char *argv[]) { enum { - OPT_BOOTSTRAP_CA_CERT = UCHAR_MAX + 1 + OPT_BOOTSTRAP_CA_CERT = UCHAR_MAX + 1, + DAEMON_OPTION_ENUMS }; static struct option long_options[] = { {"verbose", optional_argument, 0, 'v'}, diff --git a/utilities/ovs-controller.c b/utilities/ovs-controller.c index c38c81236..f5e501437 100644 --- a/utilities/ovs-controller.c +++ b/utilities/ovs-controller.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009, 2010 Nicira Networks. + * Copyright (c) 2008, 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. @@ -306,7 +306,8 @@ parse_options(int argc, char *argv[]) OPT_MUTE, OPT_WITH_FLOWS, OPT_UNIXCTL, - VLOG_OPTION_ENUMS + VLOG_OPTION_ENUMS, + DAEMON_OPTION_ENUMS }; static struct option long_options[] = { {"hub", no_argument, 0, 'H'}, diff --git a/utilities/ovs-discover.c b/utilities/ovs-discover.c index a89ebc58e..534dd7747 100644 --- a/utilities/ovs-discover.c +++ b/utilities/ovs-discover.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009, 2010 Nicira Networks. + * Copyright (c) 2008, 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. @@ -280,7 +280,8 @@ parse_options(int argc, char *argv[]) OPT_EXIT_WITHOUT_BIND, OPT_EXIT_AFTER_BIND, OPT_NO_DETACH, - VLOG_OPTION_ENUMS + VLOG_OPTION_ENUMS, + DAEMON_OPTION_ENUMS }; static struct option long_options[] = { {"accept-vconn", required_argument, 0, OPT_ACCEPT_VCONN}, diff --git a/utilities/ovs-openflowd.c b/utilities/ovs-openflowd.c index 0cd919a69..486eae288 100644 --- a/utilities/ovs-openflowd.c +++ b/utilities/ovs-openflowd.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009, 2010 Nicira Networks. + * Copyright (c) 2008, 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. @@ -234,7 +234,8 @@ parse_options(int argc, char *argv[], struct ofsettings *s) OPT_UNIXCTL, OPT_ENABLE_DUMMY, VLOG_OPTION_ENUMS, - LEAK_CHECKER_OPTION_ENUMS + LEAK_CHECKER_OPTION_ENUMS, + DAEMON_OPTION_ENUMS }; static struct option long_options[] = { {"datapath-id", required_argument, 0, OPT_DATAPATH_ID}, diff --git a/vswitchd/ovs-brcompatd.c b/vswitchd/ovs-brcompatd.c index 992b8e21b..a89ea2afc 100644 --- a/vswitchd/ovs-brcompatd.c +++ b/vswitchd/ovs-brcompatd.c @@ -1413,7 +1413,8 @@ parse_options(int argc, char *argv[]) OPT_PRUNE_TIMEOUT, OPT_APPCTL_COMMAND, VLOG_OPTION_ENUMS, - LEAK_CHECKER_OPTION_ENUMS + LEAK_CHECKER_OPTION_ENUMS, + DAEMON_OPTION_ENUMS }; static struct option long_options[] = { {"help", no_argument, 0, 'h'}, diff --git a/vswitchd/ovs-vswitchd.c b/vswitchd/ovs-vswitchd.c index cd30c96d3..4ebc8f2c9 100644 --- a/vswitchd/ovs-vswitchd.c +++ b/vswitchd/ovs-vswitchd.c @@ -123,7 +123,8 @@ parse_options(int argc, char *argv[]) VLOG_OPTION_ENUMS, LEAK_CHECKER_OPTION_ENUMS, OPT_BOOTSTRAP_CA_CERT, - OPT_ENABLE_DUMMY + OPT_ENABLE_DUMMY, + DAEMON_OPTION_ENUMS }; static struct option long_options[] = { {"help", no_argument, 0, 'h'},