userlibandfileserver/fileserver/sfat32/sl_disk.cpp
branchRCL_3
changeset 294 039a3e647356
parent 257 3e88ff8f41d5
equal deleted inserted replaced
268:345b1ca54e88 294:039a3e647356
   284 	@param  aMessage	Refrence to server message from request
   284 	@param  aMessage	Refrence to server message from request
   285 	@param  anOffset	Offset into read data to write
   285 	@param  anOffset	Offset into read data to write
   286 
   286 
   287     @leave on error
   287     @leave on error
   288 */
   288 */
   289 void CAtaDisk::ReadL(TInt64 aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2 &aMessage,TInt anOffset, TUint aFlag) const
   289 void CAtaDisk::ReadL(TInt64 aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2 &aMessage,TInt anOffset) const
   290 	{
   290 	{
   291 
   291 
   292 	__PRINT4(_L("CAtaDisk::ReadL() pos:%u:%u, len:%u, offset:%u"), I64HIGH(aPos), I64LOW(aPos), aLength, anOffset);
   292 	__PRINT4(_L("CAtaDisk::ReadL() pos:%u:%u, len:%u, offset:%u"), I64HIGH(aPos), I64LOW(aPos), aLength, anOffset);
   293 	User::LeaveIfError(iDrive.ReadNonCritical(aPos,aLength,aTrg,aMessage,anOffset, aFlag));
   293 	User::LeaveIfError(iDrive.ReadNonCritical(aPos,aLength,aTrg,aMessage,anOffset));
   294 	}
   294 	}
   295 
       
   296 
   295 
   297 //-------------------------------------------------------------------------------------
   296 //-------------------------------------------------------------------------------------
   298 
   297 
   299 /**
   298 /**
   300     Write data to the media directly without any cached.
   299     Write data to the media directly without any cached.
   308 	@param aMessage	Refrence to server message from request, contains data
   307 	@param aMessage	Refrence to server message from request, contains data
   309 	@param anOffset	Offset into write data to use in write
   308 	@param anOffset	Offset into write data to use in write
   310 
   309 
   311     @leave on error
   310     @leave on error
   312 */
   311 */
   313 void CAtaDisk::WriteL(TInt64 aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2 &aMessage,TInt anOffset, TUint aFlag)
   312 void CAtaDisk::WriteL(TInt64 aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2 &aMessage,TInt anOffset)
   314 	{
   313 	{
   315     __PRINT4(_L("CAtaDisk::WriteL() pos:%u:%u, len:%u, offset:%u"), I64HIGH(aPos), I64LOW(aPos), aLength, anOffset);
   314     __PRINT4(_L("CAtaDisk::WriteL() pos:%u:%u, len:%u, offset:%u"), I64HIGH(aPos), I64LOW(aPos), aLength, anOffset);
   316 
   315 
   317 	//-- write data to the media directly
   316 	//-- write data to the media directly
   318     User::LeaveIfError(iDrive.WriteNonCritical(aPos,aLength,aSrc,aMessage,anOffset, aFlag));
   317     User::LeaveIfError(iDrive.WriteNonCritical(aPos,aLength,aSrc,aMessage,anOffset));
   319 
   318 
   320     //-- we need to invalidate UID cache page that corresponds to aPos (if any). This is UID caching specific. UID is stored in the first few bytes of 
   319     //-- we need to invalidate UID cache page that corresponds to aPos (if any). This is UID caching specific. UID is stored in the first few bytes of 
   321     //-- the executable module and therefore belongs to one cache page only.
   320     //-- the executable module and therefore belongs to one cache page only.
   322     //-- If someone writes to the beginning of the exe module file, corresponding UID cache page will be invalidated and re-read from the media later
   321     //-- If someone writes to the beginning of the exe module file, corresponding UID cache page will be invalidated and re-read from the media later
   323     iUidCache->InvalidateCachePage(aPos); 
   322     iUidCache->InvalidateCachePage(aPos); 
   324 
   323 
   325     //-- invalidate affected(if any) part of the FAT cache in the case if someone used to write data to FAT area, which usually do not happen 
   324     //-- invalidate affected(if any) part of the FAT cache in the case if someone used to write data to FAT area, which usually do not happen 
   326     iFatMount->FAT().InvalidateCacheL(aPos,aLength);
   325     iFatMount->FAT().InvalidateCacheL(aPos,aLength);
   327 
   326 
   328 	}
   327 	}
   329 
       
   330 
   328 
   331 //-------------------------------------------------------------------------------------
   329 //-------------------------------------------------------------------------------------
   332 
   330 
   333 /** Get information for last disk error */
   331 /** Get information for last disk error */
   334 TInt CAtaDisk::GetLastErrorInfo(TDes8& aErrorInfo) const
   332 TInt CAtaDisk::GetLastErrorInfo(TDes8& aErrorInfo) const
   444 
   442 
   445 //-------------------------------------------------------------------------------------
   443 //-------------------------------------------------------------------------------------
   446 //
   444 //
   447 // Read from ramDrive into thread relative descriptor
   445 // Read from ramDrive into thread relative descriptor
   448 //
   446 //
   449 void CRamDisk::ReadL(TInt64 aPos,TInt aLength,const TAny* /*aTrg*/,const RMessagePtr2 &aMessage,TInt anOffset, TUint /*aFlag*/) const
   447 void CRamDisk::ReadL(TInt64 aPos,TInt aLength,const TAny* /*aTrg*/,const RMessagePtr2 &aMessage,TInt anOffset) const
   450 	{
   448 	{
   451 	__PRINT2(_L("CRamDisk::ReadL TAny* Pos 0x%x, Len %d"),aPos,aLength);
   449 	__PRINT2(_L("CRamDisk::ReadL TAny* Pos 0x%x, Len %d"),aPos,aLength);
   452 	__ASSERT_ALWAYS((aPos+aLength<=I64INT(iFatMount->Size())) && (aLength>=0),User::Leave(KErrCorrupt));
   450 	__ASSERT_ALWAYS((aPos+aLength<=I64INT(iFatMount->Size())) && (aLength>=0),User::Leave(KErrCorrupt));
   453 	TUint8* pos=RamDiskBase()+I64LOW(aPos);
   451 	TUint8* pos=RamDiskBase()+I64LOW(aPos);
   454 	TPtrC8 buf(pos,aLength);
   452 	TPtrC8 buf(pos,aLength);
   455 	aMessage.WriteL(0,buf,anOffset);
   453 	aMessage.WriteL(0,buf,anOffset);
   456 	}
   454 	}
   457 
   455 
   458 	
       
   459 //-------------------------------------------------------------------------------------
   456 //-------------------------------------------------------------------------------------
   460 //
   457 //
   461 // Write from thread relative descriptor into ramDrive
   458 // Write from thread relative descriptor into ramDrive
   462 //
   459 //
   463 void CRamDisk::WriteL(TInt64 aPos,TInt aLength,const TAny* /*aSrc*/,const RMessagePtr2 &aMessage,TInt anOffset, TUint /*aFlag*/)
   460 void CRamDisk::WriteL(TInt64 aPos,TInt aLength,const TAny* /*aSrc*/,const RMessagePtr2 &aMessage,TInt anOffset)
   464 	{
   461 	{
   465 	__PRINT2(_L("CRamDisk::WriteL TAny* Pos 0x%x, Len %d"),aPos,aLength);
   462 	__PRINT2(_L("CRamDisk::WriteL TAny* Pos 0x%x, Len %d"),aPos,aLength);
   466 	__ASSERT_ALWAYS(aPos+aLength<=I64INT(iFatMount->Size()),User::Leave(KErrCorrupt));
   463 	__ASSERT_ALWAYS(aPos+aLength<=I64INT(iFatMount->Size()),User::Leave(KErrCorrupt));
   467 	TUint8* pos=RamDiskBase()+I64LOW(aPos);
   464 	TUint8* pos=RamDiskBase()+I64LOW(aPos);
   468 	TPtr8 buf(pos,aLength);
   465 	TPtr8 buf(pos,aLength);
   476 
   473 
   477 
   474 
   478 
   475 
   479 
   476 
   480 
   477 
       
   478 
       
   479 
       
   480 
       
   481 
       
   482 
       
   483 
       
   484 
       
   485 
       
   486 
       
   487 
       
   488 
       
   489 
       
   490 
       
   491 
       
   492 
       
   493 
       
   494