userlibandfileserver/fileserver/sfat32/sl_disk.cpp
branchRCL_3
changeset 42 a179b74831c9
parent 19 4a8fed1c0ef6
child 43 c1f20ce4abcf
equal deleted inserted replaced
41:0ffb4e86fcc9 42:a179b74831c9
   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) const
   289 void CAtaDisk::ReadL(TInt64 aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2 &aMessage,TInt anOffset, TUint aFlag) 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));
   293 	User::LeaveIfError(iDrive.ReadNonCritical(aPos,aLength,aTrg,aMessage,anOffset, aFlag));
   294 	}
   294 	}
       
   295 
   295 
   296 
   296 //-------------------------------------------------------------------------------------
   297 //-------------------------------------------------------------------------------------
   297 
   298 
   298 /**
   299 /**
   299     Write data to the media directly without any cached.
   300     Write data to the media directly without any cached.
   307 	@param aMessage	Refrence to server message from request, contains data
   308 	@param aMessage	Refrence to server message from request, contains data
   308 	@param anOffset	Offset into write data to use in write
   309 	@param anOffset	Offset into write data to use in write
   309 
   310 
   310     @leave on error
   311     @leave on error
   311 */
   312 */
   312 void CAtaDisk::WriteL(TInt64 aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2 &aMessage,TInt anOffset)
   313 void CAtaDisk::WriteL(TInt64 aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2 &aMessage,TInt anOffset, TUint aFlag)
   313 	{
   314 	{
   314     __PRINT4(_L("CAtaDisk::WriteL() pos:%u:%u, len:%u, offset:%u"), I64HIGH(aPos), I64LOW(aPos), aLength, anOffset);
   315     __PRINT4(_L("CAtaDisk::WriteL() pos:%u:%u, len:%u, offset:%u"), I64HIGH(aPos), I64LOW(aPos), aLength, anOffset);
   315 
   316 
   316 	//-- write data to the media directly
   317 	//-- write data to the media directly
   317     User::LeaveIfError(iDrive.WriteNonCritical(aPos,aLength,aSrc,aMessage,anOffset));
   318     User::LeaveIfError(iDrive.WriteNonCritical(aPos,aLength,aSrc,aMessage,anOffset, aFlag));
   318 
   319 
   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 
   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 
   320     //-- the executable module and therefore belongs to one cache page only.
   321     //-- the executable module and therefore belongs to one cache page only.
   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
   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
   322     iUidCache->InvalidateCachePage(aPos); 
   323     iUidCache->InvalidateCachePage(aPos); 
   323 
   324 
   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 
   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 
   325     iFatMount->FAT().InvalidateCacheL(aPos,aLength);
   326     iFatMount->FAT().InvalidateCacheL(aPos,aLength);
   326 
   327 
   327 	}
   328 	}
       
   329 
   328 
   330 
   329 //-------------------------------------------------------------------------------------
   331 //-------------------------------------------------------------------------------------
   330 
   332 
   331 /** Get information for last disk error */
   333 /** Get information for last disk error */
   332 TInt CAtaDisk::GetLastErrorInfo(TDes8& aErrorInfo) const
   334 TInt CAtaDisk::GetLastErrorInfo(TDes8& aErrorInfo) const
   442 
   444 
   443 //-------------------------------------------------------------------------------------
   445 //-------------------------------------------------------------------------------------
   444 //
   446 //
   445 // Read from ramDrive into thread relative descriptor
   447 // Read from ramDrive into thread relative descriptor
   446 //
   448 //
   447 void CRamDisk::ReadL(TInt64 aPos,TInt aLength,const TAny* /*aTrg*/,const RMessagePtr2 &aMessage,TInt anOffset) const
   449 void CRamDisk::ReadL(TInt64 aPos,TInt aLength,const TAny* /*aTrg*/,const RMessagePtr2 &aMessage,TInt anOffset, TUint /*aFlag*/) const
   448 	{
   450 	{
   449 	__PRINT2(_L("CRamDisk::ReadL TAny* Pos 0x%x, Len %d"),aPos,aLength);
   451 	__PRINT2(_L("CRamDisk::ReadL TAny* Pos 0x%x, Len %d"),aPos,aLength);
   450 	__ASSERT_ALWAYS((aPos+aLength<=I64INT(iFatMount->Size())) && (aLength>=0),User::Leave(KErrCorrupt));
   452 	__ASSERT_ALWAYS((aPos+aLength<=I64INT(iFatMount->Size())) && (aLength>=0),User::Leave(KErrCorrupt));
   451 	TUint8* pos=RamDiskBase()+I64LOW(aPos);
   453 	TUint8* pos=RamDiskBase()+I64LOW(aPos);
   452 	TPtrC8 buf(pos,aLength);
   454 	TPtrC8 buf(pos,aLength);
   453 	aMessage.WriteL(0,buf,anOffset);
   455 	aMessage.WriteL(0,buf,anOffset);
   454 	}
   456 	}
   455 
   457 
       
   458 	
   456 //-------------------------------------------------------------------------------------
   459 //-------------------------------------------------------------------------------------
   457 //
   460 //
   458 // Write from thread relative descriptor into ramDrive
   461 // Write from thread relative descriptor into ramDrive
   459 //
   462 //
   460 void CRamDisk::WriteL(TInt64 aPos,TInt aLength,const TAny* /*aSrc*/,const RMessagePtr2 &aMessage,TInt anOffset)
   463 void CRamDisk::WriteL(TInt64 aPos,TInt aLength,const TAny* /*aSrc*/,const RMessagePtr2 &aMessage,TInt anOffset, TUint /*aFlag*/)
   461 	{
   464 	{
   462 	__PRINT2(_L("CRamDisk::WriteL TAny* Pos 0x%x, Len %d"),aPos,aLength);
   465 	__PRINT2(_L("CRamDisk::WriteL TAny* Pos 0x%x, Len %d"),aPos,aLength);
   463 	__ASSERT_ALWAYS(aPos+aLength<=I64INT(iFatMount->Size()),User::Leave(KErrCorrupt));
   466 	__ASSERT_ALWAYS(aPos+aLength<=I64INT(iFatMount->Size()),User::Leave(KErrCorrupt));
   464 	TUint8* pos=RamDiskBase()+I64LOW(aPos);
   467 	TUint8* pos=RamDiskBase()+I64LOW(aPos);
   465 	TPtr8 buf(pos,aLength);
   468 	TPtr8 buf(pos,aLength);
   473 
   476 
   474 
   477 
   475 
   478 
   476 
   479 
   477 
   480 
   478 
       
   479 
       
   480 
       
   481 
       
   482 
       
   483 
       
   484 
       
   485 
       
   486 
       
   487 
       
   488 
       
   489 
       
   490 
       
   491 
       
   492 
       
   493 
       
   494