Current-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: unreadable XML proplists from drvctl(8)
On Fri, 20 Jan 2012 05:51:35 +0000
David Holland <dholland-current%netbsd.org@localhost> wrote:
> On Wed, Jan 18, 2012 at 04:00:12PM -0500, Matthew Mondor wrote:
> > Although the above example didn't exactly use JSON, I think that
> > yes, decently indented JSON would be a good alternative output format
> > for humans.
>
> I think JSON is at most only slightly preferable.
>
> If the output can be tabular, it should be tabular. Otherwise, how
> about outputting in mib format like the various *ctl tools? Hardly
> optimal but not awful and there's lots of precedent.
XML plist format:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0">
<dict>
<key>device-driver</key>
<string>wd</string>
<key>device-unit</key>
<integer>0x0</integer>
<key>disk-info</key>
<dict>
<key>geometry</key>
<dict>
<key>cylinders-per-unit</key>
<integer>0x97695</integer>
<key>sector-size</key>
<integer>0x200</integer>
<key>sectors-per-track</key>
<integer>0x3f</integer>
<key>sectors-per-unit</key>
<integer>0x2542eab0</integer>
<key>tracks-per-cylinder</key>
<integer>0x10</integer>
</dict>
<key>type</key>
<string>ESDI</string>
</dict>
</dict>
</plist>
My current "humanize" format:
{
"device-driver" = "wd"
"device-unit" = 0
"disk-info" = {
"geometry" = {
"cylinders-per-unit" = 620181
"sector-size" = 512
"sectors-per-track" = 63
"sectors-per-unit" = 625142448
"tracks-per-cylinder" = 16
}
"type" = "ESDI"
}
}
Proposed MIB format?
wd0.device-driver = wd
wd0.device-unit = 0
wd0.disk-info.geometry.cylenders-per-unit = 620181
wd0.disk-info.geometry.sector-size = 512
wd0.disk-info.geometry.sectors-per-track = 63
wd0.disk-info.geometry.sectors-per-unit = 625142448
wd0.disk-info.geometry.tracks-per-cylinder = 16
wd0.type = ESDI
Which could be generated with some function such as:
int prop_object_externalize_mib(const char *parent, prop_object_t, FILE *);
Where in this case <parent> could be "wd0"... which if NULL would not
include a top-level parent. Yet now I'm wondering, would arrays be
output such as [ 1 2 3 4 ... ] ? There different various formats
output by some multi-value sysctl klobs at the moment.
Once we mostly agree on a human format (we're pretty close :) I can
propose a function for review...
Thanks,
--
Matt
Home |
Main Index |
Thread Index |
Old Index