Subject: Re: File I/O in hardware device driver
To: Eduardo Horvath <eeh@turbolinux.com>
From: Matthew Jacob <mjacob@feral.com>
List: tech-kern
Date: 07/28/2000 11:31:18
On Fri, 28 Jul 2000, Eduardo Horvath wrote:

> 
> What ARE you doing?
> 
> On Fri, 28 Jul 2000, Steven Grunza wrote:
> 
> > Two possible problems with my driver just occurred to me:
> > 
> > 1)  Doing file IO from a hardware device driver might not be a good
> > idea.  Is it legal for an IOCTL to my driver to provide the name of a
> > file which my driver then opens with your typical open() or fopen() type
> > of call?
> 
> That is not a good thing to do.  A driver should not be opening
> files.  That's for applications to do.

For shame, Eduardo! And you know as well as I do that this is exactly what the
kobj modules do in Solaris when they read /etc/system (and the .conf files).

It's not a *great* idea for drivers to do this, but there's nothing wrong with
it, per se. There's no strongly type DDI/DKI in NetBSD, so there isn't even a
John Lee or David Kahn to come scream at you if you *do* use sys_open...