LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Helge Hafting <helge.hafting@aitel.hist.no>
To: "linux-os (Dick Johnson)" <linux-os@analogic.com>
Cc: Erik Mouw <erik@harddisk-recovery.com>,
	Jesper Juhl <jesper.juhl@gmail.com>, congwen <congwen@gmail.com>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: How can I create or read/write a file in linux device driver?
Date: Fri, 19 Jan 2007 11:35:12 +0100	[thread overview]
Message-ID: <45B09EE0.8070404@aitel.hist.no> (raw)
In-Reply-To: <Pine.LNX.4.61.0701120907430.23919@chaos.analogic.com>

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







      parent reply	other threads:[~2007-01-19 10:37 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-12  7:47 congwen
2007-01-12 10:27 ` Jesper Juhl
2007-01-12 10:43   ` Jan Engelhardt
2007-01-12 10:54     ` Jesper Juhl
2007-01-12 10:59       ` Jan Engelhardt
2007-01-12 13:24   ` Erik Mouw
2007-01-12 14:27     ` linux-os (Dick Johnson)
2007-01-12 14:42       ` Erik Mouw
2007-01-12 22:31       ` Jan Engelhardt
2007-01-19 10:35       ` Helge Hafting [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=45B09EE0.8070404@aitel.hist.no \
    --to=helge.hafting@aitel.hist.no \
    --cc=congwen@gmail.com \
    --cc=erik@harddisk-recovery.com \
    --cc=jesper.juhl@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-os@analogic.com \
    --subject='Re: How can I create or read/write a file in linux device driver?' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).