1 1.1 chuck /* $NetBSD: devopen.c,v 1.1 1996/05/17 21:18:07 chuck 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 char *cp, *path, *devname; 24 1.1 chuck int error; 25 1.1 chuck 26 1.1 chuck *file = (char*)fname; 27 1.1 chuck dp = &devsw[0]; 28 1.1 chuck f->f_dev = dp; 29 1.1 chuck error = (*dp->dv_open)(f, NULL); 30 1.1 chuck 31 1.1 chuck return (error); 32 1.1 chuck } 33