From owner-freebsd-stable Thu Apr 29 10:58:37 1999 Delivered-To: freebsd-stable@freebsd.org Received: from po1.bbn.com (PO1.BBN.COM [192.1.50.38]) by hub.freebsd.org (Postfix) with ESMTP id 4B77A14DB5 for ; Thu, 29 Apr 1999 10:58:30 -0700 (PDT) (envelope-from dennis@bbn.com) Received: from bbn.com (DROCKWELL.BBN.COM [128.89.31.139]) by po1.bbn.com (8.9.1/8.9.1) with ESMTP id NAA25146; Thu, 29 Apr 1999 13:58:18 -0400 (EDT) Message-Id: <199904291758.NAA25146@po1.bbn.com> To: naddy@mips.rhein-neckar.de (Christian Weisgerber) Cc: freebsd-stable@FreeBSD.ORG Subject: Re: Does tar do sparse files these days In-reply-to: Message from naddy@mips.rhein-neckar.de (Christian Weisgerber) <7g7vdc$3e6$1@mips.rhein-neckar.de> . X-face: &R'hN{mZu#r@8b_JU\bn"!fYpP{?5k4p/(|]?.2'6;>Dc9}~t*vY=/#-:"63ya.%)%o`Kv$ u&'Ff5k&n[}QC;j7YYsR5Hl]G"E:*9Zmw;dx[sw&9Tmx_PB/7B`RdFW;#@49hJU&kW+J"<[`9^?.dQ 3]L$zK,4'=tThX$wC!M\`e*@1y Date: Thu, 29 Apr 1999 13:58:17 -0400 From: Dennis Rockwell Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On 28 Apr, Christian Weisgerber wrote: > [ ... ] You *cannot* reliably recognize sparse > files through the file API. The state of the art, which you get when you > invoke GNU tar with the -S option, is to compare stat.st_blocks with the > file size. If there are fewer blocks than you'd expect from the size, > there obviously must be holes somewhere, and you can now take guesses > which large ranges of null bytes might be holes. This should work for > most real world cases, but no way are you going to be able to exactly > reproduce a file that freely intermixes holes with actual blocks of null > bytes. You would have to do run-length encoding of all strings of nulls above some small threshhold, regardless of their alignment, then always seek over these strings when retrieving. Since, as you say, the API doesn't reflect these holes, manufacturing new holes isn't a problem, and even saves some disk space. I don't know if the file format would support this, and I wouldn't expect something this CPU-expensive to be the default behavior. Dennis Rockwell dennis@bbn.com GTE Internetworking Powered by BBN +1-617-873-5745 Cambridge, MA +1-617-873-6091 (Fax) To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message