userlibandfileserver/fileserver/sfile/sf_file.cpp
changeset 286 48e57fb1237e
parent 273 6a75fa55495f
child 299 b5a01337d018
equal deleted inserted replaced
285:ff5437e4337c 286:48e57fb1237e
  2770 	iFile->DemoteShare(this);
  2770 	iFile->DemoteShare(this);
  2771 	iFile->CancelAsyncReadRequest(this, NULL);
  2771 	iFile->CancelAsyncReadRequest(this, NULL);
  2772 	iFile->Close();
  2772 	iFile->Close();
  2773 	}
  2773 	}
  2774 
  2774 
  2775 void CFileShare::Close()
       
  2776 	{
       
  2777 	
       
  2778 	// Flush the write cache before closing the file share
       
  2779 	// NB If there is any dirty data, then a new request will be allocated which will increase
       
  2780 	// the reference count on this file share, thus preventing it from being deleted untill all 
       
  2781 	// data has been flushed
       
  2782 	if (AccessCount() == 1)
       
  2783 		{
       
  2784 		CFileCache* fileCache = File().FileCache();
       
  2785 		if (fileCache)
       
  2786 			fileCache->FlushDirty();
       
  2787 		}
       
  2788 
       
  2789 	CFsDispatchObject::Close();
       
  2790 	}
       
  2791 
  2775 
  2792 
  2776 
  2793 /**
  2777 /**
  2794 Check that the media is still mounted.
  2778 Check that the media is still mounted.
  2795 
  2779 
  3265 	// If this was the last clamp, check for outstanding dismount requests
  3249 	// If this was the last clamp, check for outstanding dismount requests
  3266 	if (noOfClamps == 1)
  3250 	if (noOfClamps == 1)
  3267 		{
  3251 		{
  3268 		ASSERT(NoOfClamps() == 0);
  3252 		ASSERT(NoOfClamps() == 0);
  3269 		drive.SetClampFlag(EFalse);
  3253 		drive.SetClampFlag(EFalse);
  3270 		if (drive.DismountDeferred())
  3254 		// dismount now if no clients waiting...
  3271 			r = drive.DeferredDismount();
  3255 		r = drive.DeferredDismountCheck();
  3272 		}
  3256 		}
  3273 
  3257 
  3274 	return r;
  3258 	return r;
  3275 	}
  3259 	}
  3276 
  3260