MCPcopy Create free account
hub / github.com/F-Stack/f-stack / vhost_crypto_parse_args

Function vhost_crypto_parse_args

dpdk/examples/vhost_crypto/main.c:210–272  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

208}
209
210static int
211vhost_crypto_parse_args(int argc, char **argv)
212{
213 int opt, ret;
214 char *prgname = argv[0];
215 char **argvopt;
216 int option_index;
217 struct option lgopts[] = {
218 {OPT_SOCKET_FILE, required_argument,
219 NULL, OPT_SOCKET_FILE_NUM},
220 {OPT_CONFIG, required_argument,
221 NULL, OPT_CONFIG_NUM},
222 {OPT_ZERO_COPY, no_argument,
223 NULL, OPT_ZERO_COPY_NUM},
224 {OPT_POLLING, no_argument,
225 NULL, OPT_POLLING_NUM},
226 {NULL, 0, 0, 0}
227 };
228
229 argvopt = argv;
230
231 while ((opt = getopt_long(argc, argvopt, "",
232 lgopts, &option_index)) != EOF) {
233
234 if (opt == '?') {
235 vhost_crypto_usage(prgname);
236 return -1;
237 }
238
239 switch (opt) {
240 case OPT_SOCKET_FILE_NUM:
241 ret = parse_socket_arg(optarg);
242 if (ret < 0) {
243 vhost_crypto_usage(prgname);
244 return ret;
245 }
246 break;
247
248 case OPT_CONFIG_NUM:
249 ret = parse_config(optarg);
250 if (ret < 0) {
251 vhost_crypto_usage(prgname);
252 return ret;
253 }
254 break;
255
256 case OPT_ZERO_COPY_NUM:
257 options.zero_copy =
258 RTE_VHOST_CRYPTO_ZERO_COPY_ENABLE;
259 break;
260
261 case OPT_POLLING_NUM:
262 options.guest_polling = 1;
263 break;
264
265 default:
266 vhost_crypto_usage(prgname);
267 return -EINVAL;

Callers 1

mainFunction · 0.85

Calls 4

getopt_longFunction · 0.85
vhost_crypto_usageFunction · 0.85
parse_socket_argFunction · 0.85
parse_configFunction · 0.70

Tested by

no test coverage detected