Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: File space preallocation




On Feb 20, 2006, at 6:00 AM, email@hidden wrote:

Is anyone preallocating file space on XSan?
I'm trying to work out how from the XSan programming guide...

It's very simple... for POSIX apps, you can use the standard F_PREALLOCATE fnctl... or for Carbon apps, you can use FSAllocateFork (). For Cocoa apps, using F_PREALLOCATE is probably easiest, just use NSFileHandle to open the file for writing, use the -(int) fileDescriptor method to get the file descriptor, use that with F_PREALLOCATE, and then write out your file contents using -(void) writeData:


Note that any space pre-allocated using standard Mac OS X APIs (i.e. the ones I have just described) will be truncated back to the real end of file (the last byte written to the file, i.e. the value reported in the st_size field of struct stat) when the file is closed. This is the same behavior that preallocation on HFS+ has.

-- thorpej

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xsan-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/xsan-users/email@hidden

This email sent to email@hidden
References: 
 >File space preallocation (From: email@hidden)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.