trace: Increase the size of trace name

According to the analysis, the largest name size is
24 not including '\0' (NVMF_RDMA_WRITE_COMPLETE),
so change the the size of name. Also add a check
to avoid the str exceeding our defined name size.

Change-Id: Iddf2cb52a3f5358306a59fc66bb997fa8098cde0
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
This commit is contained in:
Daniel Verkamp 2017-03-24 15:56:09 -07:00
parent 7fc640b296
commit c3f109f91e
2 changed files with 3 additions and 3 deletions

View File

@ -78,7 +78,7 @@ struct spdk_trace_object {
#define SPDK_TPOINT_ID(group, tpoint) ((group * 64) + tpoint) #define SPDK_TPOINT_ID(group, tpoint) ((group * 64) + tpoint)
struct spdk_trace_tpoint { struct spdk_trace_tpoint {
char name[24]; char name[44];
char short_name[4]; char short_name[4];
uint16_t tpoint_id; uint16_t tpoint_id;
uint8_t owner_type; uint8_t owner_type;

View File

@ -255,8 +255,8 @@ spdk_trace_register_description(const char *name, const char *short_name,
tpoint = &g_trace_histories->tpoint[tpoint_id]; tpoint = &g_trace_histories->tpoint[tpoint_id];
assert(tpoint->tpoint_id == 0); assert(tpoint->tpoint_id == 0);
strncpy(tpoint->name, name, sizeof(tpoint->name)); snprintf(tpoint->name, sizeof(tpoint->name), "%s", name);
strncpy(tpoint->short_name, short_name, sizeof(tpoint->short_name)); snprintf(tpoint->short_name, sizeof(tpoint->short_name), "%s", short_name);
tpoint->tpoint_id = tpoint_id; tpoint->tpoint_id = tpoint_id;
tpoint->object_type = object_type; tpoint->object_type = object_type;
tpoint->owner_type = owner_type; tpoint->owner_type = owner_type;