Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 20 Mar 2000 22:34:41 -0500
From:      "Gary T. Corcoran" <garycor@home.com>
To:        Darrell Anderson <anderson@cs.duke.edu>
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: How to read a file from a device driver?
Message-ID:  <38D6EDD1.990EAF13@home.com>
References:  <200003201606.LAA12793@cold.cs.duke.edu>

next in thread | previous in thread | raw e-mail | index | archive | help

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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?38D6EDD1.990EAF13>