Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030415AbVKIDXc (ORCPT ); Tue, 8 Nov 2005 22:23:32 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1030423AbVKIDXc (ORCPT ); Tue, 8 Nov 2005 22:23:32 -0500 Received: from thunk.org ([69.25.196.29]:37345 "EHLO thunker.thunk.org") by vger.kernel.org with ESMTP id S1030415AbVKIDXb (ORCPT ); Tue, 8 Nov 2005 22:23:31 -0500 Date: Tue, 8 Nov 2005 22:23:24 -0500 From: "Theodore Ts'o" To: Parag Warudkar Cc: Al Viro , "linux-os (Dick Johnson)" , Linux kernel Subject: Re: Compatible fstat() Message-ID: <20051109032324.GA21282@thunk.org> Mail-Followup-To: Theodore Ts'o , Parag Warudkar , Al Viro , "linux-os (Dick Johnson)" , Linux kernel References: <3587A59B-14FA-4E0F-A598-577E944FCF36@comcast.net> <20051108172244.GR7992@ftp.linux.org.uk> <20051108184957.GF6129@thunk.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.11 Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1168 Lines: 30 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/