[Cbe-oss-dev] [patch 05/18] petitboot: Discover add current device report

Jeremy Kerr jk at ozlabs.org
Mon Mar 30 19:30:21 EST 2009


Hi Geoff,

>  struct device_handler {
>  	struct discover_server *server;
> -
> -	struct device *devices;
>  	int n_devices;
> -
>  	struct list contexts;
>  };

The idea here is that the contexts are around for the duration of the 
discovery. After the discovery has completed, we move the struct devices 
from the context over to the 'devices' member here.

This makes accessing the devices much easier, as we don't have to 
iterate through the contexts. This isn't completely implemented at the 
moment, but is where I'd like to be headed.

> --- a/discover/device-handler.h
> +++ b/discover/device-handler.h
> @@ -25,7 +25,7 @@ struct device_handler *device_handler_in
>  void device_handler_destroy(struct device_handler *devices);
>
>  int device_handler_get_current_devices(struct device_handler
> *handler,
> -		const struct device **devices);
> +		const struct device ***devices);
>

I don't like this triple pointer API, do we really need it?

We could either expose the array of devices directly, or have a 
get_device(int index) / get_device_count() type accessors.

Regards,


Jeremy



More information about the cbe-oss-dev mailing list