log: remove "trace" from public API

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I90e7d698cae7577736319e38f089e3b759c9beef

Reviewed-on: https://review.gerrithub.io/435343
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Jim Harris 2018-11-26 23:57:58 -07:00
parent 3dc8dfb40d
commit b4b7d5d3ff
11 changed files with 49 additions and 49 deletions

View File

@ -408,7 +408,7 @@ show_bs_cb(void *arg1, spdk_blob_id blobid, int bserrno)
printf("\t# free clusters: %" PRIu64 "\n", val);
bstype = spdk_bs_get_bstype(cli_context->bs);
spdk_trace_dump(stdout, "\tblobstore type:", &bstype, sizeof(bstype));
spdk_log_dump(stdout, "\tblobstore type:", &bstype, sizeof(bstype));
/*
* Private info isn't accessible via the public API but
@ -466,7 +466,7 @@ show_blob(struct cli_context_t *cli_context)
printf("\n(%d) Name:%s\n", i,
spdk_xattr_names_get_name(names, i));
printf("(%d) Value:\n", i);
spdk_trace_dump(stdout, "", value, value_len);
spdk_log_dump(stdout, "", value, value_len);
}
/*

View File

@ -1588,7 +1588,7 @@ usage(const char *program_name)
printf(" subnqn Subsystem NQN (default: %s)\n", SPDK_NVMF_DISCOVERY_NQN);
printf(" Example: -r 'trtype:RDMA adrfam:IPv4 traddr:192.168.100.8 trsvcid:4420'\n");
spdk_tracelog_usage(stdout, "-L");
spdk_log_usage(stdout, "-L");
printf(" -i shared memory group ID\n");
printf(" -p core number in decimal to run this application which started from 0\n");
@ -1632,7 +1632,7 @@ parse_args(int argc, char **argv)
g_hex_dump = true;
break;
case 'L':
rc = spdk_log_set_trace_flag(optarg);
rc = spdk_log_set_flag(optarg);
if (rc < 0) {
fprintf(stderr, "unknown flag\n");
usage(argv[0]);

View File

@ -109,7 +109,7 @@ get_host_identifier(struct spdk_nvme_ctrlr *ctrlr)
}
if (get_host_id_successful) {
spdk_trace_dump(stdout, "Get Feature: Host Identifier:", host_id, host_id_size);
spdk_log_dump(stdout, "Get Feature: Host Identifier:", host_id, host_id_size);
}
return 0;

View File

@ -140,47 +140,47 @@ void spdk_log(enum spdk_log_level level, const char *file, const int line, const
const char *format, ...) __attribute__((__format__(__printf__, 5, 6)));
/**
* Dump the trace to a file.
* Log the contents of a raw buffer to a file.
*
* \param fp File to hold the trace.
* \param fp File to hold the log.
* \param label Label to print to the file.
* \param buf Buffer that holds the trace information.
* \param len Length of trace to dump.
* \param buf Buffer that holds the log information.
* \param len Length of buffer to dump.
*/
void spdk_trace_dump(FILE *fp, const char *label, const void *buf, size_t len);
void spdk_log_dump(FILE *fp, const char *label, const void *buf, size_t len);
/**
* Check whether the trace flag exists and is enabled.
* Check whether the log flag exists and is enabled.
*
* \return true if enabled, or false otherwise.
*/
bool spdk_log_get_trace_flag(const char *flag);
bool spdk_log_get_flag(const char *flag);
/**
* Enable the trace flag.
* Enable the log flag.
*
* \param flag Trace flag to be enabled.
* \param flag Log flag to be enabled.
*
* \return 0 on success, -1 on failure.
*/
int spdk_log_set_trace_flag(const char *flag);
int spdk_log_set_flag(const char *flag);
/**
* Clear a trace flag.
* Clear a log flag.
*
* \param flag Trace flag to clear.
* \param flag Log flag to clear.
*
* \return 0 on success, -1 on failure.
*/
int spdk_log_clear_trace_flag(const char *flag);
int spdk_log_clear_flag(const char *flag);
/**
* Show all the log trace flags and their usage.
* Show all the log flags and their usage.
*
* \param f File to hold all the flags' information.
* \param trace_arg Command line option to set/enable the trace flag.
* \param log_arg Command line option to set/enable the log flag.
*/
void spdk_tracelog_usage(FILE *f, const char *trace_arg);
void spdk_log_usage(FILE *f, const char *log_arg);
#ifdef __cplusplus
}

View File

@ -89,7 +89,7 @@ __attribute__((constructor)) static void register_trace_flag_##flag(void) \
do { \
extern struct spdk_log_flag FLAG; \
if ((FLAG.enabled) && (LEN)) { \
spdk_trace_dump(stderr, (LABEL), (BUF), (LEN)); \
spdk_log_dump(stderr, (LABEL), (BUF), (LEN)); \
} \
} while (0)

View File

@ -739,7 +739,7 @@ usage(void (*app_usage)(void))
printf(" --huge-dir <path> use a specific hugetlbfs mount to reserve memory from\n");
printf(" --num-trace-entries <num> number of trace entries for each core (default %d)\n",
SPDK_APP_DEFAULT_NUM_TRACE_ENTRIES);
spdk_tracelog_usage(stdout, "-L");
spdk_log_usage(stdout, "-L");
spdk_trace_mask_usage(stdout, "-e");
if (app_usage) {
app_usage();
@ -903,7 +903,7 @@ spdk_app_parse_args(int argc, char **argv, struct spdk_app_opts *opts,
usage(app_usage);
goto out;
#else
rc = spdk_log_set_trace_flag(optarg);
rc = spdk_log_set_flag(optarg);
if (rc < 0) {
fprintf(stderr, "unknown flag\n");
usage(app_usage);

View File

@ -183,7 +183,7 @@ fdump(FILE *fp, const char *label, const uint8_t *buf, size_t len)
}
void
spdk_trace_dump(FILE *fp, const char *label, const void *buf, size_t len)
spdk_log_dump(FILE *fp, const char *label, const void *buf, size_t len)
{
fdump(fp, label, buf, len);
}

View File

@ -85,7 +85,7 @@ spdk_log_get_backtrace_level(void) {
}
static struct spdk_log_flag *
get_trace_flag(const char *name)
get_log_flag(const char *name)
{
struct spdk_log_flag *flag;
@ -109,7 +109,7 @@ spdk_log_register_trace_flag(const char *name, struct spdk_log_flag *flag)
return;
}
if (get_trace_flag(name)) {
if (get_log_flag(name)) {
SPDK_ERRLOG("duplicate spdk_log_flag '%s'\n", name);
assert(false);
return;
@ -126,9 +126,9 @@ spdk_log_register_trace_flag(const char *name, struct spdk_log_flag *flag)
}
bool
spdk_log_get_trace_flag(const char *name)
spdk_log_get_flag(const char *name)
{
struct spdk_log_flag *flag = get_trace_flag(name);
struct spdk_log_flag *flag = get_log_flag(name);
if (flag && flag->enabled) {
return true;
@ -138,7 +138,7 @@ spdk_log_get_trace_flag(const char *name)
}
static int
set_trace_flag(const char *name, bool value)
set_log_flag(const char *name, bool value)
{
struct spdk_log_flag *flag;
@ -149,7 +149,7 @@ set_trace_flag(const char *name, bool value)
return 0;
}
flag = get_trace_flag(name);
flag = get_log_flag(name);
if (flag == NULL) {
return -1;
}
@ -160,15 +160,15 @@ set_trace_flag(const char *name, bool value)
}
int
spdk_log_set_trace_flag(const char *name)
spdk_log_set_flag(const char *name)
{
return set_trace_flag(name, true);
return set_log_flag(name, true);
}
int
spdk_log_clear_trace_flag(const char *name)
spdk_log_clear_flag(const char *name)
{
return set_trace_flag(name, false);
return set_log_flag(name, false);
}
struct spdk_log_flag *
@ -184,11 +184,11 @@ spdk_log_get_next_trace_flag(struct spdk_log_flag *flag)
}
void
spdk_tracelog_usage(FILE *f, const char *trace_arg)
spdk_log_usage(FILE *f, const char *log_arg)
{
#ifdef DEBUG
struct spdk_log_flag *flag;
fprintf(f, " %s, --traceflag <flag> enable debug log flag (all", trace_arg);
fprintf(f, " %s, --traceflag <flag> enable debug log flag (all", log_arg);
TAILQ_FOREACH(flag, &g_trace_flags, tailq) {
fprintf(f, ", %s", flag->name);
@ -197,6 +197,6 @@ spdk_tracelog_usage(FILE *f, const char *trace_arg)
fprintf(f, ")\n");
#else
fprintf(f, " %s, --traceflag <flag> enable debug log flag (not supported"
" - must rebuild with --enable-debug)\n", trace_arg);
" - must rebuild with --enable-debug)\n", log_arg);
#endif
}

View File

@ -261,7 +261,7 @@ spdk_rpc_set_trace_flag(struct spdk_jsonrpc_request *request,
goto invalid;
}
spdk_log_set_trace_flag(req.flag);
spdk_log_set_flag(req.flag);
free_rpc_trace_flag(&req);
w = spdk_jsonrpc_begin_result(request);
@ -297,7 +297,7 @@ spdk_rpc_clear_trace_flag(struct spdk_jsonrpc_request *request,
goto invalid;
}
spdk_log_clear_trace_flag(req.flag);
spdk_log_clear_flag(req.flag);
free_rpc_trace_flag(&req);
w = spdk_jsonrpc_begin_result(request);

View File

@ -293,7 +293,7 @@ usage(const char *program_name)
printf(" subnqn Subsystem NQN (default: %s)\n", SPDK_NVMF_DISCOVERY_NQN);
printf(" Example: -r 'trtype:RDMA adrfam:IPv4 traddr:192.168.100.8 trsvcid:4420'\n");
spdk_tracelog_usage(stdout, "-L");
spdk_log_usage(stdout, "-L");
printf(" -v verbose (enable warnings)\n");
printf(" -H show this usage\n");
@ -319,7 +319,7 @@ parse_args(int argc, char **argv)
}
break;
case 'L':
rc = spdk_log_set_trace_flag(optarg);
rc = spdk_log_set_flag(optarg);
if (rc < 0) {
fprintf(stderr, "unknown flag\n");
usage(argv[0]);

View File

@ -65,21 +65,21 @@ log_test(void)
CU_ASSERT_EQUAL(spdk_log_get_print_level(), SPDK_LOG_DEBUG);
#ifdef DEBUG
CU_ASSERT(spdk_log_get_trace_flag("log") == false);
CU_ASSERT(spdk_log_get_flag("log") == false);
spdk_log_set_trace_flag("log");
CU_ASSERT(spdk_log_get_trace_flag("log") == true);
spdk_log_set_flag("log");
CU_ASSERT(spdk_log_get_flag("log") == true);
spdk_log_clear_trace_flag("log");
CU_ASSERT(spdk_log_get_trace_flag("log") == false);
spdk_log_clear_flag("log");
CU_ASSERT(spdk_log_get_flag("log") == false);
#endif
spdk_log_open();
spdk_log_set_trace_flag("log");
spdk_log_set_flag("log");
SPDK_WARNLOG("log warning unit test\n");
SPDK_DEBUGLOG(SPDK_LOG_LOG, "log trace test\n");
SPDK_TRACEDUMP(SPDK_LOG_LOG, "log trace dump test:", "trace dump", 10);
spdk_trace_dump(stderr, "spdk dump test:", "spdk dump", 9);
spdk_log_dump(stderr, "spdk dump test:", "spdk dump", 9);
spdk_log_close();
}