[openib-general] [RFC] new ibv_get_devices() API -- avoid dlists

Roland Dreier rolandd at cisco.com
Thu Nov 10 14:35:21 PST 2005


    Michael> Maybe its a naming thing? We can call the list
    Michael> "iterator", does this make it less ugly?

I thought about this, but it feels like overkill for something pretty
simple.  So how about just doing

/* put list of devices in list and return length of list */
extern int ibv_get_device_list(struct ibv_device * const **list);

/* free a list of devices from ibv_get_device_list */
extern void ibv_free_device_list(struct ibv_device * const *list);

which could be used as:

	struct ibv_device * const *list;
	int list_len;

	list_len = ibv_get_device_list(&list);

	/* ... */

	ibv_free_device_list(list);

Or are the consts too confusing?  Should we be a little less safe but
make it nice and simple and just do

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

and so on?

 - R.



More information about the general mailing list