[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <45B09EE0.8070404@aitel.hist.no>
Date: Fri, 19 Jan 2007 11:35:12 +0100
From: Helge Hafting <helge.hafting@...el.hist.no>
To: "linux-os (Dick Johnson)" <linux-os@...logic.com>
CC: Erik Mouw <erik@...ddisk-recovery.com>,
Jesper Juhl <jesper.juhl@...il.com>,
congwen <congwen@...il.com>,
linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: How can I create or read/write a file in linux device driver?
linux-os (Dick Johnson) wrote:
> Sometimes a idiot boss will say; "You need to read or write files from
> within the driver. If you don't do what I tell you, you are fired!"
>
To which the response is something like
"This is impossible/illegal/unsupported so it can't be done."
Fortunately, civilized countries have laws against being
fired for being unable to do the impossible.
Well, nothing is really impossible. Tell the boss about
the man-hours needed to implement a kernel file API
from scratch, and then forking the kernel
in order to maintain this community-rejected abomination
forever.
> Sigh, assuming you can't walk next door and get a reasonable job, it
> __is__ possible to unreliably access files within the kernel. Note
> that the kernel is __designed__ to perform user-mode operations, so
> it is a bit difficult.
Another way is to cheat. The boss asks the impossible, so
make a workaround in the form of a userspace program that
does the file writing while communicationg with the driver.
The driver installer software can then be made to install
this userspace program as well. Looks like a hack - but it
is the recommended way of doing these things. Often enough you
have a startup script for the thing anyway, a good place to
launch userspace helper apps. Either that, or userspace
will be involved somehow in using the device - launch the
helper at that time.
Try not to get in a situation where the boss explicitly asks
for files written from the kernel. If you're making a driver and
the boss ask for a file - just write that userspace helper
because that is the way it is done on linux. No conflict there.
Helge Hafting
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists