Home | History | Annotate | Line # | Download | only in boot
devopen.c revision 1.1.2.2
      1  1.1.2.2  nathanw /*	$NetBSD: devopen.c,v 1.1.2.2 2002/02/28 04:11:11 nathanw Exp $	*/
      2  1.1.2.2  nathanw 
      3  1.1.2.2  nathanw #include <sys/param.h>
      4  1.1.2.2  nathanw #include <stand.h>
      5  1.1.2.2  nathanw 
      6  1.1.2.2  nathanw /*
      7  1.1.2.2  nathanw  * Open the device named by the combined device/file name
      8  1.1.2.2  nathanw  * given as the "fname" arg, something like: "sd()bsd"
      9  1.1.2.2  nathanw  *
     10  1.1.2.2  nathanw  * However, Sun PROMs don't really let you choose which
     11  1.1.2.2  nathanw  * device you will talk to.  You can only open the device
     12  1.1.2.2  nathanw  * that was used to load the boot program.  Therefore, we
     13  1.1.2.2  nathanw  * do not accept a "device" part in the "fname" string.
     14  1.1.2.2  nathanw  * Pass the PROM device name to open in case it needs it.
     15  1.1.2.2  nathanw  */
     16  1.1.2.2  nathanw int
     17  1.1.2.2  nathanw devopen(f, fname, file)
     18  1.1.2.2  nathanw 	struct open_file *f;
     19  1.1.2.2  nathanw 	const char *fname;
     20  1.1.2.2  nathanw 	char **file;
     21  1.1.2.2  nathanw {
     22  1.1.2.2  nathanw 	struct devsw *dp;
     23  1.1.2.2  nathanw 	int error;
     24  1.1.2.2  nathanw 
     25  1.1.2.2  nathanw 	*file = (char*)fname;
     26  1.1.2.2  nathanw 	dp = &devsw[0];
     27  1.1.2.2  nathanw 	f->f_dev = dp;
     28  1.1.2.2  nathanw 	error = (*dp->dv_open)(f, "net");	/* XXXSCW: Fixme */
     29  1.1.2.2  nathanw 
     30  1.1.2.2  nathanw 	return (error);
     31  1.1.2.2  nathanw }
     32