Matej Cepl wrote:
> On 2009-02-06, 23:37 GMT, Pádraig Brady wrote:
>> Rather than creating a new utility, prehaps a --preallocate
>> option to the existing truncate utility would be better?
>> Especially considering you added a --sparse option to mkfile
>> which does much the same thing (although not allowing shrinking?).
>
> Well, my primary inspiration for writing mkfile (long time before
> there was any fallocate in the kernel) was that this utility is
> common on other Unices
> (http://docs.sun.com/app/docs/doc/816-0211/6m6nc670c?a=view,
For me the functionality of the tool without fallocate is not interesting,
since it's equivalent to `dd if=/dev/zero ... of=file`.
Perhaps Jim's idea of having a contrib directory would be appropriate for this?
I.E. have a mkfile script that does `truncate --preallocate && chmod u+t "$1"`
>http://developer.apple.com/documentation/Darwin/Reference/ManPages\
> /man8/mkfile.8.html,
>http://www.freebsdsoftware.org/sysutils/mkfile.html)
Note `mkfile` is only available in freebsd ports, while `truncate`
is available in freebsd core. For Darwin this is reversed.
Here's a list of mkfile's availability on various systems:
http://www.math.utah.edu/~beebe/unix/m/mkfile.html
> so I wanted to have it on Linux as well. Introduction of fallocate just
> introduced additional incentive to complete mkfile and post it here.
fallocate is interesting in its own right, and would be an
appropriate option to add to `truncate` I think.
> So, I wouldn't mind if for rexample renaming truncate to mkfile
> (I think there is a value in using commonly shared names for Unix
> utilities rather than calling them by name of a system call;
It wasn't called after the system call. It was called after the
function it was providing. mkfile isn't the best name either BTW.
Also the existing `truncate` command in freebsd which
swayed the choice of name.
cheers,
Pádraig.