2 * Copyright (C) 2013-2019 Red Hat Inc.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * * Neither the name of Red Hat nor the names of its contributors may be
16 * used to endorse or promote products derived from this software without
17 * specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
22 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR
23 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
26 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
27 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
29 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 #ifndef NBDKIT_OPTIONS_H
34 #define NBDKIT_OPTIONS_H
42 HELP_OPTION
= CHAR_MAX
+ 1,
45 EXIT_WITH_PARENT_OPTION
,
54 TLS_CERTIFICATES_OPTION
,
56 TLS_VERIFY_PEER_OPTION
,
59 static const char *short_options
= "D:e:fg:i:nop:P:rst:u:U:vV";
60 static const struct option long_options
[] = {
61 { "debug", required_argument
, NULL
, 'D' },
62 { "dump-config", no_argument
, NULL
, DUMP_CONFIG_OPTION
},
63 { "dump-plugin", no_argument
, NULL
, DUMP_PLUGIN_OPTION
},
64 { "exit-with-parent", no_argument
, NULL
, EXIT_WITH_PARENT_OPTION
},
65 { "export", required_argument
, NULL
, 'e' },
66 { "export-name", required_argument
, NULL
, 'e' },
67 { "exportname", required_argument
, NULL
, 'e' },
68 { "filter", required_argument
, NULL
, FILTER_OPTION
},
69 { "foreground", no_argument
, NULL
, 'f' },
70 { "no-fork", no_argument
, NULL
, 'f' },
71 { "group", required_argument
, NULL
, 'g' },
72 { "help", no_argument
, NULL
, HELP_OPTION
},
73 { "ip-addr", required_argument
, NULL
, 'i' },
74 { "ipaddr", required_argument
, NULL
, 'i' },
75 { "log", required_argument
, NULL
, LOG_OPTION
},
76 { "long-options", no_argument
, NULL
, LONG_OPTIONS_OPTION
},
77 { "new-style", no_argument
, NULL
, 'n' },
78 { "newstyle", no_argument
, NULL
, 'n' },
79 { "no-sr", no_argument
, NULL
, NO_SR_OPTION
},
80 { "old-style", no_argument
, NULL
, 'o' },
81 { "oldstyle", no_argument
, NULL
, 'o' },
82 { "pid-file", required_argument
, NULL
, 'P' },
83 { "pidfile", required_argument
, NULL
, 'P' },
84 { "port", required_argument
, NULL
, 'p' },
85 { "read-only", no_argument
, NULL
, 'r' },
86 { "readonly", no_argument
, NULL
, 'r' },
87 { "run", required_argument
, NULL
, RUN_OPTION
},
88 { "selinux-label", required_argument
, NULL
, SELINUX_LABEL_OPTION
},
89 { "short-options", no_argument
, NULL
, SHORT_OPTIONS_OPTION
},
90 { "single", no_argument
, NULL
, 's' },
91 { "stdin", no_argument
, NULL
, 's' },
92 { "threads", required_argument
, NULL
, 't' },
93 { "tls", required_argument
, NULL
, TLS_OPTION
},
94 { "tls-certificates", required_argument
, NULL
, TLS_CERTIFICATES_OPTION
},
95 { "tls-psk", required_argument
, NULL
, TLS_PSK_OPTION
},
96 { "tls-verify-peer", no_argument
, NULL
, TLS_VERIFY_PEER_OPTION
},
97 { "unix", required_argument
, NULL
, 'U' },
98 { "user", required_argument
, NULL
, 'u' },
99 { "verbose", no_argument
, NULL
, 'v' },
100 { "version", no_argument
, NULL
, 'V' },
104 /* Is it a plugin or filter name relative to the plugindir/filterdir? */
106 is_short_name (const char *filename
)
108 return strchr (filename
, '.') == NULL
&& strchr (filename
, '/') == NULL
;
111 #endif /* NBDKIT_OPTIONS_H */