On 10/29/2013 5:19 PM, Dyer, Rodney wrote:
> We have a problem then, as there is no way that I know of to check what space 
> is left on the device first, then begin writing with a lock on the free space 
> you want.   Between the time that you've checked the free space, and you begin
writing, you may have lost the space to another user.


This is why the AFS file server allows a user to go over quota by a
small amount before it begins failing writes.

> To solve this problem you would need to try and allocate all the space
needed first, then write into it.

This is a very common pattern for exactly this reason.  Especially for
file copies.  The target file is opened, the file size is allocated and
then the data is written into the target location.

The Win32 API calls are:

  CreateFile to create the file
  SetFilePointerEx to advance the file pointer to the size to allocate
  SetEndOfFile to commit that size to disk






Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to