summaryrefslogtreecommitdiff
path: root/sys/arch/sparc64
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2008-03-22 22:54:44 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2008-03-22 22:54:44 +0000
commit4ac010668e431238d67a9bcc7af35fce2ced9411 (patch)
treeb6a7d62ba7ba306884dfbb619b1e3fddce48aaf5 /sys/arch/sparc64
parent0dffa81a118569089faf4f1b7be7cd8a7acf9f82 (diff)
Add support for DIOCRLDINFO, DIOCGPDINFO, DIOCGPART to the fd
driver(s). Adapted from sd driver. ok marco@
Diffstat (limited to 'sys/arch/sparc64')
-rw-r--r--sys/arch/sparc64/dev/fd.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/sys/arch/sparc64/dev/fd.c b/sys/arch/sparc64/dev/fd.c
index 35c8bdc024c..b2813790bf6 100644
--- a/sys/arch/sparc64/dev/fd.c
+++ b/sys/arch/sparc64/dev/fd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fd.c,v 1.20 2008/03/20 00:59:37 krw Exp $ */
+/* $OpenBSD: fd.c,v 1.21 2008/03/22 22:54:43 krw Exp $ */
/* $NetBSD: fd.c,v 1.112 2003/08/07 16:29:35 agc Exp $ */
/*-
@@ -1826,6 +1826,7 @@ fdioctl(dev, cmd, addr, flag, p)
{
struct fd_softc *fd;
struct fdc_softc *fdc;
+ struct disklabel *lp;
int unit;
int error;
#ifdef FD_DEBUG
@@ -1840,10 +1841,27 @@ fdioctl(dev, cmd, addr, flag, p)
fdc = (struct fdc_softc *)fd->sc_dv.dv_parent;
switch (cmd) {
+ case DIOCRLDINFO:
+ lp = malloc(sizeof(*lp), M_TEMP, M_WAITOK);
+ fdgetdisklabel(dev, fd, lp, 0);
+ bcopy(lp, fd->sc_dk.dk_label, sizeof(*lp));
+ free(lp, M_TEMP);
+ return 0;
+
+ case DIOCGPDINFO:
+ fdgetdisklabel(dev, fd, (struct disklabel *)addr, 1);
+ return 0;
+
case DIOCGDINFO:
*(struct disklabel *)addr = *(fd->sc_dk.dk_label);
return 0;
+ case DIOCGPART:
+ ((struct partinfo *)addr)->disklab = fd->sc_dk.dk_label;
+ ((struct partinfo *)addr)->part =
+ &fd->sc_dk.dk_label->d_partitions[DISKPART(dev)];
+ return 0;
+
case DIOCWLABEL:
if ((flag & FWRITE) == 0)
return EBADF;