How to open and write to a block driver within a character driver?

Greg KH greg at kroah.com
Thu Oct 6 23:09:26 EDT 2011


On Thu, Oct 06, 2011 at 03:43:08PM -0700, Yang Xiang wrote:
> Hi Greg,
> 
> Let me rephrase my question then.
> 
> If I am in kernel space and in another device driver and I need to write a log
> entry of some sort to another block device, do I just perform an "open" and
> "write" as if I am in user space?

No, you never do that, no device driver ever opens a file and writes to
it.  It's that simple.

Please see the kernelnewbies.org site for more details about why this is
so.

greg k-h



More information about the Kernelnewbies mailing list