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
,
49 MASK_HANDSHAKE_OPTION
,
56 TLS_CERTIFICATES_OPTION
,
58 TLS_VERIFY_PEER_OPTION
,
62 static const char *short_options
= "46D:e:fg:i:nop:P:rst:u:U:vV";
63 static const struct option long_options
[] = {
64 { "ipv4-only", no_argument
, NULL
, '4' },
65 { "ipv6-only", no_argument
, NULL
, '6' },
66 { "debug", required_argument
, NULL
, 'D' },
67 { "dump-config", no_argument
, NULL
, DUMP_CONFIG_OPTION
},
68 { "dump-plugin", no_argument
, NULL
, DUMP_PLUGIN_OPTION
},
69 { "exit-with-parent", no_argument
, NULL
, EXIT_WITH_PARENT_OPTION
},
70 { "export", required_argument
, NULL
, 'e' },
71 { "export-name", required_argument
, NULL
, 'e' },
72 { "exportname", required_argument
, NULL
, 'e' },
73 { "filter", required_argument
, NULL
, FILTER_OPTION
},
74 { "foreground", no_argument
, NULL
, 'f' },
75 { "no-fork", no_argument
, NULL
, 'f' },
76 { "group", required_argument
, NULL
, 'g' },
77 { "help", no_argument
, NULL
, HELP_OPTION
},
78 { "ip-addr", required_argument
, NULL
, 'i' },
79 { "ipaddr", required_argument
, NULL
, 'i' },
80 { "log", required_argument
, NULL
, LOG_OPTION
},
81 { "long-options", no_argument
, NULL
, LONG_OPTIONS_OPTION
},
82 { "mask-handshake", required_argument
, NULL
, MASK_HANDSHAKE_OPTION
},
83 { "new-style", no_argument
, NULL
, 'n' },
84 { "newstyle", no_argument
, NULL
, 'n' },
85 { "no-sr", no_argument
, NULL
, NO_SR_OPTION
},
86 { "old-style", no_argument
, NULL
, 'o' },
87 { "oldstyle", no_argument
, NULL
, 'o' },
88 { "pid-file", required_argument
, NULL
, 'P' },
89 { "pidfile", required_argument
, NULL
, 'P' },
90 { "port", required_argument
, NULL
, 'p' },
91 { "read-only", no_argument
, NULL
, 'r' },
92 { "readonly", no_argument
, NULL
, 'r' },
93 { "run", required_argument
, NULL
, RUN_OPTION
},
94 { "selinux-label", required_argument
, NULL
, SELINUX_LABEL_OPTION
},
95 { "short-options", no_argument
, NULL
, SHORT_OPTIONS_OPTION
},
96 { "single", no_argument
, NULL
, 's' },
97 { "stdin", no_argument
, NULL
, 's' },
98 { "swap", no_argument
, NULL
, SWAP_OPTION
},
99 { "threads", required_argument
, NULL
, 't' },
100 { "tls", required_argument
, NULL
, TLS_OPTION
},
101 { "tls-certificates", required_argument
, NULL
, TLS_CERTIFICATES_OPTION
},
102 { "tls-psk", required_argument
, NULL
, TLS_PSK_OPTION
},
103 { "tls-verify-peer", no_argument
, NULL
, TLS_VERIFY_PEER_OPTION
},
104 { "unix", required_argument
, NULL
, 'U' },
105 { "user", required_argument
, NULL
, 'u' },
106 { "verbose", no_argument
, NULL
, 'v' },
107 { "version", no_argument
, NULL
, 'V' },
108 { "vsock", no_argument
, NULL
, VSOCK_OPTION
},
112 /* Is it a plugin or filter name relative to the plugindir/filterdir? */
114 is_short_name (const char *filename
)
116 return strchr (filename
, '.') == NULL
&& strchr (filename
, '/') == NULL
;
119 #endif /* NBDKIT_OPTIONS_H */