Home | History | Annotate | Line # | Download | only in netboot
devopen.c revision 1.2
      1  1.2  jdolecek /*	$NetBSD: devopen.c,v 1.2 2000/07/24 18:39:50 jdolecek 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.1     chuck devopen(f, fname, file)
     18  1.1     chuck 	struct open_file *f;
     19  1.1     chuck 	const char *fname;
     20  1.1     chuck 	char **file;
     21  1.1     chuck {
     22  1.1     chuck 	struct devsw *dp;
     23  1.1     chuck 	int error;
     24  1.1     chuck 
     25  1.1     chuck 	*file = (char*)fname;
     26  1.1     chuck 	dp = &devsw[0];
     27  1.1     chuck 	f->f_dev = dp;
     28  1.1     chuck 	error = (*dp->dv_open)(f, NULL);
     29  1.1     chuck 
     30  1.1     chuck 	return (error);
     31  1.1     chuck }
     32