Re: Script to set up sparse device for testing

Erik Mouw <[email protected]>
Newsgroups gmane.comp.file-systems.ext2.devel
Organization Harddisk-recovery.com
Message-ID <[email protected]>
On Thu, Jul 06, 2006 at 05:36:56AM -0600, Matthew Wilcox wrote:
> On Thu, Jul 06, 2006 at 12:05:41PM +0200, Erik Mouw wrote:
> > (IIRC truncate() isn't required to work this way according to
> > POSIX/SUSv3, but it works under Linux).
> 
> The truncate() function shall cause the regular file named by path to
> have a size which shall be equal to length bytes.
> 
> If the file previously was larger than length, the extra data is
> discarded. If the file was previously shorter than length, its size is
> increased, and the extended area appears as if it were zero-filled.
> 
> http://www.opengroup.org/onlinepubs/000095399/functions/truncate.html

Ah, the gory details :)

So truncate shall increase the file and zero fill it, but it doesn't
say it should be a sparse file. I suppose that's left to the
implementation.


Erik

-- 
+-- Erik Mouw -- www.harddisk-recovery.com -- +31 70 370 12 90 --
| Lab address: Delftechpark 26, 2628 XH, Delft, The Netherlands

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.