From owner-freebsd-hackers@FreeBSD.ORG Sat Feb 20 10:36:48 2010 Return-Path: Delivered-To: freebsd-hackers@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 59B2D1065692; Sat, 20 Feb 2010 10:36:48 +0000 (UTC) (envelope-from nox@jelal.kn-bremen.de) Received: from smtp.kn-bremen.de (gelbbaer.kn-bremen.de [78.46.108.116]) by mx1.freebsd.org (Postfix) with ESMTP id AEA4E8FC0C; Sat, 20 Feb 2010 10:36:47 +0000 (UTC) Received: by smtp.kn-bremen.de (Postfix, from userid 10) id CB2BC1E00773; Sat, 20 Feb 2010 11:36:46 +0100 (CET) Received: from triton8.kn-bremen.de (noident@localhost [127.0.0.1]) by triton8.kn-bremen.de (8.14.3/8.14.3) with ESMTP id o1KAXUwB035533; Sat, 20 Feb 2010 11:33:30 +0100 (CET) (envelope-from nox@triton8.kn-bremen.de) Received: (from nox@localhost) by triton8.kn-bremen.de (8.14.3/8.14.3/Submit) id o1KAXUdR035532; Sat, 20 Feb 2010 11:33:30 +0100 (CET) (envelope-from nox) From: Juergen Lock Date: Sat, 20 Feb 2010 11:33:29 +0100 To: Jung-uk Kim Message-ID: <20100220103329.GA35467@triton8.kn-bremen.de> References: <20100217215940.GA19713@triton8.kn-bremen.de> <20100219181247.GA35702@triton8.kn-bremen.de> <4B7F711E.6040402@freebsd.org> <201002200100.48161.jkim@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201002200100.48161.jkim@FreeBSD.org> User-Agent: Mutt/1.5.20 (2009-06-14) X-Mailman-Approved-At: Sat, 20 Feb 2010 15:35:20 +0000 Cc: freebsd-hackers@FreeBSD.org, Tim Kientzle , Juergen Lock , Garrett Cooper Subject: Re: "tar tfv /dev/cd0" speedup patch X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Feb 2010 10:36:48 -0000 On Sat, Feb 20, 2010 at 01:00:40AM -0500, Jung-uk Kim wrote: > On Saturday 20 February 2010 12:20 am, Tim Kientzle wrote: > > Juergen, > > > > I was looking at your Linux code here and thought > > the technique of trying lseek(SEEK_END) might work. > > Unfortunately, it doesn't: lseek(fd, 0, SEEK_END) gives > > zero for both /dev/sa0 (a tape drive) and /dev/cd0 > > (an optical drive). Are you sure it works on Linux? > > Can you please try ioctl(fd, BLKGETSIZE64, &some_uint64_var) or > ioctl(fd, BLKGETSIZE, &some_u_long_var)? Yeah I've stumbled across these ioctls in the meantime too, I was just not sure if all Linux versions currently in use already have the 64 bit version i.e. BLKGETSIZE64... (since we don't want the 32 bit version for the same reason we don't want 32 bit off_t. :) Cheers, Juergen