Re: flushing HFS cache to disk
site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com Create and write to a temporary file Delete the temp file (which is now the old file) Gotta love religion. Cheers, -Steve _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... At 6:27 PM -0800 11/30/05, Dave Yost wrote: I suppose you could write the file as a temp file, do a synchronous flush of the file, then move it into place. This is of course, a hack on top of an API that was never designed to be transactional. And of course, this is exactly how an HFS "safe save" works on "traditional" MacOS: FindFolder() to get the dirID of the invisible "Temporary Items" folder on the same volume as the destination file FSpExchangeFiles() to atomically swap the contents of the files (by swapping their directory entries) -- this preserves the fileID so aliases still work. And you could still end up with a temp file lying around after a crash. On reboot, any files left in "Temporary Items" are moved to "Rescued Items", located in the Trash. Years ago there was a Cromemco unix clone that let you create a file descriptor, write to it, then link it into a directory. That was a good idea that was rejected as unorthodox. This email sent to site_archiver@lists.apple.com
participants (1)
-
Steve Sisak