RDS/IB: print string constants in more places

This prints the constant identifier for work completion status and rdma
cm event types, like we already do for IB event types.

A core string array helper is added that each string type uses.

Signed-off-by: Zach Brown <zach.brown@oracle.com>
This commit is contained in:
Zach Brown
2010-08-03 13:52:47 -07:00
committed by Andy Grover
parent 4518071ac1
commit 59f740a6ae
7 changed files with 97 additions and 21 deletions
+4 -6
View File
@@ -39,7 +39,8 @@
#include "ib.h"
static char *rds_ib_event_type_strings[] = {
#define RDS_IB_EVENT_STRING(foo) [IB_EVENT_##foo] = __stringify(foo)
#define RDS_IB_EVENT_STRING(foo) \
[IB_EVENT_##foo] = __stringify(IB_EVENT_##foo)
RDS_IB_EVENT_STRING(CQ_ERR),
RDS_IB_EVENT_STRING(QP_FATAL),
RDS_IB_EVENT_STRING(QP_REQ_ERR),
@@ -63,11 +64,8 @@ static char *rds_ib_event_type_strings[] = {
static char *rds_ib_event_str(enum ib_event_type type)
{
if (type < ARRAY_SIZE(rds_ib_event_type_strings) &&
rds_ib_event_type_strings[type])
return rds_ib_event_type_strings[type];
else
return "unknown";
return rds_str_array(rds_ib_event_type_strings,
ARRAY_SIZE(rds_ib_event_type_strings), type);
};
/*