> The const confuses me somewhat.

Yeah, and thinking about it more, the memory really belongs to the
consumer of the function.  So I don't think the const is even correct.

 > > extern int ibv_get_device_list(struct ibv_device ***list);

 > Is ***list really what we want here?  Can we just get away with **list?

Yes -- a single device is represented by a struct ibv_device *.
So an array of devices is represented by a struct ibv_device **.
And a pointer to such an array is struct ibv_device ***.

But the following is OK too I think:

        extern int ibv_get_device_list(struct ibv_device **list[]);
        extern void ibv_free_device_list(struct ibv_device *list[]);

is that clearer?  (a pointer to an array of pointers to struct ibv_device).

 > Would something like:
 > 
 > struct ibv_device * ibv_get_device(index);
 > 
 > work as well?

That could work as well.  But it doesn't handle hotplug quite as well.
By returning a snapshot of all the known devices at a given moment, we
at least have a chance at doing something sensible with devices
appearing or disappearing.

 - R.
_______________________________________________
openib-general mailing list
[email protected]
http://openib.org/mailman/listinfo/openib-general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general

Reply via email to