Re: How can I create or read/write a file in linux device driver?

From: Jan Engelhardt
Date: Fri Jan 12 2007 - 17:34:56 EST



On Jan 12 2007 09:27, linux-os (Dick Johnson) wrote:
>
>First, since file-operations require process context, and the kernel
>is not a process, you need to create a kernel thread to handle your file
>I/O.

Not always. If you do file I/O as part of a device driver, you are fine.
quad_dsp is such an example, where writing to /dev/Qdsp_* will trigger writes
to /dev/dsp and /dev/adsp.

>Once you set up this "internal environment," you use the appropriate
>kernel function(s) such as sys_open()

What against filp_open? That avoids the unnecessary getname() stuff in most
syscalls.


-`J'
--
-
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/