Subject: Re: Generic Properties
To: None <cgd@broadcom.com>
From: Michael K. Sanders <msanders@confusion.net>
List: tech-kern
Date: 09/27/2001 01:45:32
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).

>This is really disappointing.  One thing that I think a couple of us
>tried to stress _over and over_ in the device properties discussion
>was that uniformity of function naming is fairly useful and important.

Well, the rest of the document does (inconsistently) refer to
dev_XXX(9).  :) 

>> 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?  It looks
like you have to call getprop with NULL arguments for val and type,
allocate storage based on the returned size, then call it again to
actually populate val and type (but you could have populated type in 
the first call, too!).

If that's the case, maybe there should be a separate lookup function
instead of overloading getprop to do both.  

:: Mike ::