Commit 20bee521 authored by Daniel Verkamp's avatar Daniel Verkamp
Browse files

log: dynamically generate usage for -t option



Change-Id: I8c709b507c4cb00092d5dc9b1e8ca1c0fe880b02
Signed-off-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent 32a046d7
Loading
Loading
Loading
Loading
+1 −5
Original line number Diff line number Diff line
@@ -92,11 +92,7 @@ usage(char *executable_name)
	printf(" -n channel number of memory channels used for DPDK\n");
	printf(" -p core    master (primary) core for DPDK\n");
	printf(" -s size    memory size in MB for DPDK\n");
#ifdef DEBUG
	printf(" -t flag    trace flag (all, net, iscsi, scsi, target, debug)\n");
#else
	printf(" -t flag    trace flag (not supported - must rebuild with CONFIG_DEBUG=y)\n");
#endif
	spdk_tracelog_usage(stdout, "-t");
	printf(" -v         verbose (enable warnings)\n");
	printf(" -H         show this usage\n");
	printf(" -V         show version\n");
+2 −5
Original line number Diff line number Diff line
@@ -104,11 +104,8 @@ usage(void)
	printf(" -p core    master (primary) core for DPDK\n");
	printf(" -s size    memory size in MB for DPDK\n");

#ifdef DEBUG
	printf(" -t flag    - trace flag options (all, rdma, nvmf, debug)\n");
#else
	printf(" -t flag    - trace flag options (not supported - must rebuild with CONFIG_DEBUG=y)\n");
#endif
	spdk_tracelog_usage(stdout, "-t");

	printf(" -v         - verbose (enable warnings)\n");
	printf(" -H         - show this usage\n");
	printf(" -d         - disable coredump file enabling\n");
+2 −0
Original line number Diff line number Diff line
@@ -111,4 +111,6 @@ const char *spdk_log_get_trace_flag_name(size_t idx);
void spdk_open_log(void);
void spdk_close_log(void);

void spdk_tracelog_usage(FILE *f, const char *trace_arg);

#endif /* SPDK_LOG_H */
+19 −0
Original line number Diff line number Diff line
@@ -375,3 +375,22 @@ spdk_close_log(void)
{
	closelog();
}

void
spdk_tracelog_usage(FILE *f, const char *trace_arg)
{
#ifdef DEBUG
	size_t i;

	fprintf(f, " %s flag    enable trace flag (all", trace_arg);

	for (i = 0; i < g_num_trace_flags; i++) {
		fprintf(f, ", %s", g_trace_flags[i].name);
	}

	fprintf(f, ")\n");
#else
	fprintf(f, " %s flag    enable trace flag (not supported - must rebuild with CONFIG_DEBUG=y)\n",
		trace_arg);
#endif
}