while ((ncp = boot_get_path_component(cp, namebuf, &i)) != NULL) { if ((dp = boot_findtype(namebuf)) != NULL) { switch(dp->what) { case DEVMAP_TYPE: devname = dp->dev; break; case DEVMAP_UNIT: unit = i - 1 + offs; break; case DEVMAP_PART:
if (strncmp(cp, "dksc(", 5) == 0) { devname = "sd"; cp += 5; cp = boot_getnr(cp, &i); if (*cp == ',') { cp = boot_getnr(cp, &i); unit = i - 1; if (*cp == ',') { cp = boot_getnr(cp, &i);
makebootdev(const char *bp, int offs){	char namebuf[256];	const char *cp, *ncp, *ecp, *devname;	int	i, unit, partition;	struct devmap *dp;	ecp = cp = bp;	unit = partition = 0;	devname = NULL;	while ((ncp = boot_get_path_component(cp, namebuf, &i)) != NULL) {		if ((dp = boot_findtype(namebuf)) != NULL) {			switch(dp->what) {			case DEVMAP_TYPE:				devname = dp->dev;				break;			case DEVMAP_UNIT:				unit = i - 1 + offs;				break;			case DEVMAP_PART:				partition = i;				break;			}		}		cp = ncp;	}	if (devname == NULL) {		printf("Warning: boot device unrecognized: %s\n", bp);		return;	}	snprintf(bootdev, sizeof(bootdev), "%s%d%c", devname, unit, 'a');}