2.1.5.22 Server Requests Setting Quota Information
The server provides:
Open: An Open of a Quota Stream<200>.
InputBuffer: A buffer that contains one or more aligned FILE_QUOTA_INFORMATION structures as defined in [MS-FSCC] section 2.4.40.
InputBufferSize: The size, in bytes, of InputBuffer.
On completion, the object store MUST return:
Status: An NTSTATUS code that specifies the result.
Support for this operation is optional. If the object store does not implement this functionality, the operation MUST be failed with STATUS_INVALID_DEVICE_REQUEST.<201>
Pseudocode for the operation is as follows:
If InputBufferSize is zero, the operation MUST be failed with STATUS_INVALID_PARAMETER.
For each FILE_QUOTA_INFORMATION structure quota in InputBuffer:
Scan Open.File.Volume.QuotaInformation for an entry that matches quota.Sid and if found, save a pointer in matchedQuota; else set matchedQuota to empty.
If quota.Sid == BUILTIN_ADMINISTRATORS (as defined in [MS-DTYP] section 2.4.2.4) and quota.QuotaLimit != -1, the operation MUST be failed with STATUS_ACCESS_DENIED. A quota limit cannot be specified on the administrators account.
If quota.QuotaLimit == -2 //The quota is being deleted
If matchedQuota is not empty:
Remove matchedQuota from Open.File.Volume.QuotaInformation and delete it.
Set matchedQuota to empty.
Else
The operation MUST be failed with STATUS_NO_MATCH
Endif
Else if matchedQuota is not empty:
Set matchedQuota.QuotaThreshold to quota.QuotaThreshold.
Set matchedQuota.QuotaLimit to quota.QuotaLimit.
Set matchedQuota.ChangeTime to the current time.
Else: //matchedQuota is empty:
Set matchedQuota to a newly allocated FILE_QUOTA_INFORMATION structure.
Set matchedQuota.Sid to quota.Sid.
Set matchedQuota.SidLength to the length of quota.Sid.
Set matchedQuota.QuotaThreshold to quota.QuotaThreshold.
Set matchedQuota.QuotaLimit to quota.QuotaLimit.
Set matchedQuota.ChangeTime to the current time.
Insert matchedQuota into Volume.QuotaInformation.
matchedQuota.QuotaUsed is updated in the background by scanning all files in Open.File.Volume where File.SecurityDescriptor.Owner == matchedQuota.Sid.
EndIf
Upon successful completion, the object store MUST return:
Status set to STATUS_SUCCESS.