[PATCH 1/2] of: Make device nodes kobjects so they show up in sysfs
Benjamin Herrenschmidt
benh at kernel.crashing.org
Thu Mar 21 04:46:19 EST 2013
On Wed, 2013-03-20 at 09:56 -0700, Greg Kroah-Hartman wrote:
> > Unfortunately they occasionally are... VPDs can be pretty big for
> > example.
>
> If the attributes are binary blobs, use the binary file capability of
> sysfs to properly handle them.
Except that we don't know that ... we have properties which comes all as
"blobs", only the consumers can interpret what they contain. Tools like
lsprop or dtc do have some built-in smarts to differentiate for example
strings, simple numbers and blobs based roughly on heuristics of content
& size but that's purely for the sake of pretty printing.
Something like /proc/device-tree (or a sysfs equivalent) has no way
really to know what's in there. So basically they should *all* be binary
blobs.
> > > Second, all normal sysfs attributes report their size as 4096 bytes
> > > instead of the actual property size reported in /proc/device-tree. It is
> > > possible that this change will cause some userspace tools to break.
> >
> > This is btw a complete idiocy of sysfs and should/could be fixed.
>
> How can sysfs change this? It doesn't know the size of the attribute
> ahead of time, and it can change depending on what happens in the
> system. So we default to a page size, which is the largest size an
> attribute can be.
That's true for some attributes I suppose and I while I do understand
the difficulty there would be in calculating all the sizes on every
stat, it's still gross, especially for those plenty of attributes who
do have a fixed size.
In our case, we do know the size, we should expose it.
Cheers,
Ben.
More information about the devicetree-discuss
mailing list