if (root_device == NULL) goto out;
setbootdev(){	struct dev_data *cdd, *dd;	int type, ctlr;	/*	 * Note our magic numbers for type:	 *	 *	0 == ct	 *	2 == hd	 *	4 == sd	 *	6 == le	 *	 * Allare bdevsw major numbers, except for le, which	 * is just special.	 *	 * We can't mount root on a tape, so we ignore those.	 */	/*	 * Start with a clean slate.	 */	bootdev = 0;	dd = dev_data_lookup(root_device);	/*	 * If the root device is network, we're done	 * early.	 */	if (root_device->dv_class == DV_IFNET) {		bootdev = MAKEBOOTDEV(6, 0, 0, 0, 0);		goto out;	}	/*	 * Determine device type.	 */	if (bcmp(root_device->dv_xname, "hd", 2) == 0)		type = 2;	else if (bcmp(root_device->dv_xname, "sd", 2) == 0)		type = 4;	else {		printf("WARNING: strange root device!\n");		goto out;	}	/*	 * Get parent's info.	 */	cdd = dev_data_lookup(root_device->dv_parent);	switch (type) {	case 2:		/*		 * "hd" -> "hpibbus" -> "fhpib"		 */		for (cdd = dev_data_list_hpib.lh_first, ctlr = 0;		    cdd != NULL; cdd = cdd->dd_clist.le_next, ctlr++) {			if (cdd->dd_dev == root_device->dv_parent->dv_parent) {				/*				 * Found it!				 */				bootdev = MAKEBOOTDEV(type,				    ctlr, dd->dd_slave, dd->dd_punit,				    DISKPART(rootdev));				break;			}		}		break;	case 4:		/*		 * "sd" -> "oscsi"		 */		for (cdd = dev_data_list_scsi.lh_first, ctlr = 0;		    cdd != NULL; cdd = cdd->dd_clist.le_next, ctlr++) { 			if (cdd->dd_dev == root_device->dv_parent) {				/*				 * Found it!				 */				bootdev = MAKEBOOTDEV(type,				    ctlr, dd->dd_slave, dd->dd_punit,				    DISKPART(rootdev));				break;			}		}		break;	} out:	/* Don't need this anymore. */	for (dd = dev_data_list.lh_first; dd != NULL; ) {		cdd = dd;		dd = dd->dd_list.le_next;		free(cdd, M_DEVBUF);	}}