/* Serialize with any outstanding AsyncStore operation */
code = cm_SyncOp(scp, NULL, userp, &req, 0, CM_SCACHESYNC_ASYNCSTORE);
if (code == 0) {
- if (bScpLocked) {
- lock_ReleaseWrite(&scp->rw);
- bScpLocked = FALSE;
+ cm_SyncOpDone(scp, NULL, CM_SCACHESYNC_ASYNCSTORE);
+
+ code = cm_SyncOp(scp, NULL, userp, &req, PRSFS_WRITE,
+ CM_SCACHESYNC_NEEDCALLBACK | CM_SCACHESYNC_GETSTATUS);
+ /*
+ * If we only have 'i' bits, then we should still be able to
+ * set flush the file.
+ */
+ if (code == CM_ERROR_NOACCESS && scp->creator == userp) {
+ code = cm_SyncOp(scp, NULL, userp, &req, PRSFS_INSERT,
+ CM_SCACHESYNC_NEEDCALLBACK | CM_SCACHESYNC_GETSTATUS);
}
+ if (code == 0) {
+ if (bScpLocked) {
+ lock_ReleaseWrite(&scp->rw);
+ bScpLocked = FALSE;
+ }
- code = cm_FSync(scp, userp, &req, bScpLocked);
+ code = cm_FSync(scp, userp, &req, bScpLocked);
+ }
}
if (bLastHandle && code)
goto unlock;
{
int count = 0;
+ pResultCB->Authenticated = cm_HaveToken(userp, scp->fid.cell);
+
do {
if (count++ > 0) {
Sleep(350);
userp, &req, &ldp);
if (code == 0)
code = RDR_CheckAccess(scp, userp, &req, OpenCB->DesiredAccess, &pResultCB->GrantedAccess);
+
+
cm_CheckNTOpenDone(scp, userp, &req, &ldp);
} while (count < 100 && (code == CM_ERROR_RETRY || code == CM_ERROR_WOULDBLOCK));
}
if (rockp) {
req.flags &= ~CM_REQ_NORETRY;
- rockp->base = QueueOffset;
- rockp->length.LowPart = QueueLength;
+ rockp->base = BeginOffset;
+ rockp->length.LowPart = length;
rockp->length.HighPart = 0;
cm_QueueBKGRequest(scp, RDR_BkgFetch, rockp, userp, &req);
lock_ObtainWrite(&scp->rw);
code = cm_SyncOp(scp, NULL, userp, &req, PRSFS_WRITE,
CM_SCACHESYNC_NEEDCALLBACK | CM_SCACHESYNC_GETSTATUS);
+ if (code == CM_ERROR_NOACCESS && scp->creator == userp) {
+ code = cm_SyncOp(scp, NULL, userp, &req, PRSFS_INSERT,
+ CM_SCACHESYNC_NEEDCALLBACK | CM_SCACHESYNC_GETSTATUS);
+ }
lock_ReleaseWrite(&scp->rw);
if (code == 0)
code = cm_FSync(scp, userp, &req, FALSE);
lock_ObtainWrite(&scp->rw);
code = cm_SyncOp(scp, NULL, userp, &req, PRSFS_WRITE,
CM_SCACHESYNC_NEEDCALLBACK | CM_SCACHESYNC_GETSTATUS);
+ if (code == CM_ERROR_NOACCESS && scp->creator == userp) {
+ code = cm_SyncOp(scp, NULL, userp, &req, PRSFS_INSERT,
+ CM_SCACHESYNC_NEEDCALLBACK | CM_SCACHESYNC_GETSTATUS);
+ }
lock_ReleaseWrite(&scp->rw);
if (code == 0) {
/*
cm_scache_t *scp = NULL;
cm_volume_t *volp = NULL;
afs_uint32 volType;
- cm_cell_t *cellp = NULL;
cm_fid_t Fid;
afs_uint32 code;
cm_req_t req;
(sizeof(pResultCB->VolumeLabel) / sizeof(WCHAR)) + 1);
if ( pResultCB->VolumeLabelLength )
pResultCB->VolumeLabelLength--;
+
+ pResultCB->CellLength = cm_Utf8ToUtf16( "Freelance.Local", -1, pResultCB->Cell,
+ (sizeof(pResultCB->Cell) / sizeof(WCHAR)) + 1);
+ if ( pResultCB->CellLength )
+ pResultCB->CellLength--;
} else {
memcpy(&pResultCB->VolumeCreationTime, &ft, sizeof(ft));
}
if (code == 0) {
- if (volStat.MaxQuota)
- {
- pResultCB->TotalAllocationUnits.QuadPart = volStat.MaxQuota;
- if (volType == ROVOL || volType == BACKVOL) {
- pResultCB->AvailableAllocationUnits.QuadPart = 0;
- }
- else
+ if (volType == ROVOL || volType == BACKVOL) {
+ pResultCB->TotalAllocationUnits.QuadPart = volStat.BlocksInUse;
+ pResultCB->AvailableAllocationUnits.QuadPart = 0;
+ } else {
+ if (volStat.MaxQuota)
{
+ pResultCB->TotalAllocationUnits.QuadPart = volStat.MaxQuota;
pResultCB->AvailableAllocationUnits.QuadPart =
min(volStat.MaxQuota - volStat.BlocksInUse, volStat.PartBlocksAvail);
}
- }
- else
- {
- pResultCB->TotalAllocationUnits.QuadPart = volStat.PartMaxBlocks;
- if (volType == ROVOL || volType == BACKVOL) {
- pResultCB->AvailableAllocationUnits.QuadPart = 0;
- }
else
{
+ pResultCB->TotalAllocationUnits.QuadPart = volStat.PartMaxBlocks;
pResultCB->AvailableAllocationUnits.QuadPart = volStat.PartBlocksAvail;
}
}
pResultCB->VolumeLabelLength = cm_Utf8ToUtf16( volp->namep, -1, pResultCB->VolumeLabel,
(sizeof(pResultCB->VolumeLabel) / sizeof(WCHAR)) + 1);
+
+ if ( pResultCB->VolumeLabelLength) {
+
+ /* add .readonly and .backup if appropriate */
+ switch ( volType) {
+ case ROVOL:
+ pResultCB->VolumeLabelLength--;
+ pResultCB->VolumeLabelLength += cm_Utf8ToUtf16( ".readonly", -1,
+ &pResultCB->VolumeLabel[ pResultCB->VolumeLabelLength],
+ (sizeof(pResultCB->VolumeLabel) / sizeof(WCHAR)) - pResultCB->VolumeLabelLength + 1);
+ break;
+
+ case BACKVOL:
+ pResultCB->VolumeLabelLength--;
+ pResultCB->VolumeLabelLength += cm_Utf8ToUtf16( ".backup", -1,
+ &pResultCB->VolumeLabel[ pResultCB->VolumeLabelLength],
+ (sizeof(pResultCB->VolumeLabel) / sizeof(WCHAR)) - pResultCB->VolumeLabelLength + 1);
+ break;
+ }
+ }
+
+ /* do not include the trailing nul */
if ( pResultCB->VolumeLabelLength )
pResultCB->VolumeLabelLength--;
+ pResultCB->CellLength = cm_Utf8ToUtf16( volp->cellp->name, -1, pResultCB->Cell,
+ (sizeof(pResultCB->Cell) / sizeof(WCHAR)) + 1);
+
+ /* do not include the trailing nul */
+ if ( pResultCB->CellLength )
+ pResultCB->CellLength--;
+
if (sync_done) {
if (!scp_locked) {
lock_ObtainWrite(&scp->rw);
cm_scache_t *scp = NULL;
cm_volume_t *volp = NULL;
afs_uint32 volType;
- cm_cell_t *cellp = NULL;
cm_fid_t Fid;
afs_uint32 code;
cm_req_t req;
}
if (code == 0) {
- if (volStat.MaxQuota)
- {
- pResultCB->TotalAllocationUnits.QuadPart = volStat.MaxQuota;
- if (volType == ROVOL || volType == BACKVOL) {
- pResultCB->AvailableAllocationUnits.QuadPart = 0;
- }
- else
+ if (volType == ROVOL || volType == BACKVOL) {
+ pResultCB->TotalAllocationUnits.QuadPart = volStat.BlocksInUse;
+ pResultCB->AvailableAllocationUnits.QuadPart = 0;
+ } else {
+ if (volStat.MaxQuota)
{
+ pResultCB->TotalAllocationUnits.QuadPart = volStat.MaxQuota;
pResultCB->AvailableAllocationUnits.QuadPart =
min(volStat.MaxQuota - volStat.BlocksInUse, volStat.PartBlocksAvail);
}
- }
- else
- {
- pResultCB->TotalAllocationUnits.QuadPart = volStat.PartMaxBlocks;
- if (volType == ROVOL || volType == BACKVOL) {
- pResultCB->AvailableAllocationUnits.QuadPart = 0;
- }
else
{
+ pResultCB->TotalAllocationUnits.QuadPart = volStat.PartMaxBlocks;
pResultCB->AvailableAllocationUnits.QuadPart = volStat.PartBlocksAvail;
}
}