/* * Attempt to read a disk label from a device * using the indicated strategy routine. * The label must be partly set up before this: * secpercyl, secsize and anything required for a block i/o read * operation in the driver's strategy/start routines * must be filled in before calling us. * * If dos partition table requested, attempt to load it and * find disklabel inside a DOS partition. * * We would like to check if each MBR has a valid DOSMBR_SIGNATURE, but * we cannot because it doesn't always exist. So.. we assume the * MBR is valid. */ int readdisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp, int spoofonly) { bios_diskinfo_t *pdi; struct buf *bp = NULL; dev_t devno; int error; if ((error = initdisklabel(lp))) goto done; /* Look for any BIOS geometry information we should honour. */ devno = chrtoblk(dev); if (devno == NODEV) devno = dev; pdi = bios_getdiskinfo(MAKEBOOTDEV(major(devno), 0, 0, DISKUNIT(devno), RAW_PART)); if (pdi != NULL && pdi->bios_heads > 0 && pdi->bios_sectors > 0) { #ifdef DEBUG printf("Disk GEOM %u/%u/%u -> BIOS GEOM %u/%u/%u\n", lp->d_ntracks, lp->d_nsectors, lp->d_ncylinders, pdi->bios_heads, pdi->bios_sectors, DL_GETDSIZE(lp) / (pdi->bios_heads * pdi->bios_sectors)); #endif lp->d_ntracks = pdi->bios_heads; lp->d_nsectors = pdi->bios_sectors; lp->d_secpercyl = pdi->bios_sectors * pdi->bios_heads; lp->d_ncylinders = DL_GETDSIZE(lp) / lp->d_secpercyl; } /* get a buffer and initialize it */ bp = geteblk((int)lp->d_secsize); bp->b_dev = dev; error = readdoslabel(bp, strat, lp, NULL, spoofonly); if (error == 0) goto done; #if defined(CD9660) error = iso_disklabelspoof(dev, strat, lp); if (error == 0) goto done; #endif #if defined(UDF) error = udf_disklabelspoof(dev, strat, lp); if (error == 0) goto done; #endif done: if (bp) { bp->b_flags |= B_INVAL; brelse(bp); } disk_change = 1; return (error); }
main(dev, unit, off) { register struct disklabel *lp; register int io, partition, howto; /* are we a disk, if so look at disklabel and do things */ lp = &disklabel; if (lp->d_magic == DISKMAGIC) { /* * Synthesize bootdev from dev, unit, type and partition * information from the block 0 bootstrap. * It's dirty work, but someone's got to do it. * This will be used by the filesystem primatives, and * drivers. Ultimately, opendev will be created corresponding * to which drive to pass to top level bootstrap. */ for (io = 0; io < 8; io++) #ifdef notyetSCSI if (lp->d_type == DTYPE_SCSI) { if (lp->d_partitions[io].p_offset == off) break; } else #endif if (lp->d_partitions[io].p_offset == off*lp->d_secpercyl) break; if (io == 8) goto screwed; cyloffset = off; } else { screwed: /* probably a bad or non-existant disklabel */ io = 0 ; howto |= RB_SINGLE|RB_ASKNAME ; } /* construct bootdev */ /* currently, PC has no way of booting off alternate controllers */ bootdev = MAKEBOOTDEV(/*i_dev*/ dev, /*i_adapt*/0, /*i_ctlr*/0, unit, /*i_part*/io); printf("loading %s\n", bootprog); io = open(bootprog, 0); if (io >= 0) copyunix(io, howto); _stop("boot failed\n"); }
/* * push_stack * * Creates the boot stack page in the guest address space. When using a real * bootloader, the stack will be prepared using the following format before * transitioning to kernel start, so vmd(8) needs to mimic the same stack * layout. The stack content is pushed to the guest phys RAM at address * STACK_PAGE. The bootloader operates in 32 bit mode; each stack entry is * 4 bytes. * * Stack Layout: (TOS == Top Of Stack) * TOS location of boot arguments page * TOS - 0x4 size of the content in the boot arguments page * TOS - 0x8 size of low memory (biosbasemem: kernel uses BIOS map only if 0) * TOS - 0xc size of high memory (biosextmem, not used by kernel at all) * TOS - 0x10 kernel 'end' symbol value * TOS - 0x14 version of bootarg API * * Parameters: * bootargsz: size of boot arguments * end: kernel 'end' symbol value * * Return values: * size of the stack */ static size_t push_stack(uint32_t bootargsz, uint32_t end) { uint32_t stack[1024]; uint16_t loc; memset(&stack, 0, sizeof(stack)); loc = 1024; stack[--loc] = BOOTARGS_PAGE; stack[--loc] = bootargsz; stack[--loc] = 0; /* biosbasemem */ stack[--loc] = 0; /* biosextmem */ stack[--loc] = end; stack[--loc] = 0x0e; stack[--loc] = MAKEBOOTDEV(0x4, 0, 0, 0, 0); /* bootdev: sd0a */ stack[--loc] = 0x0; write_mem(STACK_PAGE, &stack, PAGE_SIZE); return (1024 - (loc - 1)) * sizeof(uint32_t); }
/* Probe for all BIOS floppies */ static void floppyprobe(void) { struct diskinfo *dip; int i; /* Floppies */ for(i = 0; i < 4; i++) { dip = alloc(sizeof(struct diskinfo)); bzero(dip, sizeof(*dip)); if(bios_getdiskinfo(i, &dip->bios_info)) { #ifdef BIOS_DEBUG if (debug) printf(" <!fd%u>", i); #endif free(dip, 0); break; } printf(" fd%u", i); /* Fill out best we can - (fd?) */ dip->bios_info.bsd_dev = MAKEBOOTDEV(2, 0, 0, i, RAW_PART); /* * Delay reading the disklabel until we're sure we want * to boot from the floppy. Doing this avoids a delay * (sometimes very long) when trying to read the label * and the drive is unplugged. */ dip->bios_info.flags |= BDI_BADLABEL; /* Add to queue of disks */ TAILQ_INSERT_TAIL(&disklist, dip, list); } }
static void setbootdev(void) { struct dev_data *cdd, *dd; int type, ctlr; /* * Note our magic numbers for type: * * 0 == ct * 2 == rd * 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; /* * If the root device is network, we're done * early. */ if (device_class(root_device) == DV_IFNET) { bootdev = MAKEBOOTDEV(6, 0, 0, 0, 0); goto out; } /* * Determine device type. */ if (device_is_a(root_device, "rd")) type = 2; else if (device_is_a(root_device, "sd")) type = 4; else if (device_is_a(root_device, "md")) goto out; else { printf("WARNING: strange root device!\n"); goto out; } dd = dev_data_lookup(root_device); /* * Get parent's info. */ switch (type) { case 2: /* rd */ case 4: /* sd */ /* * "rd" -> "hpibbus" -> "fhpib" * "sd" -> "scsibus" -> "spc" */ for (cdd = LIST_FIRST(&dev_data_list_hpib), ctlr = 0; cdd != NULL; cdd = LIST_NEXT(cdd, dd_clist), ctlr++) { if (cdd->dd_dev == device_parent(device_parent(root_device))) { /* * Found it! */ bootdev = MAKEBOOTDEV(type, ctlr, dd->dd_slave, dd->dd_punit, DISKPART(rootdev)); break; } } break; } out: /* Don't need this anymore. */ for (dd = LIST_FIRST(&dev_data_list); dd != NULL; ) { cdd = dd; dd = LIST_NEXT(dd, dd_list); free(cdd, M_DEVBUF); } }
static void load(void) { union { struct exec ex; Elf32_Ehdr eh; } hdr; Elf32_Phdr ep[2]; Elf32_Shdr es[2]; caddr_t p; ino_t ino; uint32_t addr, x; int fmt, i, j; if (!(ino = lookup(kname))) { if (!ls) printf("No %s\n", kname); return; } if (xfsread(ino, &hdr, sizeof(hdr))) return; if (N_GETMAGIC(hdr.ex) == ZMAGIC) fmt = 0; else if (IS_ELF(hdr.eh)) fmt = 1; else { printf("Invalid %s\n", "format"); return; } if (fmt == 0) { addr = hdr.ex.a_entry & 0xffffff; p = PTOV(addr); fs_off = PAGE_SIZE; if (xfsread(ino, p, hdr.ex.a_text)) return; p += roundup2(hdr.ex.a_text, PAGE_SIZE); if (xfsread(ino, p, hdr.ex.a_data)) return; p += hdr.ex.a_data + roundup2(hdr.ex.a_bss, PAGE_SIZE); bootinfo.bi_symtab = VTOP(p); memcpy(p, &hdr.ex.a_syms, sizeof(hdr.ex.a_syms)); p += sizeof(hdr.ex.a_syms); if (hdr.ex.a_syms) { if (xfsread(ino, p, hdr.ex.a_syms)) return; p += hdr.ex.a_syms; if (xfsread(ino, p, sizeof(int))) return; x = *(uint32_t *)p; p += sizeof(int); x -= sizeof(int); if (xfsread(ino, p, x)) return; p += x; } } else { fs_off = hdr.eh.e_phoff; for (j = i = 0; i < hdr.eh.e_phnum && j < 2; i++) { if (xfsread(ino, ep + j, sizeof(ep[0]))) return; if (ep[j].p_type == PT_LOAD) j++; } for (i = 0; i < 2; i++) { p = PTOV(ep[i].p_paddr & 0xffffff); fs_off = ep[i].p_offset; if (xfsread(ino, p, ep[i].p_filesz)) return; } p += roundup2(ep[1].p_memsz, PAGE_SIZE); bootinfo.bi_symtab = VTOP(p); if (hdr.eh.e_shnum == hdr.eh.e_shstrndx + 3) { fs_off = hdr.eh.e_shoff + sizeof(es[0]) * (hdr.eh.e_shstrndx + 1); if (xfsread(ino, &es, sizeof(es))) return; for (i = 0; i < 2; i++) { memcpy(p, &es[i].sh_size, sizeof(es[i].sh_size)); p += sizeof(es[i].sh_size); fs_off = es[i].sh_offset; if (xfsread(ino, p, es[i].sh_size)) return; p += es[i].sh_size; } } addr = hdr.eh.e_entry & 0xffffff; } bootinfo.bi_esymtab = VTOP(p); bootinfo.bi_kernelname = VTOP(kname); bootinfo.bi_bios_dev = dsk.drive; __exec((caddr_t)addr, opts & RBX_MASK, MAKEBOOTDEV(dev_maj[dsk.type], 0, dsk.slice, dsk.unit, dsk.part), 0, 0, 0, VTOP(&bootinfo)); }
void dkcsumattach(void) { struct device *dv; struct buf *bp; struct bdevsw *bdsw; dev_t dev; int error; u_int32_t csum; bios_diskinfo_t *bdi, *hit; /* do nothing if no diskinfo passed from /boot, or a bad length */ if (bios_diskinfo == NULL || bios_cksumlen * DEV_BSIZE > MAXBSIZE) return; /* * XXX Whatif DEV_BSIZE is changed to something else than the BIOS * blocksize? Today, /boot doesn't cover that case so neither need * I care here. */ bp = geteblk(bios_cksumlen * DEV_BSIZE); /* XXX error check? */ for (dv = alldevs.tqh_first; dv; dv = dv->dv_list.tqe_next) { if (dv->dv_class != DV_DISK) continue; bp->b_dev = dev = dev_rawpart(dv); if (dev == NODEV) continue; bdsw = &bdevsw[major(dev)]; /* * This open operation guarantees a proper initialization * of the device, for future strategy calls. */ error = (*bdsw->d_open)(dev, FREAD, S_IFCHR, curproc); if (error) { /* XXX What to do here? */ if (error != EIO) printf("dkcsum: open of %s failed (%d)\n", dv->dv_xname, error); continue; } /* Read blocks to cksum. XXX maybe a d_read should be used. */ bp->b_blkno = 0; bp->b_bcount = bios_cksumlen * DEV_BSIZE; bp->b_flags = B_BUSY | B_READ; bp->b_cylin = 0; (*bdsw->d_strategy)(bp); if (biowait(bp)) { /* XXX What to do here? */ printf("dkcsum: read of %s failed (%d)\n", dv->dv_xname, error); error = (*bdsw->d_close)(dev, 0, S_IFCHR, curproc); if (error) printf("dkcsum: close of %s failed (%d)\n", dv->dv_xname, error); continue; } error = (*bdsw->d_close)(dev, FREAD, S_IFCHR, curproc); if (error) { /* XXX What to do here? */ printf("dkcsum: close of %s failed (%d)\n", dv->dv_xname, error); continue; } csum = adler32(0, bp->b_data, bios_cksumlen * DEV_BSIZE); #ifdef DEBUG printf("dkcsum: checksum of %s is %x\n", dv->dv_xname, csum); #endif /* Find the BIOS device */ hit = 0; for (bdi = bios_diskinfo; bdi->bios_number != -1; bdi++) { /* Skip non-harddrives */ if (!(bdi->bios_number & 0x80)) continue; #ifdef DEBUG printf("dkcsum: " "attempting to match with BIOS drive %x csum %x\n", bdi->bios_number, bdi->checksum); #endif if (bdi->checksum == csum) { if (!hit && !(bdi->flags & BDI_PICKED)) hit = bdi; else { /* XXX add other heuristics here. */ printf("dkcsum: warning: " "dup BSD->BIOS disk mapping\n"); } } } /* * If we have no hit, that's OK, we can see a lot more devices * than the BIOS can, so this case is pretty normal. */ if (hit) { #ifdef DIAGNOSTIC printf("dkcsum: %s matched BIOS disk %x\n", dv->dv_xname, hit->bios_number); #endif } else { #ifdef DIAGNOSTIC printf("dkcsum: %s had no matching BIOS disk\n", dv->dv_xname); #endif continue; } /* Fixup bootdev if units match. This means that all of * hd*, sd*, wd*, will be interpreted the same. Not 100% * backwards compatible, but sd* and wd* should be phased- * out in the bootblocks. */ if (B_UNIT(bootdev) == (hit->bios_number & 0x7F)) { int type, ctrl, adap, part, unit; /* Translate to MAKEBOOTDEV() style */ type = major(bp->b_dev); adap = B_ADAPTOR(bootdev); ctrl = B_CONTROLLER(bootdev); unit = DISKUNIT(bp->b_dev); part = B_PARTITION(bootdev); bootdev = MAKEBOOTDEV(type, ctrl, adap, unit, part); } /* This will overwrite /boot's guess, just so you remember */ hit->bsd_dev = MAKEBOOTDEV(major(bp->b_dev), 0, 0, DISKUNIT(bp->b_dev), RAW_PART); hit->flags |= BDI_PICKED; } bp->b_flags |= B_INVAL; brelse(bp); }
int devopen(struct open_file *f, const char *fname, char **file) { int error; int dev, adapt, ctlr, unit, part; struct devsw *dp = &devsw[0]; dev = B_TYPE(bootdev); adapt = B_ADAPTOR(bootdev); ctlr = B_CONTROLLER(bootdev); unit = B_UNIT(bootdev); part = B_PARTITION(bootdev); if ((error = devparse(fname, &dev, &adapt, &ctlr, &unit, &part, file))) return(error); /* * Set up filesystem type based on what device we're opening. */ switch (dev) { case 0: /* ct */ bcopy(file_system_rawfs, file_system, sizeof(struct fs_ops)); break; case 2: /* hd */ bcopy(file_system_ufs, file_system, sizeof(struct fs_ops)); break; case 4: /* sd */ bcopy(file_system_ufs, file_system, sizeof(struct fs_ops)); bcopy(file_system_cd9660, &file_system[1], sizeof(struct fs_ops)); nfsys = 2; break; case 6: /* le */ bcopy(file_system_nfs, file_system, sizeof(struct fs_ops)); break; default: /* XXX what else should we do here? */ printf("WARNING: BOGUS BOOT DEV TYPE 0x%x!\n", dev); return (EIO); } dp = &devsw[dev]; if (!dp->dv_open) return(ENODEV); f->f_dev = dp; if ((error = (*dp->dv_open)(f, adapt, ctlr, part)) == 0) { if ((error = (*punitsw[dev].p_punit)(adapt, ctlr, &unit)) != 0) { goto bad; } opendev = MAKEBOOTDEV(dev, adapt, ctlr, unit, part); return(0); } bad: printf("%s(%d,%d,%d,%d): %s\n", devsw[dev].dv_name, adapt, ctlr, unit, part, strerror(error)); return(error); }
main(dev, unit, off) { register struct disklabel *lp; register int io; register char **bootfile = files; int howto = 0; extern int scsisn; /* XXX */ /* are we a disk, if so look at disklabel and do things */ lp = &disklabel; if (lp->d_type == DTYPE_SCSI) /* XXX */ off = htonl(scsisn); /* XXX */ /*printf("cyl %x %x hd %x sect %x ", biosparams[0], biosparams[1], biosparams[2], biosparams[0xe]); printf("dev %x unit %x off %d\n", dev, unit, off);*/ if (lp->d_magic == DISKMAGIC) { /* * Synthesize bootdev from dev, unit, type and partition * information from the block 0 bootstrap. * It's dirty work, but someone's got to do it. * This will be used by the filesystem primatives, and * drivers. Ultimately, opendev will be created corresponding * to which drive to pass to top level bootstrap. */ for (io = 0; io < lp->d_npartitions; io++) { int sn; if (lp->d_partitions[io].p_size == 0) continue; if (lp->d_type == DTYPE_SCSI) sn = off; else sn = off * lp->d_secpercyl; if (lp->d_partitions[io].p_offset == sn) break; } if (io == lp->d_npartitions) goto screwed; cyloffset = off; } else { screwed: /* probably a bad or non-existant disklabel */ io = 0 ; howto |= RB_SINGLE|RB_ASKNAME ; } /* construct bootdev */ /* currently, PC has no way of booting off alternate controllers */ bootdev = MAKEBOOTDEV(/*i_dev*/ dev, /*i_adapt*/0, /*i_ctlr*/0, unit, /*i_part*/io); for (;;) { /*printf("namei %s", *bootfile);*/ io = namei(*bootfile); if (io > 2) { copyunix(io, howto, off); } else printf("File not found"); printf(" - didn't load %s, ",*bootfile); if(*++bootfile == 0) bootfile = files; printf("will try %s\n", *bootfile); wait(1<<((retry++) + 10)); } }
/* * Early initialization, before main() is called. */ void luna68k_init(void) { volatile uint8_t *pio0 = (void *)0x49000000; int sw1, i; char *cp; extern char bootarg[64]; extern paddr_t avail_start, avail_end; /* initialize cn_tab for early console */ #if 1 cn_tab = &syscons; #else cn_tab = &romcons; #endif /* * Tell the VM system about available physical memory. The * luna68k only has one segment. */ uvm_page_physload(atop(avail_start), atop(avail_end), atop(avail_start), atop(avail_end), VM_FREELIST_DEFAULT); /* * Initialize error message buffer (at end of core). * avail_end was pre-decremented in pmap_bootstrap to compensate. */ for (i = 0; i < btoc(MSGBUFSIZE); i++) pmap_kenter_pa((vaddr_t)msgbufaddr + i * PAGE_SIZE, avail_end + i * PAGE_SIZE, VM_PROT_READ|VM_PROT_WRITE, 0); pmap_update(pmap_kernel()); initmsgbuf(msgbufaddr, m68k_round_page(MSGBUFSIZE)); pio0[3] = 0xb6; pio0[2] = 1 << 6; /* enable parity check */ pio0[3] = 0xb6; sw1 = pio0[0]; /* dip sw1 value */ sw1 ^= 0xff; sysconsole = !(sw1 & 0x2); /* console selection */ /* * Check if boothowto and bootdev values are passed by our bootloader. */ if ((bootdev & B_MAGICMASK) == B_DEVMAGIC) { /* Valid value is set; no need to parse bootarg. */ return; } /* * No valid bootdev value is set. * Assume we are booted by ROM monitor directly using a.out kernel * and we have to parse bootarg passed from the monitor to set * proper boothowto and check netboot. */ /* set default to "sd0a" with no howto flags */ bootdev = MAKEBOOTDEV(0, LUNA68K_BOOTADPT_SPC, 0, 0, 0); boothowto = 0; /* * 'bootarg' on LUNA has: * "<args of x command> ENADDR=<addr> HOST=<host> SERVER=<name>" * where <addr> is MAC address of which network loader used (not * necessarily same as one at 0x4101.FFE0), <host> and <name> * are the values of HOST and SERVER environment variables. * * 'bootarg' on LUNA-II has "<args of x command>" only. * * NetBSD/luna68k cares only the first argment; any of "sda". */ bootarg[63] = '\0'; for (cp = bootarg; *cp != '\0'; cp++) { if (*cp == '-') { char c; while ((c = *cp) != '\0' && c != ' ') { BOOT_FLAG(c, boothowto); cp++; } } else if (*cp == 'E' && memcmp("ENADDR=", cp, 7) == 0) { bootdev = MAKEBOOTDEV(0, LUNA68K_BOOTADPT_LANCE, 0, 0, 0); } } }
/* Probe for all BIOS hard disks */ static void hardprobe(void) { struct diskinfo *dip; int i; u_int bsdunit, type; u_int scsi = 0, ide = 0; const char *dc = (const char *)((0x40 << 4) + 0x75); /* Hard disks */ for (i = 0x80; i < (0x80 + *dc); i++) { dip = alloc(sizeof(struct diskinfo)); bzero(dip, sizeof(*dip)); if(bios_getdiskinfo(i, &dip->bios_info)) { #ifdef BIOS_DEBUG if (debug) printf(" <!hd%u>", i&0x7f); #endif free(dip, 0); break; } printf(" hd%u%s", i&0x7f, (dip->bios_info.bios_edd > 0?"+":"")); /* Try to find the label, to figure out device type */ if((bios_getdisklabel(&dip->bios_info, &dip->disklabel)) ) { printf("*"); bsdunit = ide++; type = 0; /* XXX let it be IDE */ } else { /* Best guess */ switch (dip->disklabel.d_type) { case DTYPE_SCSI: type = 4; bsdunit = scsi++; dip->bios_info.flags |= BDI_GOODLABEL; break; case DTYPE_ESDI: case DTYPE_ST506: type = 0; bsdunit = ide++; dip->bios_info.flags |= BDI_GOODLABEL; break; default: dip->bios_info.flags |= BDI_BADLABEL; type = 0; /* XXX Suggest IDE */ bsdunit = ide++; } } dip->bios_info.checksum = 0; /* just in case */ /* Fill out best we can */ dip->bios_info.bsd_dev = MAKEBOOTDEV(type, 0, 0, bsdunit, RAW_PART); /* Add to queue of disks */ TAILQ_INSERT_TAIL(&disklist, dip, list); } }
void cdprobe(void) { struct diskinfo *dip; int cddev = bios_cddev & 0xff; /* Another BIOS boot device... */ if (bios_cddev == -1) /* Not been set, so don't use */ return; dip = alloc(sizeof(struct diskinfo)); bzero(dip, sizeof(*dip)); #if 0 if (bios_getdiskinfo(cddev, &dip->bios_info)) { printf(" <!cd0>"); /* XXX */ free(dip, 0); return; } #endif printf(" cd0"); dip->bios_info.bios_number = cddev; dip->bios_info.bios_edd = 1; /* Use the LBA calls */ dip->bios_info.flags |= BDI_GOODLABEL | BDI_EL_TORITO; dip->bios_info.checksum = 0; /* just in case */ dip->bios_info.bsd_dev = MAKEBOOTDEV(6, 0, 0, 0, RAW_PART); /* Create an imaginary disk label */ dip->disklabel.d_secsize = 2048; dip->disklabel.d_ntracks = 1; dip->disklabel.d_nsectors = 100; dip->disklabel.d_ncylinders = 1; dip->disklabel.d_secpercyl = dip->disklabel.d_ntracks * dip->disklabel.d_nsectors; if (dip->disklabel.d_secpercyl == 0) { dip->disklabel.d_secpercyl = 100; /* as long as it's not 0, since readdisklabel divides by it */ } strncpy(dip->disklabel.d_typename, "ATAPI CD-ROM", sizeof(dip->disklabel.d_typename)); dip->disklabel.d_type = DTYPE_ATAPI; strncpy(dip->disklabel.d_packname, "fictitious", sizeof(dip->disklabel.d_packname)); dip->disklabel.d_secperunit = 100; dip->disklabel.d_bbsize = 2048; dip->disklabel.d_sbsize = 2048; /* 'a' partition covering the "whole" disk */ dip->disklabel.d_partitions[0].p_offset = 0; dip->disklabel.d_partitions[0].p_size = 100; dip->disklabel.d_partitions[0].p_fstype = FS_UNUSED; /* The raw partition is special */ dip->disklabel.d_partitions[RAW_PART].p_offset = 0; dip->disklabel.d_partitions[RAW_PART].p_size = 100; dip->disklabel.d_partitions[RAW_PART].p_fstype = FS_UNUSED; dip->disklabel.d_npartitions = MAXPARTITIONS; dip->disklabel.d_magic = DISKMAGIC; dip->disklabel.d_magic2 = DISKMAGIC; dip->disklabel.d_checksum = dkcksum(&dip->disklabel); /* Add to queue of disks */ TAILQ_INSERT_TAIL(&disklist, dip, list); }