From mboxrd@z Thu Jan 1 00:00:00 1970 From: greg@kroah.com (Greg KH) Date: Thu, 6 Oct 2011 20:09:26 -0700 Subject: How to open and write to a block driver within a character driver? In-Reply-To: References: <20111004174618.GA12193@kroah.com> <20111004180409.GA15163@kroah.com> Message-ID: <20111007030926.GB25556@kroah.com> To: kernelnewbies@lists.kernelnewbies.org List-Id: kernelnewbies.lists.kernelnewbies.org 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