Re: the userspace side of driverfs

From: Miquel van Smoorenburg (miquels@cistron.nl)
Date: Wed Sep 11 2002 - 02:00:45 EST


In article <Pine.LNX.4.44.0209102122520.1057-100000@cherise.pdx.osdl.net>,
Patrick Mochel <mochel@osdl.org> wrote:
>The main ideal that we're shooting for is to have one ASCII value per
>file. The ASCII part is mandatory, but there will definitely be exceptions
>where we will have an array of or multiple values per file. We want to
>minimize those instances, though. Both for the sake of easy parsing, but
>also for easy formatting within the drivers.

If you have multiple values per file, why not make it a directory with
multiple files in it, each with one value per file.

If you care about speed, perhaps you can provide a ".array" virtual
file in such a (or each) directory, that when read returns all files
in the directory in "filename: value" format so that you avoid the
while (readdir()) { open(); close(); } overhead.

This would be much cleaner, think for example of how you would
otherwise _write_ individual entries in such an array.

If you really want to get overboard, provide a sysctl() like function
that can read the entries in driverfs in binary. Like the existing
sysctl() in linux, but with an added TYPE_INT, TYPE_STRING etc flag
for each value for consistency. It too should be able to read an
entire directory as an array.

Then, convert procfs to the same interface ;)

Mike.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Sep 15 2002 - 22:00:24 EST