xref: /spdk/app/nvmf_tgt/nvmf_main.c (revision a6dbe3721eb3b5990707fc3e378c95e505dd8ab5)
1 /*   SPDX-License-Identifier: BSD-3-Clause
2  *   Copyright (C) 2017 Intel Corporation.
3  *   All rights reserved.
4  */
5 
6 #include "spdk/stdinc.h"
7 
8 #include "spdk/env.h"
9 #include "spdk/event.h"
10 
11 static void
nvmf_usage(void)12 nvmf_usage(void)
13 {
14 }
15 
16 static int
nvmf_parse_arg(int ch,char * arg)17 nvmf_parse_arg(int ch, char *arg)
18 {
19 	return 0;
20 }
21 
22 static void
nvmf_tgt_started(void * arg1)23 nvmf_tgt_started(void *arg1)
24 {
25 	if (getenv("MEMZONE_DUMP") != NULL) {
26 		spdk_memzone_dump(stdout);
27 		fflush(stdout);
28 	}
29 }
30 
31 int
main(int argc,char ** argv)32 main(int argc, char **argv)
33 {
34 	int rc;
35 	struct spdk_app_opts opts = {};
36 
37 	/* default value in opts */
38 	spdk_app_opts_init(&opts, sizeof(opts));
39 	opts.name = "nvmf";
40 	if ((rc = spdk_app_parse_args(argc, argv, &opts, "", NULL,
41 				      nvmf_parse_arg, nvmf_usage)) !=
42 	    SPDK_APP_PARSE_ARGS_SUCCESS) {
43 		exit(rc);
44 	}
45 
46 	/* Blocks until the application is exiting */
47 	rc = spdk_app_start(&opts, nvmf_tgt_started, NULL);
48 	spdk_app_fini();
49 	return rc;
50 }
51