tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: General device properties API




> On Aug 14, 2021, at 1:19 AM, Thomas Klausner <wiz%NetBSD.org@localhost> wrote:
> 
> Hi Jason!
> 
> Some minor comments:

Hey Thomas, thanks for the feedback!  Responses inline.

> Should we use ssize_t instead of int for the size of objects (or -1 if
> not existing)? I think it's the more appropriate type; on the other
> hand, we don't seem to be using this type much in the kernel yet at
> all.

Yah, I was kind of waffling on that, but’ll go ahead and change the interfaces to use size_t (and return ssize_t).  I’ll add the appropriate range checks in the platform device tree back-ends.

> Does device_getprop_string always NUL-terminate the buffer, even if
> the provided one is too small?

It did not at first (to match the OpenFirmware semantics), but I have just changed it to do so for all cases.

> I read device_getpropencoding as device_getpr_open_coding, so perhaps
> we can add a couple more "_" as word separators. I.e.
> 
> device_getprop_len
> device_getprop_encoding
> device_getprop_type

Changes as suggested, although I changed device_getproplen() to device_getprop_size().

> (and similarly for the devhandle_* versions of those); that makes them
> (in my eyes) more consistent with device_getprop_string,
> device_getprop_bool, etc.
> 
> Cheers,
> Thomas

-- thorpej



Home | Main Index | Thread Index | Old Index