Return-Path: <tiff-bounces@lists.maptools.org>
Delivered-To: info@awaresystems.be
Received: (qmail 15000 invoked from network); 23 Aug 2008 15:29:07 -0000
Received: from cliffy.telenet-ops.be ([195.130.136.2])
          (envelope-sender <tiff-bounces@lists.maptools.org>)
          by angelia.telenet-ops.be (qmail-ldap-1.03) with SMTP
          for <info@awaresystems.be>; 23 Aug 2008 15:29:07 -0000
Received: from zimbu.telenet-ops.be (zimbu.telenet-ops.be [195.130.136.11])
	by cliffy.telenet-ops.be (8.13.1/8.13.1) with ESMTP id m7NFT7Ta010446
	for <info@awaresystems.be>; Sat, 23 Aug 2008 17:29:07 +0200
Received: from localhost (localhost.localdomain [127.0.0.1])
	by zimbu.telenet-ops.be (Postfix) with SMTP id 3EFA740004
	for <info@awaresystems.be>; Sat, 23 Aug 2008 17:29:07 +0200 (CEST)
Received: from circe.telenet-ops.be (circe.telenet-ops.be [195.130.132.51])
	by zimbu.telenet-ops.be (Postfix) with ESMTP id 2E7FC40002
	for <info@awaresystems.be>; Sat, 23 Aug 2008 17:29:07 +0200 (CEST)
Received: from duke.maptools.org (r153.dmsolutions.ca [209.217.116.153])
	by circe.telenet-ops.be (Postfix) with ESMTP id B153733E6A
	for <info@awaresystems.be>; Sat, 23 Aug 2008 17:29:06 +0200 (CEST)
Received: from duke.maptools.org (duke.maptools.org [127.0.0.1])
	by duke.maptools.org (8.12.11/8.12.10) with ESMTP id m7NFQn4c024307;
	Sat, 23 Aug 2008 11:28:13 -0400
Received: from abra2.bitwizard.nl (dtp.xs4all.nl [80.101.171.8])
	by duke.maptools.org (8.12.11/8.12.10) with SMTP id m7NFQjwK024299
	for <tiff@lists.maptools.org>; Sat, 23 Aug 2008 11:26:46 -0400
Received: (qmail 21585 invoked by uid 1000); 23 Aug 2008 17:26:44 +0200
Date: Sat, 23 Aug 2008 17:26:44 +0200
From: Rogier Wolff <R.E.Wolff@bitwizard.nl>
To: Phillip Crews <pcrews@cerious.com>
Subject: Re: [Tiff] creating sparse files......
Message-ID: <20080823152644.GF18815@bitwizard.nl>
References: <20080822085634.GA21294@bitwizard.nl>
	<Pine.SOC.4.64.0808220936280.1110@freddy.simplesystems.org>
	<20080822162748.GB29030@bitwizard.nl>
	<Pine.SOC.4.64.0808221131320.1110@freddy.simplesystems.org>
	<20080822165232.GE29030@bitwizard.nl>
	<Pine.SOC.4.64.0808221249090.1110@freddy.simplesystems.org>
	<48AF1B47.3030105@cerious.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <48AF1B47.3030105@cerious.com>
Organization: BitWizard.nl
User-Agent: Mutt/1.5.13 (2006-08-11)
Cc: tiff@lists.maptools.org, Rogier Wolff <R.E.Wolff@bitwizard.nl>
X-BeenThere: tiff@lists.maptools.org
X-Mailman-Version: 2.1.4
Precedence: list
List-Id: TIFF and libtiff discussion <tiff.lists.maptools.org>
List-Unsubscribe: <http://lists.maptools.org/mailman/listinfo/tiff>,
	<mailto:tiff-request@lists.maptools.org?subject=unsubscribe>
List-Archive: <http://lists.maptools.org/mailman/private/tiff>
List-Post: <mailto:tiff@lists.maptools.org>
List-Help: <mailto:tiff-request@lists.maptools.org?subject=help>
List-Subscribe: <http://lists.maptools.org/mailman/listinfo/tiff>,
	<mailto:tiff-request@lists.maptools.org?subject=subscribe>
Sender: tiff-bounces@lists.maptools.org
Errors-To: tiff-bounces@lists.maptools.org
X-SpamCatcher-Score: 50 [XX]

On Fri, Aug 22, 2008 at 04:02:15PM -0400, Phillip Crews wrote:
> Bob Friesenhahn wrote:
> >It is likely that some popular filesystems will fail to seek past the 
> >end of the file or will return random bytes (or parts of some 
> >previously deleted file) for the uninitialized portions.
> This was my immediate objection to this scheme. Even if it were a 
> platform-specific or configuration-controlled option, there will be 
> cases where one O/S is writing to a filesystem on another O/S (i.e., 
> over the network), resulting the same random garbage or simply ignored 
> seeks.

Ehh. You do have to take into account that this was written in the
module "tif_unix.c" or something like that. Wether this is active on
Microsof operating systems as well, I don't know. Sounds like it
should not be.... 

> If this is for Windows, the simplest solution for the OP may be to
> store the files in an NTFS compressed folder, or modify TIFFFDOpen
> to accept an additional flag which would set the file as compressed
> on compatible filesystems.

Now this is something that is not portable. 

> Note that the DeviceIoControl call will fail on unsupported 
> file systems. No further changes should be required (i.e., non-standard 
> seeks or checking for zeros). Similar minimal changes should be possible 
> for other operating systems as well.

What I implemented is NOT non-standard. 

It checks for zeros. It works for all operating systems. Files that
end up on filesystems that don't support holes will simply not have
the compression advantages.


> (NB: I apologize for the HTML mail but I thought it much more readable 
> for code; I'm sending in both, hoping that the plaintext version will 
> still be readable!)
> 
> In *tif_win32.c* (/untested /code follows, my changes in red):
> 
> |#include <winioctl.h>

This bombs when I try to compile it: I don't have winioctl.h .

> ...
> TIFF*
> TIFFFdOpen(thandle_t ifd, PCTSTR name, const char *mode)
> {
>  TIFF* tif;
>  BOOL fSuppressMap = (mode[1] == 'u' || (mode[1] != 0 && mode[2] == 'u'));
>  static const USHORT compmode = COMPRESSION_FORMAT_DEFAULT;
>  DWORD retbytes = 0; /* Not used but necessary per MS docs */
> 
>  if (mode[0] == 'w' && (mode[1] == 'c' || mode[2] == 'c') ) {
>    /* Compress new files only, otherwise no feedback on slow compression */
>    DeviceIoControl(ifd, FSCTL_SET_COMPRESSION, &compmode, sizeof comp, 

This will fail to compile on my system, as my system doesn't have have
DeviceIoControl.

Now who is suggesting non-standard solutions?????

	Roger. 


-- 
** R.E.Wolff@BitWizard.nl ** http://www.BitWizard.nl/ ** +31-15-2600998 **
**    Delftechpark 26 2628 XH  Delft, The Netherlands. KVK: 27239233    **
*-- BitWizard writes Linux device drivers for any device you may have! --*
Q: It doesn't work. A: Look buddy, doesn't work is an ambiguous statement. 
Does it sit on the couch all day? Is it unemployed? Please be specific! 
Define 'it' and what it isn't doing. --------- Adapted from lxrbot FAQ
_______________________________________________
Tiff mailing list: Tiff@lists.maptools.org
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/
