Re: Sparse files on Mac
Re: Sparse files on Mac
- Subject: Re: Sparse files on Mac
- From: Terry Lambert <email@hidden>
- Date: Mon, 10 Dec 2007 16:00:15 -0800
On Dec 8, 2007, at 1:51 AM, Anton Altaparmakov wrote:
Hi,
On 8 Dec 2007, at 09:33, Damir Dezeljin wrote:
Hi folks,
I have an non strictly kernel related question; however, I guess
you'll be able to point me to the right resources. I developed a
KEXT and I though of using sparse files functionality in user space
for implementing some internal logic.
I tried creating a sparse file using the same set of commands I
usually use on Linux, but I found out I just create a normal file:
----
ftruncate(fd, 0);
ftruncate(fd, 4*1024*1024*1024);
----
Now I'm wondering if sparse files are supported on the default file
system used on OS 10.4 desktop (as I know, the HFS is used)? If
yes, what I'm doing wrong?
HFS/HFS+ do not support sparse files.
Correct. UFS, ZFS, and others, however, do.
Additionally I'm wondering if is it possible to get some kind of
'holes table' as it's on Windows -> so, let suppose the sparse file
has some data on an offset of 1 GB, some on 1.7 GB and so on. As
far as I know, this isn't possible on Linux, but I'm sure it is on
Windows.
As there is no sparse support this is not relevant. You can get
allocation information using the fcntl F_LOG2PHYS (see the fcntl man
page) but that is quite a cumbersome interface.
Also note that it will (at least on Leopard have not checked Tiger)
return RANDOM JUNK for file systems supporting sparse files. Radar
is down for maintenance at the moment or I would file a bug report
immediately!
Which FS are you talking about? For UFS, I see zero filled pages
being returned, which is per the spec.. Are you sure this is not a
bug specific to the FS you were testing on? The FS is more or less
required to fake this up for any sparse areas, and if it doesn't, it's
broken (not to mention a security issue, if it's returning random data
from the disk).
-- Terry
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden