From owner-freebsd-hackers Fri Mar 17 23:49:34 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from gizmo.internode.com.au (gizmo.internode.com.au [192.83.231.115]) by hub.freebsd.org (Postfix) with ESMTP id 11C9037B5FD for ; Fri, 17 Mar 2000 23:49:30 -0800 (PST) (envelope-from newton@gizmo.internode.com.au) Received: (from newton@localhost) by gizmo.internode.com.au (8.9.3/8.9.3) id SAA74957; Sat, 18 Mar 2000 18:20:11 +1030 (CST) (envelope-from newton) Date: Sat, 18 Mar 2000 18:20:11 +1030 From: Mark Newton To: "Gary T. Corcoran" Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: How to read a file from a device driver? Message-ID: <20000318182011.B74104@internode.com.au> References: <38D2FF48.CE3E396B@home.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0pre3i In-Reply-To: <38D2FF48.CE3E396B@home.com> X-PGP-Key: http://www.on.net/~newton/pgpkey.txt Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Fri, Mar 17, 2000 at 11:00:08PM -0500, Gary T. Corcoran 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. Defer the initialization of the device until a user-mode process opens it and performs an ioctl() on it. The ioctl should take a (void *) to a buffer containing a structure which says how long the code is, followed by the code itself. That avoids the whole problem of reading a file from your driver, you can do it with a user-mode helper process. > 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 think the Stallion serial port drivers do something kinda similar. - mark -- Mark Newton Email: newton@internode.com.au (W) Network Engineer Email: newton@atdot.dotat.org (H) Internode Systems Pty Ltd Desk: +61-8-82232999 "Network Man" - Anagram of "Mark Newton" Mobile: +61-416-202-223 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message