Re: 26 ways to set a device driver variable from userland

From: Greg KH
Date: Wed Oct 19 2005 - 23:20:50 EST


On Wed, Oct 19, 2005 at 12:35:27PM -0600, Christopher Friesen wrote:
> Kyle Moffett wrote:
>
> >>(4) sysfs
>
> >This is ideal for almost all device driver purposes.
>
> The one thing that I have yet to see a good solution for is
> transaction-based operations, where userspace passes in something (could
> be a command, a new value, a query, etc.) and expects some data in return.
>
> The ioctl() method is ideal for this, passing down a binary struct with
> a command/query member, and the driver fills in the rest of the struct
> based on the commnd.
>
> How do you do this cleanly via sysfs? It seems like you either double
> the number of syscalls (write to one file, read from another) or else
> you need to have sysfs files for every possible query/command, so that
> the input becomes implicitly encoded in the file that you are reading.
> This could end up creating a large number of files depending on the
> range of inputs.
>
> Are there any other standard ways to do this?

Take a look at configfs, as part of the ocfs2 patches in the -mm tree.
It is set up to help solve this using a filesystem much like sysfs.

thanks,

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