summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_diskslice.c
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2002-03-31 21:17:12 +0000
committerphk <phk@FreeBSD.org>2002-03-31 21:17:12 +0000
commitac4142e564399017e87bce0cd727e798a299c1ce (patch)
tree2f98be6e543d5b073f996784b8e6b4aa1897517f /sys/kern/subr_diskslice.c
parent9e46855391962e6c4a6eb142b65453ee52567197 (diff)
downloadFreeBSD-src-ac4142e564399017e87bce0cd727e798a299c1ce.zip
FreeBSD-src-ac4142e564399017e87bce0cd727e798a299c1ce.tar.gz
Implement the two "GEOM" ioctls DIOCGSECTORSIZE and DIOCGMEDIASIZE for
the non-GEOM code as well. This simplifies the the kernel-dumping and disk-management tools as less compatibility cruft will be needed. Sponsored by: DARPA and NAI Labs.
Diffstat (limited to 'sys/kern/subr_diskslice.c')
-rw-r--r--sys/kern/subr_diskslice.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/sys/kern/subr_diskslice.c b/sys/kern/subr_diskslice.c
index f6736cf..8120e55 100644
--- a/sys/kern/subr_diskslice.c
+++ b/sys/kern/subr_diskslice.c
@@ -407,6 +407,19 @@ dsioctl(dev, cmd, data, flags, sspp)
*(struct disklabel *)data = *lp;
return (0);
+ case DIOCGSECTORSIZE:
+ if (lp == NULL)
+ return (EINVAL);
+ *(u_int *)data = lp->d_secsize;
+ return (0);
+
+ case DIOCGMEDIASIZE:
+ if (lp == NULL)
+ return (EINVAL);
+ *(off_t *)data = (off_t)lp->d_partitions[dkpart(dev)].p_size *
+ lp->d_secsize;
+ return (0);
+
case DIOCGPART:
if (lp == NULL)
return (EINVAL);
OpenPOWER on IntegriCloud