如何以编程方式创建一个稀疏文件,在C,在Mac OS X? [英] How do I create a sparse file programmatically, in C, on Mac OS X?

查看:349
本文介绍了如何以编程方式创建一个稀疏文件,在C,在Mac OS X?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个稀疏文件,这样,直到我写数据到所有这些零块不占用实际的磁盘空间。这可能吗?

I'd like to create a sparse file such that all-zero blocks don't take up actual disk space until I write data to them. Is it possible?

推荐答案

正如在其他Unix系统,它是文件系统的一个特点。无论是文件系统支持它所有文件或没有。与Win32,你没有做什么特别的做到这一点。也不像Win32中,有使用稀疏文件没有性能损失。

As in other Unixes, it's a feature of the filesystem. Either the filesystem supports it for ALL files or it doesn't. Unlike Win32, you don't have to do anything special to make it happen. Also unlike Win32, there is no performance penalty for using a sparse file.

在MacOS上,默认的文件系统是HFS +这确实的的支持稀疏文件。

On MacOS, the default filesystem is HFS+ which does not support sparse files.

更新:的MacOS用于支持稀疏文件支持UFS卷,但已被删除。当前支持的文件系统中没有配备稀疏文件的支持。

Update: MacOS used to support UFS volumes with sparse file support, but that has been removed. None of the currently supported filesystems feature sparse file support.

这篇关于如何以编程方式创建一个稀疏文件,在C,在Mac OS X?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆