Subject: Re: Device properties anyone?
To: None <bjh21@cam.ac.uk, eeh@netbsd.org, tech-kern@netbsd.org>
From: None <eeh@netbsd.org>
List: tech-kern
Date: 01/17/2001 18:20:41
In article <20010116235724.3143.qmail@mail.netbsd.org> you write:
>Examples of data that are currently problematical but could easily be passed
>as properties are device locators, which require and arbitrary bus-specific
>structure to pass betwen the parent bus node and the child device node,
How would device properties help here? The foo_attach_args structure
has to be passed to a driver's match function, before there's a struct
device to associate any properties with.
One option is to do what Solaris does: have `struct device' as
a separate structure than the device's softc, so the `struct device'
can be generated before the match routine.
>int setprop(struct device *dev, const char *name, void *val, size_t len, int flags);
>size_t getprop(struct device *dev, const char *name, void *val,
> size_t len, int flags);
Hmm. I'd somehow prefer to be passing around void *s, rather than
copying the data all the time. This does lead to a problem of what to
do if md_getprop had to dynamically allocate a property, though.
I considered that idea originally and determined that md_getprop(9)
would have to allocate data dynamically, *and* it would be difficult
or impossible to determine when and how to free the data.
Eduardo