[ofa-general] Stringify ibv_event_type

Jeff Squyres jsquyres at cisco.com
Thu Jun 21 07:09:23 PDT 2007


Could a function to stringify the ibv_event_type enum can be added to  
libibverbs?  It could be similar to the event_name_str() function in  
libibverbs/examples/asyncwatch.c:

-----
static const char *event_name_str(enum ibv_event_type event_type)
{
         switch (event_type) {
         case IBV_EVENT_DEVICE_FATAL:
                 return "IBV_EVENT_DEVICE_FATAL";
...etc.
-----

Rationale: if multiple client apps (such as the OF-based MPI  
implementations) start using the asynch events and there is no  
central function for string-ifying the event enum, they'll all end up  
doing the translation themselves when printing out error messages.   
It's not a huge amount of code, but it does seem kinda odd to make  
everyone replicate essentially the same stuff.  Additionally, the  
available enum values may grow over time, forcing client apps to  
figure out which ones are available and adjust their event_name_str()  
equivalent as appropriate.  Hiding the possibility of change down in  
libibverbs seems appropriate.

-- 
Jeff Squyres
Cisco Systems




More information about the general mailing list