[ofa-general] Pending libibverbs patches?

Roland Dreier rdreier at cisco.com
Tue Apr 15 09:53:22 PDT 2008


 > I wonder if you would take a small patch to map enums to strings.  I thought I
 > submitted this before but I do not find it in the list archive so I must have
 > forgotten about it.

Yes, that is a useful addition (although it's not that small a patch ;).

However

 > +++ b/src/libibverbs.map
 > @@ -91,4 +91,9 @@ IBVERBS_1.1 {
 >  		ibv_dontfork_range;
 >  		ibv_dofork_range;
 >  		ibv_register_driver;
 > +
 > +      __ibv_node_type_str;
 > +      __ibv_port_state_str;
 > +      __ibv_event_type_str;
 > +      __ibv_wc_status_str;

I don't think we want to export the array of strings as the ABI, since
that would prevent us from doing localization or anything like that in
the future, and compiling the inline functions into the application just
seems less flexible.  So I would rather see

 > +static inline const char *ibv_node_type_str(enum ibv_node_type node_type)
 > +{
 > +	if (node_type < IBV_NODE_CA || node_type > IBV_NODE_RNIC)
 > +		node_type = 0;
 > +	return (__ibv_node_type_str[node_type]);
 > +}

the API should be ibv_node_type_str() and it should be a non-inline
exported string function.

 - R.



More information about the general mailing list