From owner-freebsd-hackers Fri Mar 17 19:57:46 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from fw.wintelcom.net (ns1.wintelcom.net [209.1.153.20]) by hub.freebsd.org (Postfix) with ESMTP id BCEBF37B620 for ; Fri, 17 Mar 2000 19:57:43 -0800 (PST) (envelope-from bright@fw.wintelcom.net) Received: (from bright@localhost) by fw.wintelcom.net (8.10.0/8.10.0) id e2I4KJR01393; Fri, 17 Mar 2000 20:20:19 -0800 (PST) Date: Fri, 17 Mar 2000 20:20:19 -0800 From: Alfred Perlstein To: "Gary T. Corcoran" Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: How to read a file from a device driver? Message-ID: <20000317202018.C14789@fw.wintelcom.net> References: <38D2FF48.CE3E396B@home.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0.1i In-Reply-To: <38D2FF48.CE3E396B@home.com>; from garycor@home.com on Fri, Mar 17, 2000 at 11:00:08PM -0500 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG * Gary T. Corcoran [000317 20:16] wrote: > > Can someone please tell me how I can read a file from a device driver > in FreeBSD? I need to download 2 or 3 relatively-large code files to > my device, choosing from amongst several different files depending on > which mode I'm operating in. Therefore compiling-in the code is not > a reasonable choice. > > If you can either tell me how to be able to read a file from my driver, > or point me to an example driver which does this, I would appreciate it. > > I'm running FreeBSD 3.4. > > (not subscribed to this list, please always CC: me on replies) I hope i'm not advocating abusing an interface here, but here's what comes to mind... Use an ioctl in your driver to pass in a pointer to your user address space which depending on the ioctl request the size of the file be written to the pointer, or that the pointer is where the device should copyout() or use one of the functions from STORE(9) to dump into the user address space. -- -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