]> git.proxmox.com Git - mirror_ovs.git/commitdiff
daemon: Define daemon options enums the same way as other option enums.
authorBen Pfaff <blp@nicira.com>
Fri, 28 Jan 2011 20:39:15 +0000 (12:39 -0800)
committerBen Pfaff <blp@nicira.com>
Mon, 7 Feb 2011 20:50:19 +0000 (12:50 -0800)
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.

lib/daemon.h
ovsdb/ovsdb-client.c
ovsdb/ovsdb-server.c
tests/test-jsonrpc.c
utilities/ovs-controller.c
utilities/ovs-discover.c
utilities/ovs-openflowd.c
vswitchd/ovs-brcompatd.c
vswitchd/ovs-vswitchd.c

index 1d630768e18579120f91161d26c26234bd2f41bc..dd85b463185e14236446c13f780b2f74ad4d98ef 100644 (file)
@@ -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.
 #include <stdbool.h>
 #include <sys/types.h>
 
-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},           \
index da6a6d6d79f040ebde865a35992760f5e672bce6..295a9be5fdb0ef54c534f18307e82e65fb33e6e7 100644 (file)
@@ -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'},
index 41f1146cc105f0d87899e33e9e331fc9bbab7b9c..1dc9b7def3bbc19538826ba8324e83429bf20f52 100644 (file)
@@ -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},
index e8edec0648acc656bc0fc57c109e182465600743..44edda84a429af541c3988d572eb88e3a4b5c6f9 100644 (file)
@@ -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'},
index c38c8123669f91f7284596c41b24e221e9ef5e48..f5e5014374c2fc86ad0cae0dda939f191f19897f 100644 (file)
@@ -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'},
index a89ebc58e6ade528bba94d1396680226a71a6ff4..534dd7747a1619b71d30021ce64de8e09b47dcb9 100644 (file)
@@ -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},
index 0cd919a696f00fdf2143aa71f9b08acf6b35153b..486eae288e9e56ab3cd2d9823d18cb9d546b8dd4 100644 (file)
@@ -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},
index 992b8e21be5566d12f741404dd2f67add10c2656..a89ea2afc11d020043b786139303106e0414f763 100644 (file)
@@ -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'},
index cd30c96d309762f96b4afb9c90bff079316181a7..4ebc8f2c92f0cd41abd62f37e6031fa89c7de138 100644 (file)
@@ -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'},