From owner-freebsd-current@FreeBSD.ORG Thu Feb 19 23:23:48 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D6E6516A4D0 for ; Thu, 19 Feb 2004 23:23:48 -0800 (PST) Received: from server.vk2pj.dyndns.org (c211-30-75-229.belrs2.nsw.optusnet.com.au [211.30.75.229]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1ECA843D1D for ; Thu, 19 Feb 2004 23:23:48 -0800 (PST) (envelope-from peterjeremy@optushome.com.au) Received: from server.vk2pj.dyndns.org (localhost.vk2pj.dyndns.org [127.0.0.1])i1K7NWJZ007930; Fri, 20 Feb 2004 18:23:32 +1100 (EST) (envelope-from peter@server.vk2pj.dyndns.org) Received: (from peter@localhost) by server.vk2pj.dyndns.org (8.12.10/8.12.10/Submit) id i1K7NVsI007929; Fri, 20 Feb 2004 18:23:31 +1100 (EST) (envelope-from peter) Date: Fri, 20 Feb 2004 18:23:31 +1100 From: Peter Jeremy To: Aaron Peterson Message-ID: <20040220072331.GA7849@server.vk2pj.dyndns.org> References: <9615.162.114.211.143.1077213472.squirrel@mail.alpete.com> <20040219201520.GB44313@cicely12.cicely.de> <29352.162.114.211.143.1077222503.squirrel@mail.alpete.com> <20040219204012.GA33771@troutmask.apl.washington.edu> <46490.162.114.211.143.1077223809.squirrel@mail.alpete.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <46490.162.114.211.143.1077223809.squirrel@mail.alpete.com> User-Agent: Mutt/1.4.2i cc: freebsd-current@freebsd.org cc: ticso@cicely.de cc: Steve Kargl Subject: Re: bcwipe won't wipe a block device... X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Feb 2004 07:23:49 -0000 On Thu, Feb 19, 2004 at 03:50:09PM -0500, Aaron Peterson wrote: >The output was too long I though to post back to the list from >ktrace/kdump... you can read it here: > >http://www.alpete.com/bcwipe.kdump.txt Summary: bcwipe is trying to read 1 byte from an offset of 2^N-1. FreeBSD no longer has block devices (since 4.0) - /dev/da0 is a character device. Character devices can only be read in blocksize units (typically 512 bytes for disks). You need to fix bcwipe to handle character devices. In detail: 13661 bcwipe CALL open(0xbfbfee71,0x82,0xbfbfee71) 13661 bcwipe NAMI "/dev/da0" 13661 bcwipe RET open 3 Successfully open "/dev/da0" using fd 3. 13661 bcwipe CALL lseek(0x3,0,0,0,0x2) 13661 bcwipe RET lseek 0 Seek to EOF. This should return the new offset (ie the size of the device) but I suspect ktrace is truncating the off_t result to 32 bits. 13661 bcwipe CALL lseek(0x3,0,0xffffffff,0x7fffffff,0) 13661 bcwipe RET lseek -1/0xffffffff 13661 bcwipe CALL read(0x3,0xbfbeeba0,0x1) 13661 bcwipe RET read -1 errno 22 Invalid argument ... 13661 bcwipe CALL lseek(0x3,0,0x1,0,0) 13661 bcwipe RET lseek 1 13661 bcwipe CALL read(0x3,0xbfbeeba0,0x1) 13661 bcwipe RET read -1 errno 22 Invalid argument bcwipe then appears to perform a binary search to locate EOF - seeking to 2^N-1 and reading 1 byte for N=63..1. These reads all fail because they aren't blocksize reads on a block boundary. 13661 bcwipe CALL lseek(0x3,0,0,0,0x1) 13661 bcwipe RET lseek 1 13661 bcwipe CALL gettimeofday(0xbfbeebe8,0) 13661 bcwipe RET gettimeofday 0 These operations are not relevant to the problem. 13661 bcwipe CALL lseek(0x3,0,0,0,0) 13661 bcwipe RET lseek 0 Seek to beginning of file. 13661 bcwipe CALL write(0x3,0xbfbeecc0,0x1) 13661 bcwipe RET write -1 errno 22 Invalid argument Attempt to write 1 byte. This again fails because it's not a multiple of the blocksize. Peter