Subject: Re: Generic Properties
To: Michael K. Sanders <msanders@confusion.net>
From: None <cgd@broadcom.com>
List: tech-kern
Date: 09/27/2001 10:27:09
"Michael K. Sanders" <msanders@confusion.net> writes:
> cgd@broadcom.com writes:
> >It's not stated here, but PROP_CONST is a flag.
> ...
> >as your basic types, then have 'array' be a flag.
>
> Would it make sense for the wait argument to also be a flag? Should
> the flags be a separate argument? Cf. malloc(9).
these flags are flags in the 'type' field of the entries. go back and
read the previous discussions. 8-)
> >> size_t getprop(kdatabase_t db, opaque_t object, const char *name,
> >> void *val, size_t len, int *type);
>
> >uh, why do the 'val != NULL' check if anything other than diagnostic?
>
> How do you know the appropriate size to allocate for val?
same way you do for all of the similar interfaces: it returns the size
you need, so you can pass in a len of 0 (and who cares what the buffer
is), or pass in a good buffer and a length that may or may not be long
enough...
> If that's the case, maybe there should be a separate lookup function
> instead of overloading getprop to do both.
there is no shortage of interfaces that work exactly the way this one
does.
cgd