From owner-freebsd-hackers Mon Mar 20 19:34:11 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from mail.rdc1.nj.home.com (ha1.rdc1.nj.home.com [24.3.128.66]) by hub.freebsd.org (Postfix) with ESMTP id 8941037B82C for ; Mon, 20 Mar 2000 19:33:56 -0800 (PST) (envelope-from garycor@home.com) Received: from home.com ([24.3.185.85]) by mail.rdc1.nj.home.com (InterMail v4.01.01.00 201-229-111) with ESMTP id <20000321033355.ZSYC20681.mail.rdc1.nj.home.com@home.com>; Mon, 20 Mar 2000 19:33:55 -0800 Message-ID: <38D6EDD1.990EAF13@home.com> Date: Mon, 20 Mar 2000 22:34:41 -0500 From: "Gary T. Corcoran" X-Mailer: Mozilla 4.6 [en] (Win95; U) X-Accept-Language: en MIME-Version: 1.0 To: Darrell Anderson Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: How to read a file from a device driver? References: <200003201606.LAA12793@cold.cs.duke.edu> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Darrell, > > 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. > > sysctl might also do the trick. to answer your question, here's some code: > > struct vnode * > vp_open(char *fname) > { > struct vnode *vp; > struct nameidata nd; > int error; > > NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, fname, curproc); < rest of good code sample snipped - see previous message> This is great - thanks! One question though (since I'm new to FreeBSD drivers): Is "curproc" a global variable that will be set to the "right thing" while my device driver is executing? Presuming that it is, it looks like I can just take your sample code and run with it... :) Thanks, Gary To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message