MIME-ifying sysctl types
Eric Anderson
anderson at freebsd.org
Mon May 7 17:17:35 UTC 2007
On 05/07/07 11:39, Ivan Voras wrote:
> In the output of sysctl -oa I see values like:
>
> kern.proc.all: Format:S,proc Length:75264
> Dump:0x00030000000000002011fac380d4fec3...
> kern.proc.proc_td: Format:N Length:75264
> Dump:0x00030000000000002011fac380d4fec3...
> kern.file: Format:S,xfile Length:18616
> Dump:0x340000003e0c0000e803000006000000...
> vfs.nfs.diskless_rootaddr: Format:%Ssockaddr_in Length:16
> Dump:0x00000000000000000000000000000000...
> debug.hashstat.rawnchash: Format:S,int Length:262144
> Dump:0x00000000000000000000000000000000...
>
> , etc., and some like:
>
> kern.ipc.msqids: Format: Length:3520
> Dump:0x00000000000000000000000000000000...
> kern.ipc.sema: Format: Length:600 Dump:0x00000000000000000000000000000000...
>
> and even some like:
> machdep.consdev: Format:T,struct cdev * Length:4 Dump:0x00000000...
>
> The first group has widely nonuniform "Format" fields, the second don't
> have it at all, and the third just looks wrong (is that a NULL pointer
> being exported from the kernel, just in case the userland doesn't have
> it? :) ).
>
> My proposal is to MIME-ify the Format fields, best presented in examples:
>
> "S,proc" -> "x-struct/proc"
> "S,xfile" -> "x-struct/xfile"
>
> Etc.
>
> GEOM tree is the easiest, it's just "text/xml", and the already present
> text fields would be "text/plain".
>
> If possible, the types should conform to
> http://www.iana.org/assignments/media-types/ - but except for text and
> XML types they usually won't.
>
> The next step, obviously, but of dubious benefit, would be to stop
> exporting binary data from the kernel and do it via XML, but that's
> another thing, possibly another GSoC proposal :)
>
> I can provide the patches for the format names. At this time I'm looking
> for input: is this idea sane? Are there any utilities that actually
> parse the type name?
>
> The benefit of this conversion is that MIME types are easier on the eyes
> and will help unfamiliar users understand what's going on.
>
How about adding a -m switch to sysctl that outputs the MIME compatible
format, leaving the other formats unchanged to avoid breaking something
someone is expecting?
Eric
More information about the freebsd-hackers
mailing list