(SPAM?) [openib-general] [RFC] new ibv_get_devices() API -- avoid dlists
Roland Dreier
rolandd at cisco.com
Thu Nov 10 15:11:48 PST 2005
> 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.
More information about the general
mailing list