Re: An alternative way of populating /proc
H. Peter Anvin (hpa@transmeta.com)
11 Apr 2000 13:16:44 -0700
Followup to: <20000411162419.A2985@ash.comlab>
By author: Matt Aubury <Matt.Aubury@comlab.ox.ac.uk>
In newsgroup: linux.dev.kernel
>
> Hi,
>
> The recent debate about the multitude of possible formats for data in
> /proc caused me to think about a short-hand way of populating a /proc
> directory hierarchy. This scheme uses a format string to describe the
> hierarchical data layout, so:
>
> create_proc_entries(NULL,
> "test:{bar:{x:%d,y:%d,z:%d},foo:%f}",
> &x, &y, &z, foo_fun);
>
> creates a "/proc/test" directory, which further contains a
> subdirectory "bar" and a file "foo". The "bar" subdirectory contains
> three files "x", "y" and "z".
>
> The formatting argument "%d" takes a pointer to an integer. When
> reading such a file (in this case "x", "y", or "z"), the value is
> shown as ascii. Writing to the file (again in ascii) updates the
> value. The "%f" formatting argument allows you to pass an arbitrary
> user function for generating output. Clearly, there are potentially
> quite a number of standard/useful formatting arguments.
>
This is more or less what I had in mind, but we do need a little more
than that. Part of the problem with the existing /proc is that it is
nice for humans, but is downright difficult to parse by machine.
/proc/sys is a lot better, but the kernel-internal APIs are horrible.
I had a discussion with Stephen Tweedie about this the other day. I
will try to write up what we came up with tomorrow or so.
-hpa
--
<hpa@transmeta.com> at work, <hpa@zytor.com> in private!
"Unix gives you enough rope to shoot yourself in the foot."
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/