Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 6 Feb 2002 02:20:30 +0300
From:      Yar Tikhiy <yar@FreeBSD.ORG>
To:        "M. Warner Losh" <imp@village.org>
Cc:        hackers@FreeBSD.ORG
Subject:   Re: Get disk device size?
Message-ID:  <20020206022029.A95467@comp.chem.msu.su>
In-Reply-To: <20020205.093006.104650505.imp@village.org>; from imp@village.org on Tue, Feb 05, 2002 at 09:30:06AM -0700
References:  <20020205125557.A10266@comp.chem.msu.su> <20020205.093006.104650505.imp@village.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Feb 05, 2002 at 09:30:06AM -0700, M. Warner Losh wrote:
> In message: <20020205125557.A10266@comp.chem.msu.su>
>             Yar Tikhiy <yar@FreeBSD.ORG> writes:
> : Could anyone point out at an ioctl or any other way to get a disk
> : device size granted the device has no BSD label or PC slice table
> : on it?  Ways for both the userland and kernel are welcome.
> 
> For userland, look at how fdisk and/or disklabel get it.
> 
> For kernel, look at kern/subr_disk*.c

Thanks, the DIOCGDINFO ioctl is nearly what I was looking for.

However, there seems to be a number of problems (or my misunderstandings?)
about it.  This ioctl can't be used against non-BSD slices; it
fails on them with EINVAL due to code in kern/subr_diskslice.c.
OTOH, invoking this ioctl on a partition (e.g. ad0s1a) will result
in the parameters of the whole slice/disk (i.e. ad0s1.)  Isn't all
that a bit inconsistent?  E.g. a filesystem layer doesn't need to
distinguish between say ad0, ad0s1, and ad0s1a -- they're just
disk devices for it.  Or did I miss any important point?

-- 
Yar

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020206022029.A95467>