Messages in this thread | | | Date | Tue, 8 Nov 2005 22:23:24 -0500 | From | Theodore Ts'o <> | Subject | Re: 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/
| |