Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 Mar 2000 21:53:49 -0800
From:      Alfred Perlstein <bright@wintelcom.net>
To:        "Gary T. Corcoran" <garycor@home.com>
Cc:        "Matthew N. Dodd" <winter@jurai.net>, freebsd-hackers@FreeBSD.ORG
Subject:   Re: How to read a file from a device driver?
Message-ID:  <20000317215349.G14789@fw.wintelcom.net>
In-Reply-To: <38D314B6.CEFED2E0@home.com>; from garycor@home.com on Sat, Mar 18, 2000 at 12:31:34AM -0500
References:  <Pine.BSF.4.21.0003172358410.50194-100000@sasami.jurai.net> <38D314B6.CEFED2E0@home.com>

next in thread | previous in thread | raw e-mail | index | archive | help
* Gary T. Corcoran <garycor@home.com> [000317 21:46] wrote:
> 
> "Matthew N. Dodd" wrote:
> > 
> > On Fri, 17 Mar 2000, Gary T. Corcoran wrote:
> > > I'm trying to initialize a network device, and I'm trying to download
> > > code *into* my device from some binary system files.  There is no
> > > "user space" or user process, for that matter, to deal with at this
> > > point. I just want to (at this step) open a file(s) directly from my
> > > device driver, read the file(s), and download the relevant parts to my
> > > device.
> > 
> > There isn't really any clean way of doing this so most drivers that need
> > to load firmware usually compile them in.  :/
> 
> Ugh.  This isn't the answer I was looking for...  :-(   ;-)
> I can do this in Windows (the original driver), I can do this in Linux
> (our new port) via a slight kluge which temporarily fiddles with the segment
> pointers (via standard system routines) to make it seem as if our driver's
> buffer is in user space so that the standard system read() can be called.
> 
> You mean I really can't do a relatively simple thing like read a file
> (which the _kernel_ really does, if you think about it) in my favorite
> operating system??  There's gotta be a way for a driver to do a read(),
> isn't there? :)  BTW, I did a search on the email archives, and Mike Smith
> implied that there *is* a way to read a file from a driver, but he only
> made a vague reference to a driver that did same, and I wasn't able to
> find any example code to give me a clue...

You're just going to have to grovel through the code somewhat,
sendfile is sort of useful but you must have an already open file
handle.  There's other code you can get to do that, like the quota
system (i'm pretty sure).

-- 
-Alfred Perlstein - [bright@wintelcom.net|alfred@freebsd.org]


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000317215349.G14789>