From: Segher Boessenkool <segher@kernel.crashing.org>
To: David Miller <davem@davemloft.net>
Cc: linux-kernel@vger.kernel.org, devel@laptop.org, dmk@flex.com,
benh@kernel.crashing.org, wmb@firmworks.com, hch@infradead.org,
jg@laptop.org
Subject: Re: [PATCH] Open Firmware device tree virtual filesystem
Date: Tue, 2 Jan 2007 12:03:10 +0100 [thread overview]
Message-ID: <d4e6d795118aca69982b619e13590ef9@kernel.crashing.org> (raw)
In-Reply-To: <20070101.203043.112622209.davem@davemloft.net>
>> It has proved a good idea in general as I can easily get an exact
>> device-tree dump from users by asking for a tarball of
>> /proc/device-tree
>> and in some case, the data in there -is- binary (For example, the EDID
>> properties for monitors left by video drivers, or things like that).
>
> Yes and with openpromfs I can get the EDID too :-)
>
> root@sunset:/proc/openprom/pci@1f,700000/SUNW,XVR-100@3# cat edid
> 00ffffff.ffffff00.4dd9d000.67175700.2d0d0103.0e321f78.eacea9a3.574c9926
> .19484cbd.ee80a940.81808140.01010101.01010101.0101734b.80a072b0.2a4080d
> 0.1300ef35.1100001c.483f4030.62b03240.40c01300.ef351100.001e0000.00fd00
> 37.411e5f14.000a2020.20202020.000000fc.0053444d.2d503233.32570a20.20200
> 0af
> root@sunset:/proc/openprom/pci@1f,700000/SUNW,XVR-100@3#
And how do you know from this output that the property
didn't contain this stuff as a text string?
> I think there is high value in an OFW filesystem representation
> that gives you _EXACTLY_ what the OFW command line prompt does
> when you try to traverse the device tree from there, and that
> is what openpromfs tries to do.
I suppose you're referring to the OF .properties command,
it's trivial to get at the *actual property contents* from
the OF prompt too.
.properties is a OF _user interface_ command, it is a helper
thing to show the properties in a more easily human digestible
format. The analogue in Linux would be a user land tool.
> If you want raw access, use a character device or a similar auxilliary
> access to the data items. Another idea is to provide a seperate file
> operation (such as ioctl) on the OFW property files in order to fetch
> things raw and in binary.
If user space can get raw access to the data via a device
file, there shouldn't be a filesystem at all, just some
tool that interfaces to the device. Since the data we're
representing is naturally tree-based though, a filesystem
is a much nicer solution than a character device with a
bunch of ioctls.
> When I get some binary data out of a procfs or sysfs file I feel like
> strangling somebody.
Right, let's encode PCI config space (all of it, not just the
few standard fields) into 256 files config-00, ..., config-ff.
Superb plan!
The fact is, if you get some data (a property value, or the
contents of config space), that you do not know what it means
or how it is structured even, there is no good way to represent
it other than passing it through as-is. Or you can guess, and
guess wrong (sometimes at least). Scripts parsing your output
will have to read all formats you produce and transform it back
into something usable -- they can *never* use it as-is, they
can't assume some property will always be text for example (be
text according to your heuristic, that is). Oh, except the format
you chose cannot be transformed back at all.
Another example of that then: I'd like to _see_ the difference
between (as hex bytes) "61 62 63" and "61 62 63 00" -- if only
to find bugs in OF code, or whatever. With the property_show()
thing in openpromfs, I can't tell (well maybe the first one
crashes on the strlen() call, if prop->val doesn't get an extra
0 tagged onto the end during creation, I didn't check).
> I'm grovelling around in a filesystem from the
> command line so that I can get some information as a user. If you
> don't give me text I can't tell what the heck it is.
Sure, but you don't need the kernel to present it as text, use
some helper thing instead, that can use *much* better heuristics
(like .properties in OF actually does) to decide on matters.
> Simple system tools should not need to interpret binary data in
> order to provide access to simple structured data like this, that's
> just stupid.
The structure within a property is context-dependent, it isn't
simple at all (in general). And the binary data doesn't need
interpretation, the text representation of it does though --
interpretation back to usable binary form.
Segher
next prev parent reply other threads:[~2007-01-02 11:04 UTC|newest]
Thread overview: 89+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-31 1:38 [PATCH] Open Firmware device tree virtual filesystem Mitch Bradley
2006-12-31 5:19 ` David Miller
2006-12-31 9:36 ` Mitch Bradley
2006-12-31 9:52 ` David Miller
2006-12-31 10:11 ` David Kahn
2006-12-31 10:49 ` David Miller
2006-12-31 11:47 ` Rene Rebe
2006-12-31 11:53 ` David Kahn
2007-01-01 3:48 ` Segher Boessenkool
2007-01-02 3:56 ` Benjamin Herrenschmidt
2007-01-02 18:43 ` Richard Smith
2006-12-31 15:41 ` Christoph Hellwig
2006-12-31 20:46 ` David Miller
2007-01-01 3:37 ` David Kahn
2007-01-01 8:54 ` David Miller
2007-01-02 4:02 ` Benjamin Herrenschmidt
2007-01-02 12:28 ` Segher Boessenkool
2007-01-01 3:33 ` Segher Boessenkool
2007-01-01 8:57 ` David Miller
2007-01-01 17:48 ` Segher Boessenkool
2007-01-01 23:08 ` David Miller
2007-01-01 23:52 ` Segher Boessenkool
2007-01-02 3:31 ` David Miller
2007-01-02 11:26 ` Segher Boessenkool
2007-01-02 1:40 ` David Kahn
2007-01-02 3:36 ` David Miller
2007-01-01 18:10 ` Mitch Bradley
2007-01-01 19:21 ` Jan Engelhardt
2007-01-02 4:05 ` Benjamin Herrenschmidt
2007-01-02 4:30 ` David Miller
2007-01-02 4:57 ` Benjamin Herrenschmidt
2007-01-02 5:01 ` David Miller
2007-01-02 5:09 ` Benjamin Herrenschmidt
2007-01-02 5:44 ` David Miller
2007-01-02 12:36 ` Segher Boessenkool
2007-01-02 11:03 ` Segher Boessenkool [this message]
2007-01-02 3:53 ` Benjamin Herrenschmidt
2007-01-02 12:22 ` Segher Boessenkool
2007-01-02 20:12 ` Benjamin Herrenschmidt
2007-01-02 21:28 ` Segher Boessenkool
2007-01-02 21:32 ` Benjamin Herrenschmidt
2007-01-02 21:40 ` Segher Boessenkool
2007-01-02 22:10 ` David Miller
2007-01-02 22:05 ` David Miller
2007-01-03 0:48 ` Segher Boessenkool
2007-01-03 4:34 ` David Miller
2007-01-03 15:23 ` Segher Boessenkool
2007-01-04 2:15 ` David Miller
2007-01-02 3:45 ` Benjamin Herrenschmidt
2007-01-02 3:49 ` David Miller
2007-01-02 11:45 ` Segher Boessenkool
2007-01-02 20:07 ` Benjamin Herrenschmidt
2006-12-31 13:24 ` Pekka Enberg
2006-12-31 18:55 ` Mitch Bradley
2006-12-31 14:12 ` Jan Engelhardt
2006-12-31 20:45 ` David Miller
2006-12-31 21:30 ` Jan Engelhardt
2007-01-02 3:43 ` Benjamin Herrenschmidt
2007-01-02 11:37 ` Segher Boessenkool
2007-01-02 13:22 ` Stefan Reinauer
2007-01-02 20:08 ` Benjamin Herrenschmidt
2007-01-02 20:11 ` Mitch Bradley
2007-01-02 20:48 ` Benjamin Herrenschmidt
2007-01-02 21:37 ` Segher Boessenkool
2007-01-02 21:47 ` Benjamin Herrenschmidt
2007-01-03 0:35 ` Segher Boessenkool
2007-01-03 0:44 ` Benjamin Herrenschmidt
2007-01-03 1:14 ` Segher Boessenkool
2007-01-03 4:35 ` David Miller
2007-01-02 22:07 ` David Miller
2007-01-03 0:52 ` Segher Boessenkool
2007-01-03 1:13 ` Jan Engelhardt
2007-01-03 4:38 ` David Miller
2007-01-03 5:05 ` Benjamin Herrenschmidt
2007-01-03 15:59 ` Segher Boessenkool
2007-01-03 15:31 ` Segher Boessenkool
2007-01-03 4:34 ` David Miller
2007-01-02 21:15 ` Segher Boessenkool
2007-01-02 21:59 ` David Miller
2007-01-01 3:40 ` Segher Boessenkool
2007-01-01 4:21 ` Segher Boessenkool
-- strict thread matches above, loose matches on Subject: below --
2007-01-11 17:39 ron minnich
2007-01-11 17:53 ` Mitch Bradley
2007-01-11 17:55 ` ron minnich
2007-01-11 18:36 ` Segher Boessenkool
2007-01-11 18:20 ` Stefan Reinauer
2007-01-11 18:47 ` Segher Boessenkool
2007-01-11 19:12 ` ron minnich
2007-01-11 19:11 ` ron minnich
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=d4e6d795118aca69982b619e13590ef9@kernel.crashing.org \
--to=segher@kernel.crashing.org \
--cc=benh@kernel.crashing.org \
--cc=davem@davemloft.net \
--cc=devel@laptop.org \
--cc=dmk@flex.com \
--cc=hch@infradead.org \
--cc=jg@laptop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=wmb@firmworks.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