summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1996-12-05 17:16:06 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1996-12-05 17:16:06 +0000
commitd9139da9a631c11f974381d657ae40660f8285d5 (patch)
treed6b7ade386871e0d4d584e4c45cc4b0ffe5d2cd4 /sys/dev
parent67a107a459370287b9823562b936afdaa54e6210 (diff)
remove duplicate code; nice readdisklabel warning messages
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/isa/fd.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/sys/dev/isa/fd.c b/sys/dev/isa/fd.c
index 949fa9802d7..ae2a3156009 100644
--- a/sys/dev/isa/fd.c
+++ b/sys/dev/isa/fd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fd.c,v 1.30 1996/12/05 13:13:05 deraadt Exp $ */
+/* $OpenBSD: fd.c,v 1.31 1996/12/05 17:16:05 deraadt Exp $ */
/* $NetBSD: fd.c,v 1.90 1996/05/12 23:12:03 mycroft Exp $ */
/*-
@@ -955,7 +955,7 @@ fdioctl(dev, cmd, addr, flag, p)
struct fd_softc *fd = fd_cd.cd_devs[FDUNIT(dev)];
struct disklabel dl, *lp = &dl;
struct cpu_disklabel cdl;
- char *msg;
+ char *errstring;
int error;
switch (cmd) {
@@ -972,7 +972,6 @@ fdioctl(dev, cmd, addr, flag, p)
lp->d_ntracks = fd->sc_type->heads;
lp->d_nsectors = fd->sc_type->seccyl;
lp->d_ncylinders = fd->sc_type->tracks;
- lp->d_secpercyl = lp->d_ntracks * lp->d_nsectors;
strncpy(lp->d_typename, "floppy disk", 16);
lp->d_type = DTYPE_FLOPPY;
@@ -992,8 +991,11 @@ fdioctl(dev, cmd, addr, flag, p)
lp->d_magic2 = DISKMAGIC;
lp->d_checksum = dkcksum(lp);
- if ((msg = readdisklabel(dev, fdstrategy, lp, &cdl)) != NULL)
- printf("readdisklabel: %s\n", msg);
+ errstring = readdisklabel(dev, fdstrategy, lp, &cdl);
+ if (errstring) {
+ printf("%s: %s\n", fd->sc_dev.dv_xname, errstring);
+ return;
+ }
*(struct disklabel *)addr = *lp;
return 0;