Home | History | Annotate | Line # | Download | only in netboot
      1  1.3  tsutsui /*	$NetBSD: devopen.c,v 1.3 2008/01/12 09:54:32 tsutsui 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.3  tsutsui 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.3  tsutsui 	*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.3  tsutsui 	return error;
     28  1.1    chuck }
     29