Re: File access

From: Muli Ben-Yehuda
Date: Thu Aug 14 2003 - 07:32:36 EST


On Thu, Aug 14, 2003 at 03:19:17PM +0300, Matti Aarnio wrote:
> On Thu, Aug 14, 2003 at 12:32:18PM +0100, Simon Haynes wrote:
> > I am currently developing a module which I would like to configure
> > via a simple text file.
> >
> > I cannot seem to find any information on accessing files via a kernel
> > module.
> >
> > Is this possible and if so how is it done ?
>
> Yes, but it is rather complicated business, and really should not
> be done in kernel. It can be done, but like Richard said, defining
> your own set of IOCTLs for the device is better. The complicated
> configuration file parsing can then reside in the user-space utility
> program.

Indeed, do it in user space. But don't use ioctl unless it fits the
problem better than the other solutions. Use read / write on a device
file, or a special purpose file system, or sysfs, or even /proc. The
exact mechanism you should use depends on the nature of the user space
- kernel space communications.
--
Muli Ben-Yehuda
http://www.mulix.org

Attachment: pgp00001.pgp
Description: PGP signature