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.
This commit is contained in:
Poul-Henning Kamp 2002-03-31 21:17:12 +00:00
parent 80c7362ce3
commit 1f3a74b1b1

View File

@ -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);