summaryrefslogtreecommitdiff
path: root/sys/arch/sparc/dev/xd.c
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2009-09-05 00:48:40 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2009-09-05 00:48:40 +0000
commitfce0339e25d60b70523c3fd6ca778dff89e93720 (patch)
tree37a2e8f87296691dad5043704e04d2c61f6377de /sys/arch/sparc/dev/xd.c
parentfc28b8935aa496ce905d6b41cd4f1e1f5fd33064 (diff)
Make DIOCSDINFO code consistant everywhere.
ok miod@ deraadt@
Diffstat (limited to 'sys/arch/sparc/dev/xd.c')
-rw-r--r--sys/arch/sparc/dev/xd.c31
1 files changed, 13 insertions, 18 deletions
diff --git a/sys/arch/sparc/dev/xd.c b/sys/arch/sparc/dev/xd.c
index dbdb87adbaf..7e9d908001f 100644
--- a/sys/arch/sparc/dev/xd.c
+++ b/sys/arch/sparc/dev/xd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xd.c,v 1.45 2009/08/13 15:23:12 deraadt Exp $ */
+/* $OpenBSD: xd.c,v 1.46 2009/09/05 00:48:39 krw Exp $ */
/* $NetBSD: xd.c,v 1.37 1997/07/29 09:58:16 fair Exp $ */
/*
@@ -854,17 +854,6 @@ xdioctl(dev, command, addr, flag, p)
&xd->sc_dk.dk_label->d_partitions[DISKPART(dev)];
return 0;
- case DIOCSDINFO: /* set disk label */
- if ((flag & FWRITE) == 0)
- return EBADF;
- error = setdisklabel(xd->sc_dk.dk_label,
- (struct disklabel *) addr, /* xd->sc_dk.dk_openmask : */ 0);
- if (error == 0) {
- if (xd->state == XD_DRIVE_NOLABEL)
- xd->state = XD_DRIVE_ONLINE;
- }
- return error;
-
case DIOCWLABEL: /* change write status of disk label */
if ((flag & FWRITE) == 0)
return EBADF;
@@ -875,6 +864,7 @@ xdioctl(dev, command, addr, flag, p)
return 0;
case DIOCWDINFO: /* write disk label */
+ case DIOCSDINFO: /* set disk label */
if ((flag & FWRITE) == 0)
return EBADF;
error = setdisklabel(xd->sc_dk.dk_label,
@@ -883,12 +873,17 @@ xdioctl(dev, command, addr, flag, p)
if (xd->state == XD_DRIVE_NOLABEL)
xd->state = XD_DRIVE_ONLINE;
- /* Simulate opening partition 0 so write succeeds. */
- xd->sc_dk.dk_openmask |= (1 << 0);
- error = writedisklabel(DISKLABELDEV(dev), xdstrategy,
- xd->sc_dk.dk_label);
- xd->sc_dk.dk_openmask =
- xd->sc_dk.dk_copenmask | xd->sc_dk.dk_bopenmask;
+ if (cmd == DIOCWDINFO) {
+ /*
+ * Simulate opening partition 0 so write
+ * succeeds.
+ */
+ xd->sc_dk.dk_openmask |= (1 << 0);
+ error = writedisklabel(DISKLABELDEV(dev),
+ xdstrategy, xd->sc_dk.dk_label);
+ xd->sc_dk.dk_openmask = xd->sc_dk.dk_copenmask |
+ xd->sc_dk.dk_bopenmask;
+ }
}
return error;