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