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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux