On Fri, 18 Jul 2003, Alan Cox wrote:

> On Gwe, 2003-07-18 at 00:58, Lucius, Leland wrote:
> > > I'm looking for a generic way to find the size of a block special.
> >
> > Open '/dev/xxx...' and start reading until ya get nuttin' back.
> >
> > (Aaaa, Leland's poor attempt at humor strikes again... :-))
>
> Thats actually one approach - with old old Linux you used to do this
> although people did a binary search rather than linear read. Nowdays
> there are ioctl calls which will give you volume sizes. You do want
> to use the later 64bit ioctl if it is present as BLKGETSIZE ioctls only
> work up to 1Tb or so.

I would have thought a seek() to MAXINT and then find out where you are
would've been the old way. Not that it would work with drives bigger
then 4 Gbytes on 2.2 or earlier kernels.



>
> Alan
>

--


Cheers
John.

Join the "Linux Support by Small Businesses" list at
http://mail.computerdatasafe.com.au/mailman/listinfo/lssb
Copyright John Summerfield. Reproduction prohibited.

Reply via email to