[ofa-general] [PATCH 3/5] Add mad_field_name function

Ira Weiny weiny2 at llnl.gov
Wed Apr 22 18:54:49 PDT 2009


>From e812376dd0fd1368f536f1032b6035d5e01fa4ac Mon Sep 17 00:00:00 2001
From: Ira Weiny <weiny2 at llnl.gov>
Date: Wed, 22 Apr 2009 18:44:17 -0700
Subject: [PATCH] Add mad_field_name function

	returns the "name" of the field specified

Signed-off-by: Ira Weiny <weiny2 at llnl.gov>
---
 libibmad/include/infiniband/mad.h |    1 +
 libibmad/src/fields.c             |    5 +++++
 libibmad/src/libibmad.map         |    1 +
 3 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/libibmad/include/infiniband/mad.h b/libibmad/include/infiniband/mad.h
index b8290a7..b6f4b60 100644
--- a/libibmad/include/infiniband/mad.h
+++ b/libibmad/include/infiniband/mad.h
@@ -722,6 +722,7 @@ MAD_EXPORT void mad_encode_field(uint8_t * buf, enum MAD_FIELDS field, void *val
 MAD_EXPORT int mad_print_field(enum MAD_FIELDS field, const char *name, void *val);
 MAD_EXPORT char *mad_dump_field(enum MAD_FIELDS field, char *buf, int bufsz, void *val);
 MAD_EXPORT char *mad_dump_val(enum MAD_FIELDS field, char *buf, int bufsz, void *val);
+MAD_EXPORT const char *mad_field_name(enum MAD_FIELDS field);
 
 /* mad.c */
 MAD_EXPORT void *mad_encode(void *buf, ib_rpc_t * rpc, ib_dr_path_t * drpath,
diff --git a/libibmad/src/fields.c b/libibmad/src/fields.c
index df43ceb..02f2e75 100644
--- a/libibmad/src/fields.c
+++ b/libibmad/src/fields.c
@@ -686,3 +686,8 @@ char *mad_dump_val(enum MAD_FIELDS field, char *buf, int bufsz, void *val)
 		return 0;
 	return _mad_dump_val(ib_mad_f + field, buf, bufsz, val);
 }
+
+const char *mad_field_name(enum MAD_FIELDS field)
+{
+	return (ib_mad_f[field].name);
+}
diff --git a/libibmad/src/libibmad.map b/libibmad/src/libibmad.map
index 4306dbc..6b77784 100644
--- a/libibmad/src/libibmad.map
+++ b/libibmad/src/libibmad.map
@@ -102,5 +102,6 @@ IBMAD_1.3 {
 		ib_resolve_guid_via;
 		ib_resolve_portid_str_via;
 		ib_resolve_self_via;
+		mad_field_name;
 	local: *;
 };
-- 
1.5.4.5




More information about the general mailing list