Subject: Re: hexdumping large sparce files
To: David Laight <david@l8s.co.uk>
From: Jaromir Dolecek <jdolecek@netbsd.org>
List: tech-kern
Date: 01/27/2003 12:23:12
As a matter of fact, all filesystems deal properly with

write + lseek + write.

Filesystems which don't support holes per se will use
space on the filesystem for the 'hole' as appropriate.

I.e. you don't need any special handling in application.
You lseek where you want and the fs code DTRT.

Jaromir

David Laight wrote:
> > You do that by never writing to the hole, but lseek()ing to the next part
> > you want to write.
> 
> I'm sure there is also a way of making a hole in an existing file.
> 
> > Hm, which makes me think, that maybe we want SEEK_HOLE, which will be
> > equivalent to SEEK_CUR if the filesystem doesn't know about holes, and 
> > relative to the end of the next hole otherwise.
> 
> That isn't the right place, seek is (probably) handled well above
> the VOP layer.  A fcntl() or ioctl() would be more appropriate.
> 
> 	David
> 
> -- 
> David Laight: david@l8s.co.uk
> 


-- 
Jaromir Dolecek <jdolecek@NetBSD.org>            http://www.NetBSD.org/
-=- We should be mindful of the potential goal, but as the tantric    -=-
-=- Buddhist masters say, ``You may notice during meditation that you -=-
-=- sometimes levitate or glow.   Do not let this distract you.''     -=-