lkml.org 
[lkml]   [2005]   [Nov]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Compatible fstat()
On Tue, Nov 08, 2005 at 02:12:24PM -0500, Parag Warudkar wrote:
>
> On Nov 8, 2005, at 1:49 PM, Theodore Ts'o wrote:
>
> >e2fsprogs falls back to using a
> >binary search using SEEK_SET to find the device size.
>
> Binary search of what?

Of the device size; it doubles the guessed size of the disk until
lseek+read returns an error, and then uses binary search to figure out
the size of the disk. I did this because it works on pretty much any
OS.

> I tried to read the relevant code in getsize.c
> but apart from suspecting that the binary search thing might be
> specific to ext2fs I didn't quite understand what's going on in the
> code. (Will it work irrespective of the file system presence on the
> device?)

Yes, it works irrespective of what's on the disk. In fact, if the
Linux-specific ioctl's are not available, it's what will be used by
mke2fs to figure out the size of the device.

- Ted
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-11-09 04:26    [W:0.039 / U:0.236 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site