All,
The "create_proc_entries" suggestion has caused quite a bit of
interest, so I'm hoping to make a proper patch this weekend. A bunch
of issues have been raised (sorry to address them all in one place):
* "%" is hard to generate with sprintf -- I think if you're
sprintf'ing format strings this is probably the wrong interface to be
using. This is only intended for the 90% (?) of cases which are really
simple.
* "%" is redundant -- Yes, it is. But everyone immediately knew what
it meant, which is why it's there.
* We should use "PROC_ENT_FUNCTION" rather than "%f". Well, we could
do, but then the format strings would barely be readable.
* No type checking -- I agree that this is unfortunate. I would
imagine that even a brief test would show up type errors, though. I'm
used to programming strongly typed languages so this does pain me.
* No checking of the number of arguments -- This is just as bad, but
we could solve this quite easily by making a NULL terminator
mandatory. I'm in two minds about this -- comments?
* Multiple reads are non-atomic -- Yes, but I think if you care about
atomicity of the interface then, again, you are probably in the 10%
of tricky cases.
* Replacing ":" with "/" for directories -- I'm neutral towards this
idea. Anyone else have an opinion?
* Allowing read() on the directories -- A beguiling idea, although I'm
worried about that the silly page size limitations might trip me
up. Regardless, it's something that can easily be added later (perhaps
by someone more skilled) so I'm not going to do it for a first pass.
The remaining issues that I see are:
* Setting permissions on files and directories.
* Which data types are built in (i.e. have format characters).
Poking around my 2.2.12 /proc I see the following in the root owned
parts:
187 -rw-r--r--
103 -r--r--r--
12 -r-------- (kcore, kmsg, IDE stuff -- don't know why)
11 -rw------- (IDE, some firewall stuff, some VM stuff)
52 dr-xr-xr-x
So it seems that the vast majority of cases can be boiled down to just
whether or not root is allowed to write.
As for data types, integer I/O (decimal and hex) seems to be very
common. String output is also frequent. We could potentially also do
range checked integers, string input, arrays... How useful would these
be? We'll still have the ability to pass function pointers for output,
and I'll be adding support for generic input too.
As I say, I'll try to put something better together over the
weekend. I'd be very interested in any more thoughts people have.
Cheers,
Matt
-
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/
This archive was generated by hypermail 2b29 : Sat Apr 15 2000 - 21:00:24 EST