devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Grant Likely <grant.likely@secretlab.ca>,
	linux-kernel@vger.kernel.org,
	devicetree-discuss@lists.ozlabs.org,
	Rob Herring <rob.herring@calxeda.com>,
	"David S. Miller" <davem@davemloft.net>
Subject: Re: [PATCH 1/2] of: Make device nodes kobjects so they show up in sysfs
Date: Wed, 20 Mar 2013 18:46:19 +0100	[thread overview]
Message-ID: <1363801579.17680.3.camel@pasglop> (raw)
In-Reply-To: <20130320165620.GB28307@kroah.com>

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.

  reply	other threads:[~2013-03-20 17:46 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-20 14:51 [PATCH 0/2] of: Create sysfs view of device tree nodes Grant Likely
2013-03-20 14:51 ` [PATCH 1/2] of: Make device nodes kobjects so they show up in sysfs Grant Likely
     [not found]   ` <1363791074-16415-2-git-send-email-grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
2013-03-20 14:57     ` Benjamin Herrenschmidt
2013-03-20 16:56       ` Greg Kroah-Hartman
2013-03-20 17:46         ` Benjamin Herrenschmidt [this message]
2013-03-20 21:28       ` Grant Likely
     [not found] ` <1363791074-16415-1-git-send-email-grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
2013-03-20 14:51   ` [PATCH 2/2] of: remove /proc/device-tree Grant Likely
2013-03-20 14:57     ` Benjamin Herrenschmidt
2013-03-20 21:38       ` Grant Likely
2013-03-21  4:19         ` Benjamin Herrenschmidt
2013-03-21  7:35           ` Grant Likely
2013-03-21  7:43             ` Benjamin Herrenschmidt
2013-03-21  8:16               ` Grant Likely
2013-03-21 12:36                 ` Benjamin Herrenschmidt
2013-03-21 12:42                   ` Grant Likely
2013-03-20 15:19     ` Rob Herring
2013-03-20 16:24       ` Daniel Mack
2013-03-20 16:40         ` Grant Likely
2013-03-21  4:03         ` Rob Landley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1363801579.17680.3.camel@pasglop \
    --to=benh@kernel.crashing.org \
    --cc=davem@davemloft.net \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=grant.likely@secretlab.ca \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rob.herring@calxeda.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).