summaryrefslogtreecommitdiff
path: root/sys/dev/isa/mcd.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/isa/mcd.c')
-rw-r--r--sys/dev/isa/mcd.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/sys/dev/isa/mcd.c b/sys/dev/isa/mcd.c
index 0c13c11d319..64ec2eee784 100644
--- a/sys/dev/isa/mcd.c
+++ b/sys/dev/isa/mcd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mcd.c,v 1.17 1996/09/20 06:08:10 deraadt Exp $ */
+/* $OpenBSD: mcd.c,v 1.18 1996/12/05 13:15:28 deraadt Exp $ */
/* $NetBSD: mcd.c,v 1.49 1996/05/12 23:53:11 mycroft Exp $ */
/*
@@ -90,6 +90,7 @@
#define MCDPART(dev) DISKPART(dev)
#define MCDUNIT(dev) DISKUNIT(dev)
+#define MAKEMCDDEV(maj, unit, part) MAKEDISKDEV(maj, unit, part)
/* toc */
#define MCD_MAXTOCS 104 /* from the Linux driver */
@@ -679,6 +680,7 @@ mcdgetdisklabel(sc)
struct mcd_softc *sc;
{
struct disklabel *lp = sc->sc_dk.dk_label;
+ char *errstring;
bzero(lp, sizeof(struct disklabel));
bzero(sc->sc_dk.dk_cpulabel, sizeof(struct cpu_disklabel));
@@ -688,28 +690,38 @@ mcdgetdisklabel(sc)
lp->d_nsectors = 100;
lp->d_ncylinders = (sc->disksize / 100) + 1;
lp->d_secpercyl = lp->d_ntracks * lp->d_nsectors;
+ if (lp->d_secpercyl == 0) {
+ lp->d_secpercyl = 100;
+ /* as long as it's not 0 - readdisklabel divides by it (?) */
+ }
strncpy(lp->d_typename, "Mitsumi CD-ROM", 16);
- lp->d_type = 0; /* XXX */
+ lp->d_type = DTYPE_SCSI; /* XXX */
strncpy(lp->d_packname, "fictitious", 16);
lp->d_secperunit = sc->disksize;
lp->d_rpm = 300;
lp->d_interleave = 1;
lp->d_flags = D_REMOVABLE;
- lp->d_partitions[0].p_offset = 0;
- lp->d_partitions[0].p_size =
- lp->d_secperunit * (lp->d_secsize / DEV_BSIZE);
- lp->d_partitions[0].p_fstype = FS_ISO9660;
lp->d_partitions[RAW_PART].p_offset = 0;
lp->d_partitions[RAW_PART].p_size =
lp->d_secperunit * (lp->d_secsize / DEV_BSIZE);
- lp->d_partitions[RAW_PART].p_fstype = FS_ISO9660;
+ lp->d_partitions[RAW_PART].p_fstype = FS_UNUSED;
lp->d_npartitions = RAW_PART + 1;
lp->d_magic = DISKMAGIC;
lp->d_magic2 = DISKMAGIC;
lp->d_checksum = dkcksum(lp);
+
+ /*
+ * Call the generic disklabel extraction routine
+ */
+ errstring = readdisklabel(MAKEMCDDEV(0, sc->sc_dev.dv_unit, RAW_PART),
+ mcdstrategy, lp, sc->sc_dk.dk_cpulabel);
+ if (errstring) {
+ printf("%s: %s\n", sc->sc_dev.dv_xname, errstring);
+ return;
+ }
}
int