summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2009-06-04 05:57:28 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2009-06-04 05:57:28 +0000
commit773d991fb0d90b5b8d25d378d7043919becab01e (patch)
tree3ab94aad4e2edc8ecfaeecbb098922375318a39f /sys/dev
parent32d374af3a6d3edf3bcc269559ecb942cb36befb (diff)
Add DIOCRLDINFO to those drivers previously deprived.
Noticed by & ok deraadt@
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ccd.c15
-rw-r--r--sys/dev/vnd.c12
2 files changed, 25 insertions, 2 deletions
diff --git a/sys/dev/ccd.c b/sys/dev/ccd.c
index 42609c64f8f..18169e5efd2 100644
--- a/sys/dev/ccd.c
+++ b/sys/dev/ccd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ccd.c,v 1.85 2008/07/01 04:15:59 ray Exp $ */
+/* $OpenBSD: ccd.c,v 1.86 2009/06/04 05:57:27 krw Exp $ */
/* $NetBSD: ccd.c,v 1.33 1996/05/05 04:21:14 thorpej Exp $ */
/*-
@@ -1012,6 +1012,7 @@ ccdioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
int unit = DISKUNIT(dev);
int i, j, lookedup = 0, error = 0;
int part, pmask, s;
+ struct disklabel *lp;
struct ccd_softc *cs;
struct ccd_ioctl *ccio = (struct ccd_ioctl *)data;
struct ccddevice ccd;
@@ -1191,6 +1192,18 @@ ccdioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
splx(s);
break;
+ case DIOCRLDINFO:
+ if ((error = ccdlock(cs)) != 0)
+ return (error);
+
+ lp = malloc(sizeof(*lp), M_TEMP, M_WAITOK);
+ ccdgetdisklabel(dev, cs, lp, 0);
+ *(cs->sc_dkdev.dk_label) = *lp;
+ free(lp, M_TEMP);
+
+ ccdunlock(cs);
+ break;
+
case DIOCGPDINFO:
if ((error = ccdlock(cs)) != 0)
return (error);
diff --git a/sys/dev/vnd.c b/sys/dev/vnd.c
index 1ac734d5233..8cbda77ef91 100644
--- a/sys/dev/vnd.c
+++ b/sys/dev/vnd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vnd.c,v 1.91 2009/06/03 22:09:30 thib Exp $ */
+/* $OpenBSD: vnd.c,v 1.92 2009/06/04 05:57:27 krw Exp $ */
/* $NetBSD: vnd.c,v 1.26 1996/03/30 23:06:11 christos Exp $ */
/*
@@ -749,6 +749,7 @@ int
vndioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p)
{
int unit = vndunit(dev);
+ struct disklabel *lp;
struct vnd_softc *vnd;
struct vnd_ioctl *vio;
struct vnd_user *vnu;
@@ -945,6 +946,15 @@ vndioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p)
break;
+ case DIOCRLDINFO:
+ if ((vnd->sc_flags & VNF_HAVELABEL) == 0)
+ return (ENOTTY);
+ lp = malloc(sizeof(*lp), M_TEMP, M_WAITOK);
+ vndgetdisklabel(dev, vnd, lp, 0);
+ *(vnd->sc_dk.dk_label) = *lp;
+ free(lp, M_TEMP);
+ return (0);
+
case DIOCGPDINFO:
if ((vnd->sc_flags & VNF_HAVELABEL) == 0)
return (ENOTTY);