Subject: Re: truncate()
To: None <torek@horse.ee.lbl.gov>
From: Paul Kranenburg <pk@cs.few.eur.nl>
List: tech-kern
Date: 11/06/1993 18:37:34
> The code for extending a file is tricky.  It took a couple of rounds
> (with some nasty little fs problems) to get this to work right.  If
> you extend a block in place, you must zero out the new parts; if you
> grow a file beyond the `small file' size, you must extend its final
> fragment, if any, to a full block.

Oh. I was actually hoping it would just be the equivalent of "lseek(size)"
followed by a writing a zero byte at "size - 1" while not actually changing
the current file offset (in case of ftruncate()). This way, all that's needed
is to mimic some code from ufs_write(), leaving the hard bits to balloc().

-pk

------------------------------------------------------------------------------