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