# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1262864325 -7200 # Node ID 0173bcd7697c432ca9f522dc235d356689911d77 # Parent 56f325a607eadee5bddfb752a9541e749b0be6c9 Revision: 201001 Kit: 201001 diff -r 56f325a607ea -r 0173bcd7697c brdbootldr/ubootldr/inflate.c --- a/brdbootldr/ubootldr/inflate.c Wed Dec 23 11:43:31 2009 +0000 +++ b/brdbootldr/ubootldr/inflate.c Thu Jan 07 13:38:45 2010 +0200 @@ -2,7 +2,7 @@ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" +* under the terms of the License "Eclipse Public License v1.0" * which accompanies this distribution, and is available * at the URL "http://www.eclipse.org/legal/epl-v10.html". * diff -r 56f325a607ea -r 0173bcd7697c bsptemplate/asspandvariant/template_variant/exiic.mmp --- a/bsptemplate/asspandvariant/template_variant/exiic.mmp Wed Dec 23 11:43:31 2009 +0000 +++ b/bsptemplate/asspandvariant/template_variant/exiic.mmp Thu Jan 07 13:38:45 2010 +0200 @@ -57,8 +57,7 @@ //SYMBIAN_BASE_SYSTEMINCLUDE(template) //SYMBIAN_BASE_SYSTEMINCLUDE(template/specific) -//library iic.lib // iic.lib provides the IIC Controller. - // This is included from the variant.mmh, so not needed here. +//library iic.lib // commented out as this iic.lib is now included from iic_channel.mmh library VariantTarget(gpio,lib) diff -r 56f325a607ea -r 0173bcd7697c bsptemplate/asspandvariant/template_variant/variant.mmh --- a/bsptemplate/asspandvariant/template_variant/variant.mmh Wed Dec 23 11:43:31 2009 +0000 +++ b/bsptemplate/asspandvariant/template_variant/variant.mmh Thu Jan 07 13:38:45 2010 +0200 @@ -154,5 +154,5 @@ #endif // Uncomment the following if IIC Controller is required -library iic.lib +// library iic.lib // commented out as this iic.lib is now included from iic_channel.mmh diff -r 56f325a607ea -r 0173bcd7697c halservices/hal/inc/hal_data.h --- a/halservices/hal/inc/hal_data.h Wed Dec 23 11:43:31 2009 +0000 +++ b/halservices/hal/inc/hal_data.h Thu Jan 07 13:38:45 2010 +0200 @@ -1287,6 +1287,7 @@ EMachineUid_EmuBoard=0x1200afed, EMachineUid_OmapH6=0x10286564, EMachineUid_OmapZoom=0x10286565, + EMachineUid_STE8500=0x101FF810, }; diff -r 56f325a607ea -r 0173bcd7697c kernel/eka/bld.inf --- a/kernel/eka/bld.inf Wed Dec 23 11:43:31 2009 +0000 +++ b/kernel/eka/bld.inf Thu Jan 07 13:38:45 2010 +0200 @@ -55,7 +55,7 @@ include/collate.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(collate.h) include/k32keys.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(k32keys.h) include/k32keys.inl SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(k32keys.inl) -include/u32std.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(u32std.h) +include/u32std.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(u32std.h) include/u32hal.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(u32hal.h) include/u32property.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(u32property.h) include/u32exec.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(u32exec.h) @@ -312,11 +312,12 @@ include/e32svr.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(e32svr.h) include/e32notif.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(e32notif.h) include/e32ktran.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(e32ktran.h) -include/e32debug.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(e32debug.h) +include/e32debug.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(e32debug.h) include/e32lmsg.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(e32lmsg.h) include/e32event.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(e32event.h) include/e32event_private.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(e32event_private.h) -include/e32ldr.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(e32ldr.h) +include/e32ldr.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(e32ldr.h) +include/e32ldr_private.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(e32ldr_private.h) include/e32test.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(e32test.h) include/e32uid.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(e32uid.h) include/e32ver.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(e32ver.h) diff -r 56f325a607ea -r 0173bcd7697c kernel/eka/compsupp/bld.inf --- a/kernel/eka/compsupp/bld.inf Wed Dec 23 11:43:31 2009 +0000 +++ b/kernel/eka/compsupp/bld.inf Thu Jan 07 13:38:45 2010 +0200 @@ -46,7 +46,7 @@ PRJ_MMPFILES -#ifndef GCCXML +#if !defined GCCXML && !defined GCCE symcpp/scppnwdl.mmp rvct/dfprvct-thunk.mmp diff -r 56f325a607ea -r 0173bcd7697c kernel/eka/debug/securityServer/inc/c_security_svr_session.h --- a/kernel/eka/debug/securityServer/inc/c_security_svr_session.h Wed Dec 23 11:43:31 2009 +0000 +++ b/kernel/eka/debug/securityServer/inc/c_security_svr_session.h Thu Jan 07 13:38:45 2010 +0200 @@ -29,6 +29,7 @@ #include "c_security_svr_async.h" #include +#include #include diff -r 56f325a607ea -r 0173bcd7697c kernel/eka/drivers/debug/group/bld.inf --- a/kernel/eka/drivers/debug/group/bld.inf Wed Dec 23 11:43:31 2009 +0000 +++ b/kernel/eka/drivers/debug/group/bld.inf Thu Jan 07 13:38:45 2010 +0200 @@ -27,15 +27,15 @@ PRJ_EXPORTS -../../../debug/crashMonitor/inc/scmonitor.h -../../../debug/crashMonitor/inc/scmdatatypes.h -../../../debug/crashMonitor/inc/scmbytestreamutil.h -../../../debug/crashMonitor/inc/scmbytestreamutil.inl -../../../debug/crashMonitor/inc/crashlogwalker.h -../../../debug/crashMonitor/inc/scmconfig.h -../../../debug/crashMonitor/inc/scmconfigitem.h -../../../debug/crashmonitor/inc/scmdatasave.h -../../../debug/crashmonitor/inc/scmtrace.h +../../../debug/crashMonitor/inc/scmonitor.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(scmonitor.h) +../../../debug/crashMonitor/inc/scmdatatypes.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(scmdatatypes.h) +../../../debug/crashMonitor/inc/scmbytestreamutil.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(scmbytestreamutil.h) +../../../debug/crashMonitor/inc/scmbytestreamutil.inl SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(scmbytestreamutil.inl) +../../../debug/crashMonitor/inc/crashlogwalker.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(crashlogwalker.h) +../../../debug/crashMonitor/inc/scmconfig.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(scmconfig.h) +../../../debug/crashMonitor/inc/scmconfigitem.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(scmconfigitem.h) +../../../debug/crashmonitor/inc/scmdatasave.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(scmdatasave.h) +../../../debug/crashmonitor/inc/scmtrace.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(scmtrace.h) PRJ_MMPFILES diff -r 56f325a607ea -r 0173bcd7697c kernel/eka/drivers/iic/iic_channel.mmh --- a/kernel/eka/drivers/iic/iic_channel.mmh Wed Dec 23 11:43:31 2009 +0000 +++ b/kernel/eka/drivers/iic/iic_channel.mmh Thu Jan 07 13:38:45 2010 +0200 @@ -24,8 +24,13 @@ #endif #ifdef STANDALONE_CHANNEL -#define IIC_PIL_SOURCE iic_channel.cpp iic_transaction.cpp + #define IIC_PIL_SOURCE iic_channel.cpp iic_transaction.cpp #else + #ifndef IIC_SIMULATED_PSL + library iic.lib + #else + library iic_testpsl.lib + #endif #define IIC_PIL_SOURCE iic_channel.cpp #endif diff -r 56f325a607ea -r 0173bcd7697c kernel/eka/drivers/locmedia/locmedia.cpp --- a/kernel/eka/drivers/locmedia/locmedia.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kernel/eka/drivers/locmedia/locmedia.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -348,7 +348,7 @@ Kern::Printf("Drive %d Caps:", aDrive->iDriveNumber); Kern::Printf("Size: %lx", c.iSize); Kern::Printf("Type: %08x", c.iType); - Kern::Printf("Batt: %08x", c.iBattery); + Kern::Printf("Bus : %08x", c.iConnectionBusType); Kern::Printf("DAtt: %08x", c.iDriveAtt); Kern::Printf("MAtt: %08x", c.iMediaAtt); Kern::Printf("Base: %08x", c.iBaseAddress); @@ -615,27 +615,45 @@ case RLocalDrive::EControlPasswordLock: { m.Id()=EPasswordLock; - TLocalDrivePasswordData* ppd = (TLocalDrivePasswordData*)a1; - m.RemoteDes()=(TAny*)ppd; - r=iDrive->Request(m); + m.RemoteDes() = a1; + + TMediaPassword oldPasswd; + TMediaPassword newPasswd; + TLocalDrivePasswordData pswData; + r = ReadPasswordData(m, pswData, oldPasswd, newPasswd); + + if (r == KErrNone) + r = iDrive->Request(m); break; } case RLocalDrive::EControlPasswordUnlock: { m.Id()=EPasswordUnlock; - TLocalDrivePasswordData* ppd = (TLocalDrivePasswordData*)a1; - m.RemoteDes()=(TAny*)ppd; - r=iDrive->Request(m); + m.RemoteDes() = a1; + + TMediaPassword oldPasswd; + TMediaPassword newPasswd; + TLocalDrivePasswordData pswData; + r = ReadPasswordData(m, pswData, oldPasswd, newPasswd); + if(r == KErrNone) + r=iDrive->Request(m); + if (r == KErrNone) iDrive->iPrimaryMedia->iTotalPartitionsOpened = 0; break; } case RLocalDrive::EControlPasswordClear: { m.Id()=EPasswordClear; - TLocalDrivePasswordData* ppd = (TLocalDrivePasswordData*)a1; - m.RemoteDes()=(TAny*)ppd; - r=iDrive->Request(m); + m.RemoteDes() = a1; + + TMediaPassword oldPasswd; + TMediaPassword newPasswd; + TLocalDrivePasswordData pswData; + r = ReadPasswordData(m, pswData, oldPasswd, newPasswd); + + if (r == KErrNone) + r = iDrive->Request(m); break; } case RLocalDrive::EControlPasswordErase: @@ -660,15 +678,43 @@ break; case RLocalDrive::EControlReadPasswordStore: { + TUint8 passData[TPasswordStore::EMaxPasswordLength]; + m.RemoteDes() = (TAny*) passData; + m.Length() = sizeof(passData); m.Id()=EReadPasswordStore; - m.RemoteDes()=(TDes8*)a1; r=iDrive->Request(m); + if (r==KErrNone) + { + TPtr8 pData(passData, (TInt) m.Length(), TPasswordStore::EMaxPasswordLength); + m.RemoteDes()=(TDes8*)a1; + r = m.WriteRemote(&pData,0); + } break; } case RLocalDrive::EControlWritePasswordStore: { + TUint8 passData[TPasswordStore::EMaxPasswordLength]; + TPtr8 pData(passData, TPasswordStore::EMaxPasswordLength); + + DThread* pT=m.RemoteThread(); + if (!pT) + pT=m.Client(); + + m.RemoteDes() = (TDes8*)a1; + r = Kern::ThreadGetDesLength(pT, m.RemoteDes()); + if ( r > pData.MaxLength() ) + r = KErrOverflow; + if ( r < KErrNone) + break; + + r = m.ReadRemote(&pData,0); + if (r != KErrNone) + break; + + + m.RemoteDes() = (TAny*) pData.Ptr(); + m.Length() = pData.Length(); m.Id()=EWritePasswordStore; - m.RemoteDes()=(TDes8*)a1; r=iDrive->Request(m); if(r == KErrNone) iDrive->iPrimaryMedia->iTotalPartitionsOpened = 0; @@ -677,8 +723,16 @@ case RLocalDrive::EControlPasswordStoreLengthInBytes: { m.Id()=EPasswordStoreLengthInBytes; - m.RemoteDes()=a1; + TInt length; + m.RemoteDes() = (TAny*) &length; r=iDrive->Request(m); + + if (r == KErrNone) + { + m.RemoteDes()=a1; + r = m.WriteRemoteRaw(&length,sizeof(TInt)); + } + break; } case RLocalDrive::EControlGetLastErrorInfo: @@ -725,6 +779,32 @@ return r; } +TInt DLocalDrive::ReadPasswordData(TLocDrvRequest& aReq, TLocalDrivePasswordData& aPswData, TMediaPassword& aOldPasswd, TMediaPassword& aNewPasswd) + { + TLocalDrivePasswordData clientData; + TInt r = aReq.ReadRemoteRaw(&clientData, sizeof(TLocalDrivePasswordData)); + + DThread* pT = aReq.RemoteThread(); + if (!pT) + pT = aReq.Client(); + + if (r == KErrNone) + r = Kern::ThreadDesRead(pT, clientData.iOldPasswd, aOldPasswd, 0 ,KChunkShiftBy0); + if (r == KErrNone) + r = Kern::ThreadDesRead(pT, clientData.iNewPasswd, aNewPasswd, 0 ,KChunkShiftBy0); + + aPswData.iStorePasswd = clientData.iStorePasswd; + aPswData.iOldPasswd = &aOldPasswd; + aPswData.iNewPasswd = &aNewPasswd; + + + aReq.RemoteDes() = (TAny*) &aPswData; + aReq.Flags()|= TLocDrvRequest::EKernelBuffer; + + return r; + } + + #ifdef __DEMAND_PAGING__ TInt DLocalDrive::LockMountInfo(DPrimaryMediaBase& aPrimaryMedia, TLocDrvRequest& aReq) { @@ -954,7 +1034,7 @@ This is used by the media driver to read data from a descriptor in the requesting thread. -NB This is NOT supported in a datapaging environment as there is no guarantee +NB This is NOT supported on datapaging media as there is no guarantee that the remote descriptor won't be paged out. If this function is called and data-paging is enabled the kernel will fault in debug mode and return KErrNotSupported in release mode. @@ -972,13 +1052,20 @@ */ EXPORT_C TInt TLocDrvRequest::ReadRemote(const TAny* aSrc, TDes8* aDes) { + if (Flags() & TLocDrvRequest::EKernelBuffer) + { + aDes->Copy(* (TDesC8*) aSrc); + return KErrNone; + } + DThread* pT=RemoteThread(); if (!pT) pT=Client(); #ifdef __DEMAND_PAGING__ - __ASSERT_DEBUG(!DataPagingDeviceRegistered, LOCM_FAULT()); - if (DataPagingDeviceRegistered) + __ASSERT_DEBUG(!DataPagingDfcQ(Drive()->iPrimaryMedia), LOCM_FAULT()); + + if (DataPagingDfcQ(Drive()->iPrimaryMedia)) return KErrNotSupported; #endif @@ -1005,6 +1092,12 @@ */ EXPORT_C TInt TLocDrvRequest::ReadRemoteRaw(TAny* aDest, TInt aSize) { + if (Flags() & TLocDrvRequest::EKernelBuffer) + { + (void)memcpy(aDest, (TAny*) RemoteDes(), aSize); + return KErrNone; + } + DThread* pT=RemoteThread(); if (!pT) pT=Client(); @@ -1583,30 +1676,17 @@ } } - case DLocalDrive::ECaps: - case DLocalDrive::EGetLastErrorInfo: - case DLocalDrive::EQueryDevice: - { - TInt len = aReq.Length(); - - if (len > (TInt) ThePinObjectAllocator->iFragmentGranularity) - return KErrTooBig; - - return PinFragmentSendReceive(aReq, (TLinAddr) aReq.RemoteDes(), len); - } - case DLocalDrive::ERead: case DLocalDrive::EWrite: { return PinFragmentSendReceive(aReq, aLinAddress, aReq.Length()); } - - - // For the time being, don't support any password requests to the data paging device. - // This shouldn't be a problem as the device should be flagged as non-removable... - // This would be difficult to do anyway as it would involve pinning up to 3 buffers - - // TLocalDrivePasswordData itself, iOldPasswd & iNewPasswd + // For all these requests, aReq.RemoteDes() points to a buffer on the stack in DLocalDrive::Request() + // This is a kernel stack & so should be unpaged & not require pinning... + case DLocalDrive::ECaps: + case DLocalDrive::EGetLastErrorInfo: + case DLocalDrive::EQueryDevice: case DLocalDrive::EPasswordLock: case DLocalDrive::EPasswordUnlock: case DLocalDrive::EPasswordClear: @@ -1614,7 +1694,6 @@ case DLocalDrive::EWritePasswordStore: case DLocalDrive::EPasswordStoreLengthInBytes: case DLocalDrive::EPasswordErase: - return KErrNotSupported; default: return SendReceive(aReq); @@ -1858,7 +1937,6 @@ // default implementation // aCaps is zeroed beforehand aCaps.iType = EMediaUnknown; - // aCaps.iBattery = EBatNotSupported; } EXPORT_C TBool DPrimaryMediaBase::IsRemovableDevice(TInt& /*aSocketNum*/) @@ -1977,38 +2055,17 @@ } case DLocalDrive::EReadPasswordStore: { - TUint8 passData[TPasswordStore::EMaxPasswordLength]; - TPtr8 pData(passData, TPasswordStore::EMaxPasswordLength); - TInt r = ThePasswordStore->ReadPasswordData(pData); - if (r==KErrNone) - r = m.WriteRemote(&pData,0); + TPtr8 pswData ((TUint8*) m.RemoteDes(), (TInt) m.Length()); + TInt r = ThePasswordStore->ReadPasswordData(pswData); + m.Length() = pswData.Length(); CompleteRequest(m, r); return; } case DLocalDrive::EWritePasswordStore: { - TUint8 passData[TPasswordStore::EMaxPasswordLength]; - TPtr8 pData(passData, TPasswordStore::EMaxPasswordLength); - - DThread* pT=m.RemoteThread(); - if (!pT) - pT=m.Client(); - - TInt lengthOrError = Kern::ThreadGetDesLength(pT, m.RemoteDes() ); - if ( lengthOrError > pData.MaxLength() ) - { - CompleteRequest(m, KErrOverflow); - return; - } - else if ( lengthOrError < KErrNone) - { - CompleteRequest(m, lengthOrError); - return; - } - - TInt r = m.ReadRemote(&pData,0); - if (r==KErrNone) - r = ThePasswordStore->WritePasswordData(pData); + TPtrC8 pData((TUint8*) m.RemoteDes(), (TInt) m.Length()); + TInt r = ThePasswordStore->WritePasswordData(pData); + if(r != KErrNone) { CompleteRequest(m, r); @@ -2029,8 +2086,8 @@ case DLocalDrive::EPasswordStoreLengthInBytes: { TInt length = ThePasswordStore->PasswordStoreLengthInBytes(); - TInt r = m.WriteRemoteRaw(&length,sizeof(TInt)); - CompleteRequest(m, r); + *(TInt*) m.RemoteDes() = length; + CompleteRequest(m, KErrNone); return; } default: diff -r 56f325a607ea -r 0173bcd7697c kernel/eka/drivers/medata/pccd_ata.cpp --- a/kernel/eka/drivers/medata/pccd_ata.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kernel/eka/drivers/medata/pccd_ata.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -1779,7 +1779,7 @@ // { aInfo.iType=EMediaHardDisk; - aInfo.iBattery=EBatNotSupported; + aInfo.iConnectionBusType=EConnectionBusInternal; aInfo.iDriveAtt=KDriveAttLocal|KDriveAttRemovable; aInfo.iMediaAtt=KMediaAttFormattable; aInfo.iFileSystemId=KDriveFileSysFAT; diff -r 56f325a607ea -r 0173bcd7697c kernel/eka/drivers/medint/iram.cpp --- a/kernel/eka/drivers/medint/iram.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kernel/eka/drivers/medint/iram.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -189,7 +189,7 @@ { TLocalDriveCapsV6& caps=*(TLocalDriveCapsV6*)m.RemoteDes(); caps.iType=EMediaRam; - caps.iBattery=EBatNotSupported; + caps.iConnectionBusType=EConnectionBusInternal; caps.iDriveAtt=KDriveAttLocal|KDriveAttInternal; caps.iMediaAtt=KMediaAttVariableSize|KMediaAttFormattable; caps.iBaseAddress=(TUint8*)TInternalRamDrive::Base(); diff -r 56f325a607ea -r 0173bcd7697c kernel/eka/drivers/medlfs/flash_media.cpp --- a/kernel/eka/drivers/medlfs/flash_media.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kernel/eka/drivers/medlfs/flash_media.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -283,7 +283,7 @@ TInt DMediaDriverFlash::Caps(TLocalDriveCapsV2& caps) { caps.iType=EMediaFlash; - caps.iBattery=EBatNotSupported; + caps.iConnectionBusType=EConnectionBusInternal; caps.iDriveAtt=KDriveAttLocal|KDriveAttInternal; caps.iMediaAtt=KMediaAttFormattable; caps.iBaseAddress=(TUint8*)TInternalRamDrive::Base(); @@ -292,7 +292,7 @@ caps.iEraseBlockSize=EraseBlockSize(); __KTRACE_OPT( KLOCDRV, Kern::Printf("MLFS: ) type=%d", caps.iType) ); - __KTRACE_OPT( KLOCDRV, Kern::Printf("MLFS: ) battery=%d", caps.iBattery) ); + __KTRACE_OPT( KLOCDRV, Kern::Printf("MLFS: ) connectionbustype=%d", caps.iConnectionBusType) ); __KTRACE_OPT( KLOCDRV, Kern::Printf("MLFS: ) driveatt=0x%x", caps.iDriveAtt) ); __KTRACE_OPT( KLOCDRV, Kern::Printf("MLFS: ) mediaatt=0x%x", caps.iMediaAtt) ); __KTRACE_OPT( KLOCDRV, Kern::Printf("MLFS: ) filesystemid=0x%x", caps.iFileSystemId) ); diff -r 56f325a607ea -r 0173bcd7697c kernel/eka/drivers/medmmc/emmcptn.cpp --- a/kernel/eka/drivers/medmmc/emmcptn.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kernel/eka/drivers/medmmc/emmcptn.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -194,7 +194,7 @@ } // FAT partition ? - else if (pe->IsValidDosPartition() || pe->IsValidFAT32Partition()) + else if (pe->IsValidDosPartition() || pe->IsValidFAT32Partition() || pe->IsValidExFATPartition()) { SetPartitionEntry(&iPartitionInfo->iEntry[partitionCount],pe->iFirstSector,pe->iNumSectors); __KTRACE_OPT(KLOCDPAGING, Kern::Printf("Mmc: FAT partition found at sector #%u", pe->iFirstSector)); diff -r 56f325a607ea -r 0173bcd7697c kernel/eka/drivers/medmmc/medmmc.cpp --- a/kernel/eka/drivers/medmmc/medmmc.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kernel/eka/drivers/medmmc/medmmc.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -524,7 +524,10 @@ * otherwise Double buffering will never be utilised because all transfers will fit into the cache. */ const TUint32 maxDbBlocks = iSocket->MaxDataTransferLength() >> iBlkLenLog2; - __ASSERT_DEBUG(iBlocksInBuffer <= (TInt)maxDbBlocks, Panic(EDBNotOptimal)); + if (maxDbBlocks) + { + __ASSERT_DEBUG(iBlocksInBuffer <= (TInt)maxDbBlocks, Panic(EDBNotOptimal)); + } #endif } @@ -1129,7 +1132,7 @@ // iDoPhysicalAddress = iCurrentReq->IsPhysicalAddress(); - const TInt64 medEnd = aStart + aLength; + TInt64 medEnd = aStart + aLength; TInt64 maxPslEnd = medEnd; const TUint32 maxDbLength = iSocket->MaxDataTransferLength(); @@ -1180,17 +1183,21 @@ iIntBuf = ReserveWriteBlocks(aStart, iDbEnd, &iWtRBM); } else - { - // - // reserve buffers to end of first write group, or end of request range, - // whichever is lower. Note that if the range already exists in the buffer, - // e.g. because of a previous RBM, the same range will be returned. This - // means that iWtRBM can be set to zero in the callback DFC, and this code - // will retrieve the reserved range. - // - const TInt64 wtGpEnd = (iPhysStart + iPrWtGpLen) & ~iPrWtGpMsk; - const TInt64 medEnd = UMin(wtGpEnd, aStart + aLength); - iPhysEnd = (medEnd + iBlkMsk) & ~iBlkMsk; + { + if ( (iPhysEnd - iPhysStart) > iMaxBufSize) + { + // + // reserve buffers to end of first write group, or end of request range, + // whichever is lower. Note that if the range already exists in the buffer, + // e.g. because of a previous RBM, the same range will be returned. This + // means that iWtRBM can be set to zero in the callback DFC, and this code + // will retrieve the reserved range. + // + const TInt64 wtGpEnd = (iPhysStart + iPrWtGpLen) & ~iPrWtGpMsk; + medEnd = UMin(wtGpEnd, aStart + aLength); + iPhysEnd = (medEnd + iBlkMsk) & ~iBlkMsk; + } + iIntBuf = ReserveWriteBlocks(aStart, medEnd, &iWtRBM); } } //if (!iDoPhysicalAddress) @@ -1552,7 +1559,7 @@ } // FAT partition ? - else if (pe->IsValidDosPartition() || pe->IsValidFAT32Partition()) + else if (pe->IsValidDosPartition() || pe->IsValidFAT32Partition() || pe->IsValidExFATPartition()) { SetPartitionEntry(&iPartitionInfo->iEntry[partitionCount],pe->iFirstSector,pe->iNumSectors); __KTRACE_OPT(KLOCDPAGING, Kern::Printf("Mmc: FAT partition found at sector #%u", pe->iFirstSector)); @@ -2558,7 +2565,7 @@ { // Fill buffer with current media caps. aInfo.iType = EMediaHardDisk; - aInfo.iBattery = EBatNotSupported; + aInfo.iConnectionBusType = EConnectionBusInternal; aInfo.iDriveAtt = KDriveAttLocal; aInfo.iMediaAtt = KMediaAttFormattable; @@ -2665,13 +2672,15 @@ { __KTRACE_OPT(KPBUSDRV, Kern::Printf(">mmd:rdc:%x,%x", iReqCur, iReqEnd)); + if ( iCurrentReq->IsPhysicalAddress() #if defined(__DEMAND_PAGING__) && !defined(__WINS__) - if (DMediaPagingDevice::PageInRequest(*iCurrentReq)) + || DMediaPagingDevice::PageInRequest(*iCurrentReq) +#endif //DEMAND_PAGING + ) { *aAllDone = EFalse; return KErrNone; } -#endif //DEMAND_PAGING TInt64 physStart = iReqCur & ~iBlkMsk; TInt64 physEnd = Min(physStart + iMaxBufSize, (iReqEnd + iBlkMsk) & ~iBlkMsk); diff -r 56f325a607ea -r 0173bcd7697c kernel/eka/drivers/usbc/d_usbc.cpp --- a/kernel/eka/drivers/usbc/d_usbc.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kernel/eka/drivers/usbc/d_usbc.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -127,12 +127,7 @@ KUsbRequestCallbackPriority), iOtgFeatureChangePtr(NULL), iOtgFeatureCallbackInfo(this, DLddUsbcChannel::OtgFeatureChangeCallback, KUsbRequestCallbackPriority), - iBufferBaseEp0(NULL), - iBufferSizeEp0(0), iNumberOfEndpoints(0), - iHwChunkIN(NULL), - iHwChunkOUT(NULL), - iHwChunkEp0(NULL), iDeviceState(EUsbcDeviceStateUndefined), iOwnsDeviceControl(EFalse), iAlternateSetting(0), @@ -1731,9 +1726,8 @@ // Both IN and OUT buffers will be fully cached: const TUint32 cacheAttribs = EMapAttrSupRw | EMapAttrCachedMax; const TUint32 bandwidthPriority = aInfoBuf->iBandwidthPriority; - TInt totalINBufferSize = 0; - TInt totalOUTBufferSize = 0; - + + // Supports ep0+5 endpoints TInt real_ep_numbers[6] = {-1, -1, -1, -1, -1, -1}; // See if PIL will accept this interface @@ -1778,7 +1772,10 @@ goto F1; } + __KTRACE_OPT(KUSB, Kern::Printf("DLddUsbcChannel::SetInterface num_endpoints=%d", num_endpoints)); + // other endpoints + // calculate the total buffer size for (TInt i = 1; i <= num_endpoints; i++, pEndpointData++) { __KTRACE_OPT(KUSB, Kern::Printf("SetInterface for ep=%d", i)); @@ -1787,6 +1784,7 @@ r = KErrUsbBadEndpoint; goto F2; } + TUsbcEndpoint* ep = new TUsbcEndpoint(this, iController, pEndpointData, i, bandwidthPriority); alternateSettingListRec->iEndpoint[i] = ep; if (!ep) @@ -1799,20 +1797,57 @@ r = KErrNoMemory; goto F2; } - if (pEndpointData->iDir == KUsbEpDirIn) - { - totalINBufferSize += ep->BufferTotalSize(); - __KTRACE_OPT(KUSB, Kern::Printf("IN buffering now %d", totalINBufferSize)); - } - else if (pEndpointData->iDir == KUsbEpDirOut) - { - totalOUTBufferSize += ep->BufferTotalSize(); - __KTRACE_OPT(KUSB, Kern::Printf("OUT buffering now %d", totalOUTBufferSize)); - } + __KTRACE_OPT(KUSB, Kern::Printf("SetInterface for ep=%d rec=0x%08x ep==0x%08x", i, alternateSettingListRec, ep)); } + // buf size of each endpoint + TInt bufSizes[KMaxEndpointsPerClient + 1]; + TInt epNum[KMaxEndpointsPerClient + 1]; + + // init + for( TInt i=0;iiEndpoint[i]->BufferSize(); + } + + __KTRACE_OPT(KUSB, Kern::Printf("Sort the endpoints:")); + + // sort the endpoint number by the bufsize decreasely + for( TInt i=1;iiEpNumDeOrderedByBufSize[i] = epNum[i]; + + __KTRACE_OPT(KUSB, Kern::Printf(" %d:%d", epNum[i], bufSizes[i])); + } + alternateSettingListRec->iEpNumDeOrderedByBufSize[num_endpoints] = epNum[num_endpoints]; + __KTRACE_OPT(KUSB, Kern::Printf(" %d:%d", epNum[num_endpoints], bufSizes[num_endpoints])); + __KTRACE_OPT(KUSB, Kern::Printf("\n")); + // chain in this alternate setting alternateSettingListRec->iNext = iAlternateSettingList; iAlternateSettingList = alternateSettingListRec; @@ -1826,47 +1861,27 @@ alternateSettingListRec->iEndpoint[i]->SetRealEpNumber(real_ep_numbers[i]); } - if (totalOUTBufferSize != 0) - { - // maximally cached always - __KTRACE_OPT(KUSB, Kern::Printf("SetInterface setting up OUT buffering size=%d", totalOUTBufferSize)); - iHwChunkOUT = SetupInterfaceMemory(totalOUTBufferSize, iHwChunkOUT, KUsbEpDirOut, cacheAttribs); - if (iHwChunkOUT == NULL) - { - __KTRACE_OPT(KPANIC, Kern::Printf("SetInterface can't get chunk for OUT buffering size=%d reason=%d", - totalOUTBufferSize, r)); - r = KErrNoMemory; - goto KillAll; - } - } - if (totalINBufferSize != 0) - { - __KTRACE_OPT(KUSB, Kern::Printf("SetInterface setting up IN buffering size=%d", totalINBufferSize)); - iHwChunkIN = SetupInterfaceMemory(totalINBufferSize, iHwChunkIN, KUsbEpDirIn, cacheAttribs); - if (iHwChunkIN == NULL) - { - __KTRACE_OPT(KPANIC, Kern::Printf("SetInterface can't get chunk for IN buffering size=%d reason=%d", - totalOUTBufferSize, r)); - r = KErrNoMemory; - goto KillAll; - } - } - __KTRACE_OPT(KUSB, Kern::Printf("SetInterface ready to exit")); - - if (aInterfaceNumber == 0) - { - // make sure we're ready to go with the main interface - iValidInterface = ETrue; - __KTRACE_OPT(KUSB, Kern::Printf("SetInterface SelectAlternateSetting")); - SelectAlternateSetting(0); - } - return KErrNone; - - KillAll: - __KTRACE_OPT(KUSB, Kern::Printf("Destroying all interfaces")); - DestroyAllInterfaces(); - DestroyEp0(); - return r; + r = SetupInterfaceMemory(iHwChunks, cacheAttribs ); + if( r==KErrNone ) + { + __KTRACE_OPT(KUSB, Kern::Printf("SetInterface ready to exit")); + + if (aInterfaceNumber == 0) + { + // make sure we're ready to go with the main interface + iValidInterface = ETrue; + __KTRACE_OPT(KUSB, Kern::Printf("SetInterface SelectAlternateSetting")); + SelectAlternateSetting(0); + } + return KErrNone; + } + else + { + __KTRACE_OPT(KUSB, Kern::Printf("Destroying all interfaces")); + DestroyAllInterfaces(); + DestroyEp0(); + return r; + } F2: delete alternateSettingListRec; @@ -1882,51 +1897,123 @@ return r; } - -DPlatChunkHw* DLddUsbcChannel::SetupInterfaceMemory(TInt aBufferSize, DPlatChunkHw* aHwChunk, - TUint aDirection, TUint32 aCacheAttribs) - { - TUint8* oldBase = NULL; - if (aHwChunk != NULL) - oldBase = reinterpret_cast(aHwChunk->LinearAddress()); - - DPlatChunkHw* chunk = ReAllocate(aBufferSize, aHwChunk, aCacheAttribs); - if (chunk == NULL) - { - // lost all interfaces: - // Tell Controller to release Interface and h/w resources associated with this - iController->DeRegisterClient(this); - } - else - { - // Parcel out the memory between endpoints - TUint8* newBase = reinterpret_cast(chunk->LinearAddress()); - TBool needsRebase = (newBase != oldBase); - TUint8* pBuf = newBase; - TUint8* pBufIf = pBuf; // this is where an interface's ep buffering starts - TUsbcAlternateSettingList* asRec = iAlternateSettingList; - // the current interface - __KTRACE_OPT(KUSB, Kern::Printf("SetupInterfaceMemory rebasing setting=%d", asRec->iSetting)); - RebaseInterfaceMemory(asRec, pBuf, aDirection); - // now the others if a rebase has occured - if (needsRebase) - { - __KTRACE_OPT(KUSB, Kern::Printf("SetupInterfaceMemory rebasing ")); - asRec = asRec->iNext; - while (asRec) - { - // Interfaces are not concurrent so they can all start at the same logical address - __KTRACE_OPT(KUSB, Kern::Printf("SetupInterfaceMemory rebasing setting=%d", asRec->iSetting)); - pBuf = pBufIf; - RebaseInterfaceMemory(asRec, pBuf, aDirection); - asRec = asRec->iNext; - } - } - __KTRACE_OPT(KUSB, Kern::Printf("SetInterface numberOfEndpoints")); - } - return chunk; - } - +// realloc the memory, and set the previous interfaces +TInt DLddUsbcChannel::SetupInterfaceMemory(RArray &aHwChunks, + TUint32 aCacheAttribs ) + { + TUsbcAlternateSettingList* asRec = iAlternateSettingList; + + // if buffers has been changed + TBool chunkChanged = EFalse; + TInt numOfEp = asRec->iNumberOfEndpoints; + + // 1, collect all bufs' sizes for the current interface + // to realloc all the chunks + __KTRACE_OPT(KUSB, Kern::Printf("Collect all buffer sizes:")); + RArray bufSizes; + for(TInt i=1;i<=numOfEp;i++) + { + TInt nextEp = asRec->iEpNumDeOrderedByBufSize[i]; + TInt epBufCount = asRec->iEndpoint[nextEp]->BufferNumber(); + __KTRACE_OPT(KUSB, Kern::Printf(" ep %d, buf count %d", nextEp, epBufCount )); + for(TInt k=0;kiEndpoint[nextEp]->BufferSize(); + TInt r = bufSizes.Append(epBufSize); + if(r!=KErrNone) + { + iController->DeRegisterClient(this); + bufSizes.Close(); + return r; + } + __KTRACE_OPT(KUSB,Kern::Printf(" %d", epBufSize )); + } + __KTRACE_OPT(KUSB, Kern::Printf("\n")); + + } + + // 2, alloc the buffer decreasely, biggest-->smallest + // 2.1 check the existing chunks + TInt bufCount = bufSizes.Count(); + __KTRACE_OPT(KUSB, Kern::Printf(" ep buf number needed %d", bufCount )); + __KTRACE_OPT(KUSB, Kern::Printf(" chunks available %d", aHwChunks.Count() )); + + TInt chunkInd = 0; + while( (chunkInd(aHwChunks[chunkInd]->LinearAddress()); + + DPlatChunkHw* chunk = ReAllocate(bufSizes[chunkInd], aHwChunks[chunkInd], aCacheAttribs); + if (chunk == NULL) + { + __KTRACE_OPT(KUSB, Kern::Printf("Failed to alloc chunks size %d!", bufSizes[chunkInd])); + // lost all interfaces: + // Tell Controller to release Interface and h/w resources associated with this + iController->DeRegisterClient(this); + bufSizes.Close(); + return KErrNoMemory; + } + else + { + // Parcel out the memory between endpoints + TUint8* newAddr = reinterpret_cast(chunk->LinearAddress()); + __KTRACE_OPT(KUSB, Kern::Printf("SetupInterfaceMemory alloc new chunk=0x%x, size=%d", newAddr,bufSizes[chunkInd])); + chunkChanged = (newAddr != oldAddr); + aHwChunks[chunkInd] = chunk; + } + chunkInd++; + } + + // 2.2 in case available chunks are not enough + while( chunkIndDeRegisterClient(this); + bufSizes.Close(); + return KErrNoMemory; + } + else + { + // Parcel out the memory between endpoints + __KTRACE_OPT(KUSB, Kern::Printf("SetupInterfaceMemory alloc new chunk=0x%x, size=%d", + reinterpret_cast(chunk->LinearAddress()), bufSizes[chunkInd])); + TInt r = aHwChunks.Append(chunk); + if(r!=KErrNone) + { + ClosePhysicalChunk(chunk); + iController->DeRegisterClient(this); + bufSizes.Close(); + return r; + } + } + chunkInd++; + } + + // 3, Set the the bufs of the interfaces + + ReSetInterfaceMemory(asRec, aHwChunks); + + if(chunkChanged) + { + __KTRACE_OPT(KUSB, Kern::Printf("SetupInterfaceMemory readdressing.")); + asRec = asRec->iNext; + while (asRec) + { + // Interfaces are not concurrent so they can all start at the same logical address + __KTRACE_OPT(KUSB, Kern::Printf("SetupInterfaceMemory readdressing setting=%d", asRec->iSetting)); + ReSetInterfaceMemory(asRec, aHwChunks); + asRec = asRec->iNext; + } + } + return KErrNone; + } TInt DLddUsbcChannel::SetupEp0() { @@ -1945,44 +2032,70 @@ { return KErrNoMemory; } - TInt bufferSize = ep0->BufferTotalSize(); - TUint32 cacheAttribs = EMapAttrSupRw | EMapAttrCachedMax; - iHwChunkEp0 = Allocate(bufferSize, cacheAttribs); - if (iHwChunkEp0 == NULL) - { - return KErrNoMemory; - } - iBufferSizeEp0 = bufferSize; - iBufferBaseEp0 = (TUint8*) iHwChunkEp0->LinearAddress(); - ep0->SetBufferBase(iBufferBaseEp0); - ep0->SetRealEpNumber(0); - __KTRACE_OPT(KUSB, Kern::Printf("SetupEp0 60 buffersize=%d", iBufferSizeEp0)); - __KTRACE_OPT(KUSB, Kern::Printf("SetupEp0 exit bufferbase=0x%08x", iBufferBaseEp0)); + + TInt bufferNum = ep0->BufferNumber(); + TInt bufferSize = ep0->BufferSize(); + TUint32 cacheAttribs = EMapAttrSupRw | EMapAttrCachedMax; + + for(TInt i=0;iLinearAddress(); + ep0->SetBufferAddr( i, buf); + __KTRACE_OPT(KUSB, Kern::Printf("SetupEp0 60 buffer number %d", i)); + __KTRACE_OPT(KUSB, Kern::Printf("SetupEp0 60 buffer size %d", bufferSize)); + } + + ep0->SetRealEpNumber(0); return KErrNone; } - -void DLddUsbcChannel::RebaseInterfaceMemory(TUsbcAlternateSettingList* aAlternateSettingListRec, - TUint8* aBase, TUint aDirection) - { - TUint8* pBuf = aBase; - __KTRACE_OPT(KUSB, Kern::Printf("RebaseInterfaceMemory buffer base rec= 0x%08x", aAlternateSettingListRec)); - for (TInt i = 1; i <= aAlternateSettingListRec->iNumberOfEndpoints; i++) - { - TUsbcEndpoint* ep = aAlternateSettingListRec->iEndpoint[i]; - if (ep != NULL && (ep->EndpointInfo()->iDir == aDirection)) - { - __KTRACE_OPT(KUSB, Kern::Printf("RebaseInterfaceMemory buffer base for ep%d 0x%08x 0x%08x", - i, pBuf, ep)); - pBuf = ep->SetBufferBase(pBuf); - } - else - { - __KTRACE_OPT(KUSB, Kern::Printf("RebaseInterfaceMemory ep%d wrong direction", i)); - } - } - } - +// Set buffer address of the interface +// Precondition: Enough chunks available. +void DLddUsbcChannel::ReSetInterfaceMemory(TUsbcAlternateSettingList* aAlternateSettingListRec, + RArray &aHwChunks) + { + TUsbcAlternateSettingList* asRec = aAlternateSettingListRec; + + // set all the interfaces + TInt chunkInd = 0; + TInt numOfEp = asRec->iNumberOfEndpoints; + + for (TInt i = 1; i <= numOfEp; i++) + { + TInt nextEp = asRec->iEpNumDeOrderedByBufSize[i]; + TInt epBufCount = asRec->iEndpoint[nextEp]->BufferNumber(); + for(TInt k=0;kiEndpoint[nextEp]; + if (ep != NULL ) + { + TUint8* pBuf = NULL; + pBuf = reinterpret_cast(aHwChunks[chunkInd]->LinearAddress()); + ep->SetBufferAddr( k, pBuf); + __KTRACE_OPT(KUSB, Kern::Printf(" ep %d, buf %d, addr 0x%x", nextEp, k, pBuf )); + chunkInd++; + __ASSERT_DEBUG(chunkInd<=aHwChunks.Count(), + Kern::Printf(" Error: available chunks %d, run out at epInd%d, bufInd%d", + aHwChunks.Count(), i, k)); + __ASSERT_DEBUG(chunkInd<=aHwChunks.Count(), + Kern::Fault("usbc.ldd", __LINE__)); + } + } + } + + } void DLddUsbcChannel::DestroyAllInterfaces() { @@ -1998,8 +2111,11 @@ iNumberOfEndpoints = 0; iAlternateSettingList = NULL; - ClosePhysicalChunk(iHwChunkIN); - ClosePhysicalChunk(iHwChunkOUT); + for(TInt i=0;iFlushQueue(); + + if (iStatusChangePtr) + { + iStatusChangeReq->Data() = iController->GetDeviceStatus(); + iStatusChangePtr = NULL; + + if (iStatusChangeReq->IsReady()) + { + iRequestStatus[i] = NULL; + Kern::QueueRequestComplete(iClient, iStatusChangeReq, + KErrDisconnected); + } + } + + } + else if (i == RDevUsbcClient::ERequestEndpointStatusNotify) + { + + if (iEndpointStatusChangePtr) + { + TUint epBitmap = 0; + for (TInt i = 0; i <= iNumberOfEndpoints; i++) + { + TInt v = iController->GetEndpointStatus(this, iEndpoint[i]->RealEpNumber()); + TUint b; + (v == EEndpointStateStalled) ? b = 1 : b = 0; + epBitmap |= b << i; + } + + iEndpointStatusChangeReq->Data() = epBitmap; + iEndpointStatusChangePtr = NULL; + } + + if (iEndpointStatusChangeReq->IsReady()) + { + iRequestStatus[i] = NULL; + Kern::QueueRequestComplete(iClient,iEndpointStatusChangeReq,KErrDisconnected); + } + + } + else if (i == RDevUsbcClient::ERequestOtgFeaturesNotify) + { + + if (iOtgFeatureChangePtr) + { + TUint8 features; + iController->GetCurrentOtgFeatures(features); + iOtgFeatureChangeReq->Data()=features; + iOtgFeatureChangePtr = NULL; + } + + if (iOtgFeatureChangeReq->IsReady()) + { + iRequestStatus[i] = NULL; + Kern::QueueRequestComplete(iClient, iOtgFeatureChangeReq, + KErrDisconnected); + } + + } + else + { + CompleteBufferRequest(iClient, i, KErrDisconnected); + } + } } + iStatusCallbackInfo.Cancel(); iEndpointStatusCallbackInfo.Cancel(); iOtgFeatureCallbackInfo.Cancel(); @@ -2911,7 +3104,7 @@ zlpReqd = iTransferInfo.iZlpReqd; } r = iDmaBuffers->TxStoreData(iLdd->Client(), iLdd->GetClientBuffer(iEndpointNumber), length, iBytesTransferred); - if (r != KErrNone) + if (r != KErrNone) return r; iDmaBuffers->TxSetActive(); iRequestCallbackInfo->SetTxBufferInfo(bufferAddr, physAddr, length); @@ -2978,6 +3171,7 @@ { for (TInt i = 0; i <= KMaxEndpointsPerClient; i++) { + iEpNumDeOrderedByBufSize[i] = -1; iEndpoint[i] = NULL; } } diff -r 56f325a607ea -r 0173bcd7697c kernel/eka/drivers/usbc/usbdma.cpp --- a/kernel/eka/drivers/usbc/usbdma.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kernel/eka/drivers/usbc/usbdma.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -127,35 +127,31 @@ __KTRACE_OPT(KUSB, Kern::Printf("TDmaBuf::~TDmaBuf()")); } - -TUint8* TDmaBuf::SetBufferBase(TUint8* aBase) - { - __KTRACE_OPT(KUSB, Kern::Printf("TDmaBuf::SetBufferBase base=0x%08x size=0x%08x", aBase, iBufSz)); - TUint8* bufPtr = aBase; - iBufBasePtr = aBase; - for (TInt i = 0; i < iNumberofBuffers; i++) - { - iDrainable[i] = iCanBeFreed[i] = EFalse; - iBuffers[i] = bufPtr; - iBufferPhys[i] = Epoc::LinearToPhysical((TLinAddr)bufPtr); - bufPtr += iBufSz; - __KTRACE_OPT(KUSB, Kern::Printf("TDmaBuf::SetBufferBase() iBuffers[%d]=0x%08x", i, iBuffers[i])); - } - return bufPtr; - } - - TInt TDmaBuf::BufferTotalSize() const { return iBufSz * iNumberofBuffers; } +TInt TDmaBuf::BufferSize() const + { + return iBufSz; + } -TUint8* TDmaBuf::BufferBase() const - { - return iBufBasePtr; - } +TInt TDmaBuf::SetBufferAddr(TInt aBufInd, TUint8* aBufAddr) + { + __ASSERT_DEBUG((aBufInd < iNumberofBuffers), + Kern::Fault(KUsbPanicLdd, __LINE__)); + iDrainable[aBufInd] = iCanBeFreed[aBufInd] = EFalse; + iBuffers[aBufInd] = aBufAddr; + iBufferPhys[aBufInd] = Epoc::LinearToPhysical((TLinAddr)aBufAddr); + __KTRACE_OPT(KUSB, Kern::Printf("TDmaBuf::SetBufferAddr() iBuffers[%d]=0x%08x", aBufInd, iBuffers[aBufInd])); + return KErrNone; + } +TInt TDmaBuf::BufferNumber() const + { + return iNumberofBuffers; + } void TDmaBuf::SetMaxPacketSize(TInt aSize) { @@ -950,13 +946,26 @@ return KErrInUse; __KTRACE_OPT(KUSB, Kern::Printf("TDmaBuf::TxStoreData 2")); - TUint8* logicalDest = iBufBasePtr; - TInt xferSz = Min(aTxLength, BufferTotalSize()); - TPtr8 des(logicalDest, xferSz, xferSz); - TInt r = Kern::ThreadBufRead(aThread, aTcb, des, aBufferOffset,KChunkShiftBy0); - if(r != KErrNone) - Kern::ThreadKill(aThread, EExitPanic, r, KUsbLDDKillCat); - return r; + + TInt remainTxLength = aTxLength; + TUint32 bufferOffset = aBufferOffset; + // Store each buffer separately + for( TInt i=0;(i0);i++) + { + TUint8* logicalDest = iBuffers[i]; + TInt xferSz = Min(remainTxLength, iBufSz); + TPtr8 des(logicalDest, xferSz, xferSz); + TInt r = Kern::ThreadBufRead(aThread, aTcb, des, bufferOffset, KChunkShiftBy0); + if(r != KErrNone) + { + Kern::ThreadKill(aThread, EExitPanic, r, KUsbLDDKillCat); + return r; + } + remainTxLength -= iBufSz; + bufferOffset += iBufSz; + } + + return KErrNone; } diff -r 56f325a607ea -r 0173bcd7697c kernel/eka/euser/cbase/ub_act.cpp --- a/kernel/eka/euser/cbase/ub_act.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kernel/eka/euser/cbase/ub_act.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -137,9 +137,20 @@ 2. the active object within the implementation of the Cancel() function. +E32USER-CBase 46 panics may occur if an active object is set active but +no request is made on its TRequestStatus, or vice-versa. This panic happens +no earlier than the next time that the active scheduler assesses which +objects are ready to run, and may happen much later. This panic is termed +a 'stray event' because it indicates that some entity has sent an event +to the active scheduler thread, but this thread is not in a state ready to handle it. + @see CActive::IsActive @see CActive::RunL @see CActive::Cancel + +@panic E32USER-CBase 42 if this active object is already active +@panic E32USER-CBase 49 if this active object has not been added to the active + scheduler. */ { __ASSERT_ALWAYS(!(iStatus.iFlags&TRequestStatus::EActive),Panic(EReqAlreadyActive)); diff -r 56f325a607ea -r 0173bcd7697c kernel/eka/euser/epoc/win32/emulator.cpp --- a/kernel/eka/euser/epoc/win32/emulator.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kernel/eka/euser/epoc/win32/emulator.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -19,6 +19,7 @@ #include #include #include +#include #include #pragma data_seg(".data2") diff -r 56f325a607ea -r 0173bcd7697c kernel/eka/euser/us_ksvr.cpp --- a/kernel/eka/euser/us_ksvr.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kernel/eka/euser/us_ksvr.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -4316,7 +4316,7 @@ // : iSize(0), iType(EMediaNotPresent), - iBattery(EBatNotSupported), + iConnectionBusType(EConnectionBusInternal), iDriveAtt(0), iMediaAtt(0), iBaseAddress(NULL), diff -r 56f325a607ea -r 0173bcd7697c kernel/eka/include/d32locd.h --- a/kernel/eka/include/d32locd.h Wed Dec 23 11:43:31 2009 +0000 +++ b/kernel/eka/include/d32locd.h Thu Jan 07 13:38:45 2010 +0200 @@ -97,9 +97,9 @@ */ TMediaType iType; /** - Indicates state of battery if supported + Connection type used to interface to the media */ - TBatteryState iBattery; + TConnectionBusType iConnectionBusType; /** Attributes of the drive */ @@ -277,8 +277,6 @@ }; typedef TPckgBuf TLocalDriveCapsV4Buf; // -#define KMaxSerialNumLength 64 -typedef TBuf8 TMediaSerialNumber; class TLocalDriveCapsV5 : public TLocalDriveCapsV4 /** Add serial number support for certain media. diff -r 56f325a607ea -r 0173bcd7697c kernel/eka/include/drivers/locmedia.h --- a/kernel/eka/include/drivers/locmedia.h Wed Dec 23 11:43:31 2009 +0000 +++ b/kernel/eka/include/drivers/locmedia.h Thu Jan 07 13:38:45 2010 +0200 @@ -293,6 +293,7 @@ TInt LockMountInfo(DPrimaryMediaBase& aPrimaryMedia, TLocDrvRequest& aReq); void UnlockMountInfo(DPrimaryMediaBase& aPrimaryMedia); #endif + TInt ReadPasswordData(TLocDrvRequest& aReq, TLocalDrivePasswordData& aPswData, TMediaPassword& aOldPasswd, TMediaPassword& aNewPasswd); public: TLocDrv* iDrive; /**< @internalComponent */ @@ -340,6 +341,7 @@ ECodePaging=0x20, // a code paging request EDataPaging=0x40, // a data paging request ETClientBuffer=0x80, // RemoteDes() points to a TClientBuffer + EKernelBuffer=0x100, // RemoteDes() points to a kernel-side buffer }; public: diff -r 56f325a607ea -r 0173bcd7697c kernel/eka/include/drivers/mmc.inl --- a/kernel/eka/include/drivers/mmc.inl Wed Dec 23 11:43:31 2009 +0000 +++ b/kernel/eka/include/drivers/mmc.inl Thu Jan 07 13:38:45 2010 +0200 @@ -1136,7 +1136,11 @@ * @internalTechnology */ { - return(0x20000 << ((iMachineInfo.iFlags & TMMCMachineInfo::EMaxTransferLength_16M) >> 8)); + TUint32 r = (iMachineInfo.iFlags & TMMCMachineInfo::EMaxTransferLength_16M) >> 8; + if (r) + r = 0x20000 << r; + + return r; } inline TUint32 DMMCSocket::DmaAlignment() diff -r 56f325a607ea -r 0173bcd7697c kernel/eka/include/drivers/usbc.h --- a/kernel/eka/include/drivers/usbc.h Wed Dec 23 11:43:31 2009 +0000 +++ b/kernel/eka/include/drivers/usbc.h Thu Jan 07 13:38:45 2010 +0200 @@ -79,9 +79,10 @@ TDmaBuf(TUsbcEndpointInfo* aEndpointInfo, TInt aBandwidthPriority); ~TDmaBuf(); TInt Construct(TUsbcEndpointInfo* aEndpointInfo); - TUint8* SetBufferBase(TUint8* aBase); TInt BufferTotalSize() const; - TUint8* BufferBase() const; + TInt BufferSize() const; + TInt SetBufferAddr(TInt aBufInd, TUint8* aBufAddr); + TInt BufferNumber() const; void SetMaxPacketSize(TInt aSize); void Flush(); // Rx (OUT) variants @@ -190,8 +191,11 @@ void AbortTransfer(); inline TUsbcEndpointInfo* EndpointInfo(); inline TInt RxBytesAvailable() const; - inline TInt BufferTotalSize() const; - inline TUint8* SetBufferBase(TUint8* aBase); + + inline TInt BufferSize() const; + inline TInt SetBufferAddr( TInt aBufInd, TUint8* aAddr); + inline TInt BufferNumber() const; + inline void SetTransferInfo(TEndpointTransferInfo* aTransferInfo); inline void ResetTransferInfo(); inline void SetClientReadPending(TBool aVal); @@ -239,6 +243,7 @@ TUsbcAlternateSettingList* iNext; TInt iNumberOfEndpoints; TUint iSetting; + TInt iEpNumDeOrderedByBufSize[KMaxEndpointsPerClient + 1]; TUsbcEndpoint* iEndpoint[KMaxEndpointsPerClient + 1]; }; @@ -302,13 +307,14 @@ TInt ProcessDeviceState(TUsbcDeviceState aDeviceState); void ResetInterface(TInt aErrorCode); void AbortInterface(); - void RebaseInterfaceMemory(TUsbcAlternateSettingList* aAlternateSettingListRec, TUint8* aBase, - TUint aDirection); + // Set buffer address of the interface + void ReSetInterfaceMemory(TUsbcAlternateSettingList* aAlternateSettingListRec, + RArray &aHwChunks ); void UpdateEndpointSizes(); - DPlatChunkHw* SetupInterfaceMemory(TInt aBufferSize, DPlatChunkHw* aHwChunk, TUint aDirection, - TUint32 aCacheAttribs); + // Check and alloc memory for the interface + TInt SetupInterfaceMemory(RArray &aHwChunks, + TUint32 aCacheAttribs ); void PanicClientThread(TInt aReason); - TInt PinMemory(TDesC8 *aDes, TVirtualPinObject *iPinObj); //Descriptor pinning helper. void CompleteBufferRequest(DThread* aThread, TInt aReqNo, TInt aReason); private: @@ -326,12 +332,10 @@ TUsbcEndpointStatusCallback iEndpointStatusCallbackInfo; TAny* iOtgFeatureChangePtr; TUsbcOtgFeatureCallback iOtgFeatureCallbackInfo; - TUint8* iBufferBaseEp0; - TInt iBufferSizeEp0; TInt iNumberOfEndpoints; - DPlatChunkHw* iHwChunkIN; - DPlatChunkHw* iHwChunkOUT; - DPlatChunkHw* iHwChunkEp0; + RArray iHwChunksEp0; + RArray iHwChunks; + TUsbcDeviceState iDeviceState; TUsbcDeviceState iOldDeviceState; TBool iOwnsDeviceControl; diff -r 56f325a607ea -r 0173bcd7697c kernel/eka/include/drivers/usbc.inl --- a/kernel/eka/include/drivers/usbc.inl Wed Dec 23 11:43:31 2009 +0000 +++ b/kernel/eka/include/drivers/usbc.inl Thu Jan 07 13:38:45 2010 +0200 @@ -45,18 +45,18 @@ return iDmaBuffers->RxBytesAvailable(); } - -TInt TUsbcEndpoint::BufferTotalSize() const - { - return iDmaBuffers->BufferTotalSize(); - } - - -TUint8* TUsbcEndpoint::SetBufferBase(TUint8* aBase) - { - return iDmaBuffers->SetBufferBase(aBase); - } - +TInt TUsbcEndpoint::BufferSize() const + { + return iDmaBuffers->BufferSize(); + } +TInt TUsbcEndpoint::SetBufferAddr( TInt aBufInd, TUint8* aBufAddr) + { + return iDmaBuffers->SetBufferAddr(aBufInd, aBufAddr); + } +TInt TUsbcEndpoint::BufferNumber() const + { + return iDmaBuffers->BufferNumber(); + } void TUsbcEndpoint::SetTransferInfo(TEndpointTransferInfo* aTransferInfo) { diff -r 56f325a607ea -r 0173bcd7697c kernel/eka/include/e32cmn.h --- a/kernel/eka/include/e32cmn.h Wed Dec 23 11:43:31 2009 +0000 +++ b/kernel/eka/include/e32cmn.h Thu Jan 07 13:38:45 2010 +0200 @@ -4839,6 +4839,9 @@ }; +#define KMaxSerialNumLength 64 +typedef TBuf8 TMediaSerialNumber; + /** @publishedAll diff -r 56f325a607ea -r 0173bcd7697c kernel/eka/include/e32const.h --- a/kernel/eka/include/e32const.h Wed Dec 23 11:43:31 2009 +0000 +++ b/kernel/eka/include/e32const.h Thu Jan 07 13:38:45 2010 +0200 @@ -1026,6 +1026,13 @@ enum TBatteryState {EBatNotSupported,EBatGood,EBatLow}; +/** +@publishedAll +@released + +Defines the possible connection types used to interface to the media. +*/ +enum TConnectionBusType {EConnectionBusInternal, EConnectionBusUsb}; /** @@ -1149,6 +1156,15 @@ @publishedAll @released +Drive attribute - drive is external. +*/ +const TUint KDriveAttExternal=0x800; + + +/** +@publishedAll +@released + Drive attribute - It can be set in a search in order to instruct that all drives should be returned. */ const TUint KDriveAttAll=0x100000; diff -r 56f325a607ea -r 0173bcd7697c kernel/eka/include/e32debug.h --- a/kernel/eka/include/e32debug.h Wed Dec 23 11:43:31 2009 +0000 +++ b/kernel/eka/include/e32debug.h Thu Jan 07 13:38:45 2010 +0200 @@ -35,7 +35,7 @@ }; // -/** @publishedPartner +/** @publishedAll @released */ class RDebug diff -r 56f325a607ea -r 0173bcd7697c kernel/eka/include/e32event.h --- a/kernel/eka/include/e32event.h Wed Dec 23 11:43:31 2009 +0000 +++ b/kernel/eka/include/e32event.h Thu Jan 07 13:38:45 2010 +0200 @@ -18,7 +18,9 @@ #ifndef __E32EVENT_H__ #define __E32EVENT_H__ #include +#ifdef BTRACE_TRAWEVENT #include +#endif /** @publishedAll diff -r 56f325a607ea -r 0173bcd7697c kernel/eka/include/e32ldr.h --- a/kernel/eka/include/e32ldr.h Wed Dec 23 11:43:31 2009 +0000 +++ b/kernel/eka/include/e32ldr.h Thu Jan 07 13:38:45 2010 +0200 @@ -28,122 +28,26 @@ #include -const TInt KMaxLibraryEntryPoints=0x100; - -// -// Loader version number. -// -const TInt KLoaderMajorVersionNumber=1; -const TInt KLoaderMinorVersionNumber=0; - -// -// IPC messages to the loader -// -enum TLoaderMsg - { - ELoadProcess=1, - ELoadLibrary=2, - ELoadLogicalDevice=3, - ELoadPhysicalDevice=4, - ELoadLocale=5, - ELoadFileSystem=6, - EGetInfo=7, - ELoaderDebugFunction=8, - ELoadFSExtension=9, - EGetInfoFromHeader=10, - ELoadFSPlugin=11, - ELoaderCancelLazyDllUnload=12, - ELdrDelete=13, - ECheckLibraryHash=14, - ELoadFSProxyDrive=15, - ELoadCodePage=16, - EMaxLoaderMsg - }; -// -// Loader message arguments: -// 0 = TLdrInfo -// 1 = Filename -// 2 = Command line (process) or path (library) -// -class TLdrInfo - { -public: - IMPORT_C TLdrInfo(); // for BC -public: - TUidType iRequestedUids; - TOwnerType iOwnerType; - TInt iHandle; - TUint32 iSecureId; - TUint32 iRequestedVersion; - TInt iMinStackSize; // Size of new process stack - }; - +/** + @internalTechnology -#ifndef __KERNEL_MODE__ -#include -// -// Loader client class -// -class RLoader : public RSessionBase - { -public: - IMPORT_C TInt Connect(); - TVersion Version() const; - TInt LoadProcess(TInt& aHandle, const TDesC& aFileName, const TDesC& aCommand, const TUidType& aUidType, TOwnerType aType); - IMPORT_C TInt LoadLibrary(TInt& aHandle, const TDesC& aFileName, const TDesC& aPath, const TUidType& aType, TUint32 aModuleVersion); - IMPORT_C TInt GetInfo(const TDesC& aFileName, TDes8& aInfoBuf); - TInt LoadDeviceDriver(const TDesC& aFileName, TInt aDeviceType); - IMPORT_C TInt DebugFunction(TInt aFunction, TInt a1, TInt a2, TInt a3); - TInt LoadLocale(const TDesC& aLocaleDllName, TLibraryFunction* aExportList); - TInt GetInfoFromHeader(const TDesC8& aHeader, TDes8& aInfoBuf); - IMPORT_C TInt CancelLazyDllUnload(); - IMPORT_C TInt Delete(const TDesC& aFileName); - IMPORT_C TInt CheckLibraryHash(const TDesC& aFileName, TBool aValidateHash=EFalse); - TInt LoadProcess(TInt& aHandle, const TDesC& aFileName, const TDesC& aCommand, const TUidType& aUidType, TInt aMinStackSize, TOwnerType aType); -public: -#ifdef __ARMCC__ - // workaround for possible EDG bug (!!) - inline TInt SendReceive(TInt aFunction,const TIpcArgs& aArgs) const - { return RSessionBase::SendReceive(aFunction, aArgs); } -#else - using RSessionBase::SendReceive; -#endif - }; -#endif - -// -// Information required to create a new code segment -// -enum TCodeSegAttributes - { - ECodeSegAttKernel =0x00000001, - ECodeSegAttGlobal =0x00000002, - ECodeSegAttFixed =0x00000004, - ECodeSegAttABIMask =0x00000018, // same values as in image header - ECodeSegAttCodePaged =0x00000200, // the code seg is demand paged - ECodeSegAttDataPaged =0x00002000, // the code seg static data is demand paged - ECodeSegAttHDll =(TInt)0x80000000,// Emulator host file type: 1=DLL, 0=EXE - ECodeSegAttExpVer =0x40000000, // Filename is explicitly versioned - ECodeSegAttNmdExpData =0x20000000, // Named symbol export data in code seg - ECodeSegAttSMPSafe =0x10000000, // code seg and its static dependencies are SMP safe - ECodeSegAttAddrNotUnique =0x08000000, // run address not globally unique (may overlap other codesegs) - }; - -class TBlockMapEntryBase -/** Where sections of a file are located on the media. The kernel uses this to load in parts of a demand paged file. */ +class TBlockMapEntryBase { public: TUint iNumberOfBlocks; // Number of contiguous blocks in map. TUint iStartBlock; // Number for first block in the map. }; -struct SBlockMapInfoBase + /** + @internalTechnology + Describes context for TBlockMapEntryBase objects. */ +struct SBlockMapInfoBase { TUint iBlockGranularity; // Size of a block in bytes. TUint iBlockStartOffset; // Offset to start of the file or requested file position within a block. @@ -151,275 +55,10 @@ TInt iLocalDriveNumber; // Local drive number of where the file lies on. }; -// forward declarations from file server -class RFile; -class RFs; -/** -A Handle used to identify a file on storage media. -@internalTechnology -*/ -class RFileClamp - { -public: - inline RFileClamp() - { - iCookie[0] = 0; - iCookie[1] = 0; - } - IMPORT_C TInt Clamp(RFile& aFile); - IMPORT_C TInt Close(RFs& aFs); - -public: - TInt64 iCookie[2]; - }; - - -class TCodeSegCreateInfo - { -public: - TBuf8 iFileName; // not including {MMMMmmmm} version info - TUidType iUids; // uid1 indicates EXE or DLL - TUint32 iAttr; - TInt iCodeSize; - TInt iTextSize; - TInt iDataSize; - TInt iBssSize; - TInt iTotalDataSize; - TUint32 iEntryPtVeneer; // address of first instruction to be called - TUint32 iFileEntryPoint; // address of entry point within this code segment - TInt iDepCount; - TUint32 iExportDir; - TInt iExportDirCount; - TUint32 iCodeLoadAddress; // 0 for RAM loaded code, else pointer to TRomImageHeader - TUint32 iCodeRunAddress; - TUint32 iDataLoadAddress; - TUint32 iDataRunAddress; - TUint32 iExceptionDescriptor; - TInt iRootNameOffset; - TInt iRootNameLength; - TInt iExtOffset; - TUint32 iModuleVersion; - SSecurityInfo iS; - TAny* iHandle; // pointer to kernel-side DCodeSeg object - TInt iClientProcessHandle; // handle to client process for user DLL loads - /** Code relocation information stored on loader heap. */ - TUint32* iCodeRelocTable; - /** Size of code relocation table in bytes. */ - TInt iCodeRelocTableSize; - /** Import fixup information stored on loader heap. */ - TUint32* iImportFixupTable; - /** Size of import fixup table in bytes. */ - TInt iImportFixupTableSize; - /** Offset to apply to each code address in the image when it is fixed up. */ - TUint32 iCodeDelta; - /** Offset to apply to each data address in the image when it is fixed up. */ - TUint32 iDataDelta; - /** - Whether the code is paged. If this is set, then - TCodeSegCreateInfo::iCodeRelocTable[Size] and - TCodeSegCreateInfo::iImportFixupTable[Size] contain fixup information - which the kernel uses to fix up each page. - (They may be null if the binary has no imports or no code section.) - */ - TBool iUseCodePaging; - /** The UID of the compression scheme in use. */ - TUint32 iCompressionType; - /** - Start of compressed pages within the file. The kernel uses - this to load compressed pages from byte-pair files when demand - paging. - */ - TInt32* iCodePageOffsets; - /** Where (possibly compressed) object code starts in iFile. */ - TInt iCodeStartInFile; - /** Length of (possibly compressed) object code in iFile. */ - TInt iCodeLengthInFile; - /** Information about block map entries in iCodeBlockMapEntries. */ - SBlockMapInfoBase iCodeBlockMapCommon; - /** Where object code is located on the media. */ - TBlockMapEntryBase* iCodeBlockMapEntries; - /** Size of block map entry array in bytes. */ - TInt iCodeBlockMapEntriesSize; - /** - File clamp cookie, used to delete the file when the - codeseg is destroyed. - */ - RFileClamp iFileClamp; -public: - IMPORT_C TPtrC8 RootName() const; - }; - -// -// Information required to create a new process -// -class TProcessCreateInfo : public TCodeSegCreateInfo - { -public: - enum TDebugAttributes // must be the same as RLibrary::TInfoV2::TDebugAttributes - { - EDebugAllowed = 1<<0, ///< Flags set if executable may be debugged. - ETraceAllowed = 1<<1 ///< Flags set if executable may be traced. - }; - /** - The flags for process's creation. Will be set by the loader from the images - header flags ready for the kernel to use. - */ - enum TProcessCreateFlags - { - EDataPagingUnspecified = 0x00000000, ///< Use the global data paging default. - EDataPaged = 0x00000001, ///< Page the process's data by default. - EDataUnpaged = 0x00000002, ///< Don't page the process's data by default. - EDataPagingMask = 0x00000003, ///< Bit mask ofr data paging flags. - }; - - /** Default constructor that ensures flags are clear. */ - TProcessCreateInfo() : iFlags(0) {}; - - TInt iHeapSizeMin; - TInt iHeapSizeMax; - TInt iStackSize; - TInt iClientHandle; // handle to loader's client - TInt iProcessHandle; // handle to new DProcess - TInt iFinalHandle; // handle from loader client to new process - TOwnerType iOwnerType; - TProcessPriority iPriority; - TUint iSecurityZone; - TUint iDebugAttributes; ///< Set with values from TDebugAttributes. - TRequestStatus* iDestructStat; - TUint iFlags; ///< Flags for process creation, should set from TProcessCreateFlags. - }; - -const TUint KSecurityZoneUnique = 0u; -const TUint KSecurityZoneLegacyCode = ~0u; - -// -// Information required to attach a code segment to a process -// in the form of a library. -// -class TLibraryCreateInfo - { -public: - TAny* iCodeSegHandle; // pointer to kernel-side DCodeSeg object - TInt iClientHandle; // handle to loader's client - TInt iLibraryHandle; // handle to new DLibrary - TOwnerType iOwnerType; - }; - -// -// Information required to find an existing code segment -// -class TFindCodeSeg - { -public: - TUidType iUids; // required UIDs - const TAny* iRomImgHdr; // ROM image header if ROM code required, NULL otherwise - TUint32 iAttrMask; // mask for attributes - TUint32 iAttrVal; // required value for masked attributes - TInt iProcess; // handle to process in which code is required to operate - // not used if kernel only specified - SSecurityInfo iS; // required capabilities/SID - TUint32 iModuleVersion; // required version - TBuf8 iName; // name to look for - zero length means any - }; - -// -// Information required to by the reaper from the codeseg. -// -struct TCodeSegLoaderCookie - { - RFileClamp iFileClamp; - TInt64 iStartAddress; - TInt iDriveNumber; - }; - -// -// Loader magic executive functions -// -class E32Loader - { -public: - // used by loader only - IMPORT_C static TInt CodeSegCreate(TCodeSegCreateInfo& aInfo); - IMPORT_C static TInt CodeSegLoaded(TCodeSegCreateInfo& aInfo); - IMPORT_C static TInt LibraryCreate(TLibraryCreateInfo& aInfo); - IMPORT_C static TInt CodeSegOpen(TAny* aHandle, TInt aClientProcessHandle); - IMPORT_C static void CodeSegClose(TAny* aHandle); - IMPORT_C static void CodeSegNext(TAny*& aHandle, const TFindCodeSeg& aFind); - IMPORT_C static void CodeSegInfo(TAny* aHandle, TCodeSegCreateInfo& aInfo); - IMPORT_C static TInt CodeSegAddDependency(TAny* aImporter, TAny* aExporter); - IMPORT_C static void CodeSegDeferDeletes(); - IMPORT_C static void CodeSegEndDeferDeletes(); - IMPORT_C static TInt ProcessCreate(TProcessCreateInfo& aInfo, const TDesC8* aCommandLine); - IMPORT_C static TInt ProcessLoaded(TProcessCreateInfo& aInfo); - IMPORT_C static TInt CheckClientState(TInt aClientHandle); - IMPORT_C static TInt DeviceLoad(TAny* aHandle, TInt aType); - IMPORT_C static TAny* ThreadProcessCodeSeg(TInt aHandle); - IMPORT_C static void ReadExportDir(TAny* aHandle, TUint32* aDest); - IMPORT_C static TInt LocaleExports(TAny* aHandle, TLibraryFunction* aExportsList); - -#ifdef __MARM__ - IMPORT_C static void GetV7StubAddresses(TLinAddr& aExe, TLinAddr& aDll); - static TInt V7ExeEntryStub(); - static TInt V7DllEntryStub(TInt aReason); +#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS +#include #endif - IMPORT_C static TUint32 PagingPolicy(); - - IMPORT_C static TInt NotifyIfCodeSegDestroyed(TRequestStatus& aStatus); - IMPORT_C static TInt GetDestroyedCodeSegInfo(TCodeSegLoaderCookie& aCookie); - -public: - // used by client side - static TInt WaitDllLock(); - static TInt ReleaseDllLock(); - static TInt LibraryAttach(TInt aHandle, TInt& aNumEps, TLinAddr* aEpList); - static TInt LibraryAttached(TInt aHandle); - static TInt StaticCallList(TInt& aNumEps, TLinAddr* aEpList); - static TInt LibraryDetach(TInt& aNumEps, TLinAddr* aEpList); - static TInt LibraryDetached(); - }; - -typedef TInt (*TSupervisorFunction)(TAny*); +#endif // __E32LDR_H__ -// Relocation types -/** -@internalTechnology -@released -*/ -const TUint16 KReservedRelocType = (TUint16)0x0000; -/** -@internalTechnology -@released -*/ -const TUint16 KTextRelocType = (TUint16)0x1000; -/** -@internalTechnology -@released -*/ -const TUint16 KDataRelocType = (TUint16)0x2000; -/** -@internalTechnology -@released -*/ -const TUint16 KInferredRelocType = (TUint16)0x3000; - -// Compression types - -/** -@internalTechnology -@released -*/ -const TUint KFormatNotCompressed=0; -/** -@internalTechnology -@released -*/ -const TUint KUidCompressionDeflate=0x101F7AFC; - - -const TUint KUidCompressionBytePair=0x102822AA; - - -#endif - diff -r 56f325a607ea -r 0173bcd7697c kernel/eka/include/e32ldr_private.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/kernel/eka/include/e32ldr_private.h Thu Jan 07 13:38:45 2010 +0200 @@ -0,0 +1,401 @@ +// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// e32\include\e32ldr_private.h +// + +/** + @file + @internalTechnology +*/ + +#ifndef __E32LDR_PRIVATE_H__ +#define __E32LDR_PRIVATE_H__ + +#include +#include + + +const TInt KMaxLibraryEntryPoints=0x100; + +// +// Loader version number. +// +const TInt KLoaderMajorVersionNumber=1; +const TInt KLoaderMinorVersionNumber=0; + +// +// IPC messages to the loader +// +enum TLoaderMsg + { + ELoadProcess=1, + ELoadLibrary=2, + ELoadLogicalDevice=3, + ELoadPhysicalDevice=4, + ELoadLocale=5, + ELoadFileSystem=6, + EGetInfo=7, + ELoaderDebugFunction=8, + ELoadFSExtension=9, + EGetInfoFromHeader=10, + ELoadFSPlugin=11, + ELoaderCancelLazyDllUnload=12, + ELdrDelete=13, + ECheckLibraryHash=14, + ELoadFSProxyDrive=15, + ELoadCodePage=16, + EMaxLoaderMsg + }; +// +// Loader message arguments: +// 0 = TLdrInfo +// 1 = Filename +// 2 = Command line (process) or path (library) +// +class TLdrInfo + { +public: + IMPORT_C TLdrInfo(); // for BC +public: + TUidType iRequestedUids; + TOwnerType iOwnerType; + TInt iHandle; + TUint32 iSecureId; + TUint32 iRequestedVersion; + TInt iMinStackSize; // Size of new process stack + }; + + +#ifndef __KERNEL_MODE__ +#include +// +// Loader client class +// +class RLoader : public RSessionBase + { +public: + IMPORT_C TInt Connect(); + TVersion Version() const; + TInt LoadProcess(TInt& aHandle, const TDesC& aFileName, const TDesC& aCommand, const TUidType& aUidType, TOwnerType aType); + IMPORT_C TInt LoadLibrary(TInt& aHandle, const TDesC& aFileName, const TDesC& aPath, const TUidType& aType, TUint32 aModuleVersion); + IMPORT_C TInt GetInfo(const TDesC& aFileName, TDes8& aInfoBuf); + TInt LoadDeviceDriver(const TDesC& aFileName, TInt aDeviceType); + IMPORT_C TInt DebugFunction(TInt aFunction, TInt a1, TInt a2, TInt a3); + TInt LoadLocale(const TDesC& aLocaleDllName, TLibraryFunction* aExportList); + TInt GetInfoFromHeader(const TDesC8& aHeader, TDes8& aInfoBuf); + IMPORT_C TInt CancelLazyDllUnload(); + IMPORT_C TInt Delete(const TDesC& aFileName); + IMPORT_C TInt CheckLibraryHash(const TDesC& aFileName, TBool aValidateHash=EFalse); + TInt LoadProcess(TInt& aHandle, const TDesC& aFileName, const TDesC& aCommand, const TUidType& aUidType, TInt aMinStackSize, TOwnerType aType); +public: +#ifdef __ARMCC__ + // workaround for possible EDG bug (!!) + inline TInt SendReceive(TInt aFunction,const TIpcArgs& aArgs) const + { return RSessionBase::SendReceive(aFunction, aArgs); } +#else + using RSessionBase::SendReceive; +#endif + }; +#endif + +// +// Information required to create a new code segment +// +enum TCodeSegAttributes + { + ECodeSegAttKernel =0x00000001, + ECodeSegAttGlobal =0x00000002, + ECodeSegAttFixed =0x00000004, + ECodeSegAttABIMask =0x00000018, // same values as in image header + ECodeSegAttCodePaged =0x00000200, // the code seg is demand paged + ECodeSegAttDataPaged =0x00002000, // the code seg static data is demand paged + ECodeSegAttHDll =(TInt)0x80000000,// Emulator host file type: 1=DLL, 0=EXE + ECodeSegAttExpVer =0x40000000, // Filename is explicitly versioned + ECodeSegAttNmdExpData =0x20000000, // Named symbol export data in code seg + ECodeSegAttSMPSafe =0x10000000, // code seg and its static dependencies are SMP safe + ECodeSegAttAddrNotUnique =0x08000000, // run address not globally unique (may overlap other codesegs) + }; + +// forward declarations from file server +class RFile; +class RFs; + +/** +A Handle used to identify a file on storage media. +@internalTechnology +*/ +class RFileClamp + { +public: + inline RFileClamp() + { + iCookie[0] = 0; + iCookie[1] = 0; + } + IMPORT_C TInt Clamp(RFile& aFile); + IMPORT_C TInt Close(RFs& aFs); + +public: + TInt64 iCookie[2]; + }; + + +class TCodeSegCreateInfo + { +public: + TBuf8 iFileName; // not including {MMMMmmmm} version info + TUidType iUids; // uid1 indicates EXE or DLL + TUint32 iAttr; + TInt iCodeSize; + TInt iTextSize; + TInt iDataSize; + TInt iBssSize; + TInt iTotalDataSize; + TUint32 iEntryPtVeneer; // address of first instruction to be called + TUint32 iFileEntryPoint; // address of entry point within this code segment + TInt iDepCount; + TUint32 iExportDir; + TInt iExportDirCount; + TUint32 iCodeLoadAddress; // 0 for RAM loaded code, else pointer to TRomImageHeader + TUint32 iCodeRunAddress; + TUint32 iDataLoadAddress; + TUint32 iDataRunAddress; + TUint32 iExceptionDescriptor; + TInt iRootNameOffset; + TInt iRootNameLength; + TInt iExtOffset; + TUint32 iModuleVersion; + SSecurityInfo iS; + TAny* iHandle; // pointer to kernel-side DCodeSeg object + TInt iClientProcessHandle; // handle to client process for user DLL loads + /** Code relocation information stored on loader heap. */ + TUint32* iCodeRelocTable; + /** Size of code relocation table in bytes. */ + TInt iCodeRelocTableSize; + /** Import fixup information stored on loader heap. */ + TUint32* iImportFixupTable; + /** Size of import fixup table in bytes. */ + TInt iImportFixupTableSize; + /** Offset to apply to each code address in the image when it is fixed up. */ + TUint32 iCodeDelta; + /** Offset to apply to each data address in the image when it is fixed up. */ + TUint32 iDataDelta; + /** + Whether the code is paged. If this is set, then + TCodeSegCreateInfo::iCodeRelocTable[Size] and + TCodeSegCreateInfo::iImportFixupTable[Size] contain fixup information + which the kernel uses to fix up each page. + (They may be null if the binary has no imports or no code section.) + */ + TBool iUseCodePaging; + /** The UID of the compression scheme in use. */ + TUint32 iCompressionType; + /** + Start of compressed pages within the file. The kernel uses + this to load compressed pages from byte-pair files when demand + paging. + */ + TInt32* iCodePageOffsets; + /** Where (possibly compressed) object code starts in iFile. */ + TInt iCodeStartInFile; + /** Length of (possibly compressed) object code in iFile. */ + TInt iCodeLengthInFile; + /** Information about block map entries in iCodeBlockMapEntries. */ + SBlockMapInfoBase iCodeBlockMapCommon; + /** Where object code is located on the media. */ + TBlockMapEntryBase* iCodeBlockMapEntries; + /** Size of block map entry array in bytes. */ + TInt iCodeBlockMapEntriesSize; + /** + File clamp cookie, used to delete the file when the + codeseg is destroyed. + */ + RFileClamp iFileClamp; +public: + IMPORT_C TPtrC8 RootName() const; + }; + +// +// Information required to create a new process +// +class TProcessCreateInfo : public TCodeSegCreateInfo + { +public: + enum TDebugAttributes // must be the same as RLibrary::TInfoV2::TDebugAttributes + { + EDebugAllowed = 1<<0, ///< Flags set if executable may be debugged. + ETraceAllowed = 1<<1 ///< Flags set if executable may be traced. + }; + /** + The flags for process's creation. Will be set by the loader from the images + header flags ready for the kernel to use. + */ + enum TProcessCreateFlags + { + EDataPagingUnspecified = 0x00000000, ///< Use the global data paging default. + EDataPaged = 0x00000001, ///< Page the process's data by default. + EDataUnpaged = 0x00000002, ///< Don't page the process's data by default. + EDataPagingMask = 0x00000003, ///< Bit mask ofr data paging flags. + }; + + /** Default constructor that ensures flags are clear. */ + TProcessCreateInfo() : iFlags(0) {}; + + TInt iHeapSizeMin; + TInt iHeapSizeMax; + TInt iStackSize; + TInt iClientHandle; // handle to loader's client + TInt iProcessHandle; // handle to new DProcess + TInt iFinalHandle; // handle from loader client to new process + TOwnerType iOwnerType; + TProcessPriority iPriority; + TUint iSecurityZone; + TUint iDebugAttributes; ///< Set with values from TDebugAttributes. + TRequestStatus* iDestructStat; + TUint iFlags; ///< Flags for process creation, should set from TProcessCreateFlags. + }; + +const TUint KSecurityZoneUnique = 0u; +const TUint KSecurityZoneLegacyCode = ~0u; + +// +// Information required to attach a code segment to a process +// in the form of a library. +// +class TLibraryCreateInfo + { +public: + TAny* iCodeSegHandle; // pointer to kernel-side DCodeSeg object + TInt iClientHandle; // handle to loader's client + TInt iLibraryHandle; // handle to new DLibrary + TOwnerType iOwnerType; + }; + +// +// Information required to find an existing code segment +// +class TFindCodeSeg + { +public: + TUidType iUids; // required UIDs + const TAny* iRomImgHdr; // ROM image header if ROM code required, NULL otherwise + TUint32 iAttrMask; // mask for attributes + TUint32 iAttrVal; // required value for masked attributes + TInt iProcess; // handle to process in which code is required to operate + // not used if kernel only specified + SSecurityInfo iS; // required capabilities/SID + TUint32 iModuleVersion; // required version + TBuf8 iName; // name to look for - zero length means any + }; + +// +// Information required to by the reaper from the codeseg. +// +struct TCodeSegLoaderCookie + { + RFileClamp iFileClamp; + TInt64 iStartAddress; + TInt iDriveNumber; + }; + +// +// Loader magic executive functions +// +class E32Loader + { +public: + // used by loader only + IMPORT_C static TInt CodeSegCreate(TCodeSegCreateInfo& aInfo); + IMPORT_C static TInt CodeSegLoaded(TCodeSegCreateInfo& aInfo); + IMPORT_C static TInt LibraryCreate(TLibraryCreateInfo& aInfo); + IMPORT_C static TInt CodeSegOpen(TAny* aHandle, TInt aClientProcessHandle); + IMPORT_C static void CodeSegClose(TAny* aHandle); + IMPORT_C static void CodeSegNext(TAny*& aHandle, const TFindCodeSeg& aFind); + IMPORT_C static void CodeSegInfo(TAny* aHandle, TCodeSegCreateInfo& aInfo); + IMPORT_C static TInt CodeSegAddDependency(TAny* aImporter, TAny* aExporter); + IMPORT_C static void CodeSegDeferDeletes(); + IMPORT_C static void CodeSegEndDeferDeletes(); + IMPORT_C static TInt ProcessCreate(TProcessCreateInfo& aInfo, const TDesC8* aCommandLine); + IMPORT_C static TInt ProcessLoaded(TProcessCreateInfo& aInfo); + IMPORT_C static TInt CheckClientState(TInt aClientHandle); + IMPORT_C static TInt DeviceLoad(TAny* aHandle, TInt aType); + IMPORT_C static TAny* ThreadProcessCodeSeg(TInt aHandle); + IMPORT_C static void ReadExportDir(TAny* aHandle, TUint32* aDest); + IMPORT_C static TInt LocaleExports(TAny* aHandle, TLibraryFunction* aExportsList); + +#ifdef __MARM__ + IMPORT_C static void GetV7StubAddresses(TLinAddr& aExe, TLinAddr& aDll); + static TInt V7ExeEntryStub(); + static TInt V7DllEntryStub(TInt aReason); +#endif + + IMPORT_C static TUint32 PagingPolicy(); + + IMPORT_C static TInt NotifyIfCodeSegDestroyed(TRequestStatus& aStatus); + IMPORT_C static TInt GetDestroyedCodeSegInfo(TCodeSegLoaderCookie& aCookie); + +public: + // used by client side + static TInt WaitDllLock(); + static TInt ReleaseDllLock(); + static TInt LibraryAttach(TInt aHandle, TInt& aNumEps, TLinAddr* aEpList); + static TInt LibraryAttached(TInt aHandle); + static TInt StaticCallList(TInt& aNumEps, TLinAddr* aEpList); + static TInt LibraryDetach(TInt& aNumEps, TLinAddr* aEpList); + static TInt LibraryDetached(); + }; + +typedef TInt (*TSupervisorFunction)(TAny*); + +// Relocation types +/** +@internalTechnology +@released +*/ +const TUint16 KReservedRelocType = (TUint16)0x0000; +/** +@internalTechnology +@released +*/ +const TUint16 KTextRelocType = (TUint16)0x1000; +/** +@internalTechnology +@released +*/ +const TUint16 KDataRelocType = (TUint16)0x2000; +/** +@internalTechnology +@released +*/ +const TUint16 KInferredRelocType = (TUint16)0x3000; + +// Compression types + +/** +@internalTechnology +@released +*/ +const TUint KFormatNotCompressed=0; +/** +@internalTechnology +@released +*/ +const TUint KUidCompressionDeflate=0x101F7AFC; + + +const TUint KUidCompressionBytePair=0x102822AA; + + +#endif // __E32LDR_PRIVATE_H__ + diff -r 56f325a607ea -r 0173bcd7697c kernel/eka/include/e32std.inl --- a/kernel/eka/include/e32std.inl Wed Dec 23 11:43:31 2009 +0000 +++ b/kernel/eka/include/e32std.inl Thu Jan 07 13:38:45 2010 +0200 @@ -3559,7 +3559,7 @@ // Class RCriticalSection inline TBool RCriticalSection::IsBlocked() const /** -Tests whether the critical section is occupied by another thread. +Tests whether the critical section is occupied by any thread. @return True, if the critical section is occupied by another thread. False, otherwise. diff -r 56f325a607ea -r 0173bcd7697c kernel/eka/include/e32svr.h --- a/kernel/eka/include/e32svr.h Wed Dec 23 11:43:31 2009 +0000 +++ b/kernel/eka/include/e32svr.h Thu Jan 07 13:38:45 2010 +0200 @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include diff -r 56f325a607ea -r 0173bcd7697c kernel/eka/include/e32test.h --- a/kernel/eka/include/e32test.h Wed Dec 23 11:43:31 2009 +0000 +++ b/kernel/eka/include/e32test.h Thu Jan 07 13:38:45 2010 +0200 @@ -30,9 +30,7 @@ #endif #include #include -#include #include -#include #include #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS #include diff -r 56f325a607ea -r 0173bcd7697c kernel/eka/include/e32ver.h --- a/kernel/eka/include/e32ver.h Wed Dec 23 11:43:31 2009 +0000 +++ b/kernel/eka/include/e32ver.h Thu Jan 07 13:38:45 2010 +0200 @@ -28,7 +28,7 @@ const TInt KE32MajorVersionNumber=2; const TInt KE32MinorVersionNumber=0; -const TInt KE32BuildVersionNumber=2055; +const TInt KE32BuildVersionNumber=2058; const TInt KMachineConfigurationMajorVersionNumber=1; const TInt KMachineConfigurationMinorVersionNumber=0; diff -r 56f325a607ea -r 0173bcd7697c kernel/eka/include/kernel/kernel.h --- a/kernel/eka/include/kernel/kernel.h Wed Dec 23 11:43:31 2009 +0000 +++ b/kernel/eka/include/kernel/kernel.h Thu Jan 07 13:38:45 2010 +0200 @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include diff -r 56f325a607ea -r 0173bcd7697c kernel/eka/include/memmodel/epoc/mmubase/kblockmap.h --- a/kernel/eka/include/memmodel/epoc/mmubase/kblockmap.h Wed Dec 23 11:43:31 2009 +0000 +++ b/kernel/eka/include/memmodel/epoc/mmubase/kblockmap.h Thu Jan 07 13:38:45 2010 +0200 @@ -23,6 +23,7 @@ #define __KBLOCKMAP_H__ #include +#include /** The kernel-side representation of a block map. diff -r 56f325a607ea -r 0173bcd7697c kernel/eka/include/partitions.h --- a/kernel/eka/include/partitions.h Wed Dec 23 11:43:31 2009 +0000 +++ b/kernel/eka/include/partitions.h Thu Jan 07 13:38:45 2010 +0200 @@ -164,6 +164,8 @@ { return(iX86BootIndicator==KBootIndicatorBootable && (IsValidDosPartition() || IsValidFAT32Partition())); } TBool IsValidFAT32Partition() { return (iNumSectors>0 && PartitionIsFAT32(iPartitionType)); } + TBool IsValidExFATPartition() + { return (iNumSectors>0 && PartitionIsNTFS(iPartitionType)); } public: TUint8 iX86BootIndicator; TUint8 iStartHead; diff -r 56f325a607ea -r 0173bcd7697c kernel/eka/include/u32std.h --- a/kernel/eka/include/u32std.h Wed Dec 23 11:43:31 2009 +0000 +++ b/kernel/eka/include/u32std.h Thu Jan 07 13:38:45 2010 +0200 @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include diff -r 56f325a607ea -r 0173bcd7697c kernel/eka/kernel/arm/bootmain.s --- a/kernel/eka/kernel/arm/bootmain.s Wed Dec 23 11:43:31 2009 +0000 +++ b/kernel/eka/kernel/arm/bootmain.s Thu Jan 07 13:38:45 2010 +0200 @@ -156,7 +156,7 @@ PRTLN "InitialiseHardware use of optional SuperPage fields:" IF :DEF: CFG_ENABLE_SMR_SUPPORT ; When defined the bootstrap PSL in InitialiseHardware() - LDR r0, [r10, #SSuperPageBase_iSmrData] ; must set this field to a valid adderss of the SMRIB or + LDR r0, [r10, #SSuperPageBase_iSmrData] ; must set this field to a valid address of the SMRIB or ; KSuperPageAddressFieldUndefined if no SMRIB found. DWORD r0, " SMR_SUPPORT Enabled - iSmrData" ELSE @@ -420,7 +420,7 @@ ; ; - Setup R11 to point to free entry after first null entry in iRamBootData list ; - Reserve any SMRs in the SP SMRIB by adding them to the pre-allocation list -; - Call the bootstrap PSL to allow futher platform specific RAM reservation +; - Call the bootstrap PSL to allow further platform-specific RAM reservation ; ; Point R11 to preallocated block list @@ -651,7 +651,7 @@ ELSE -; moving or multiple model +; moving, multiple or flexible model ; map super page + CPU page PRTLN "Map super/CPU pages" @@ -705,9 +705,8 @@ ENDIF IF :DEF: CFG_HasL210Cache :LOR: :DEF: CFG_HasL220Cache :LOR: :DEF: CFG_HasPL310Cache - MOV r7, #0 ; Flag to indicate if H/W bank that matches SSuperPageBase::iArmL2CacheBase is found. - ; When found, we should stop searching. (Otherwise could be fatal if linear address of - ; External Cache Controller accidentally matches physical address of a H/W bank.) + LDR r5, [r10, #SSuperPageBase_iArmL2CacheBase] ; r5 = PhysAddr of External Cache Controller. + MOV r7, #1 ; R7 != 0 => LinAddr of ExtCacheCtrl is not found yet. Set R7 to 0 when found. ENDIF MapHwBank LDR r1, [r9], #4 ; get phys addr / size @@ -738,30 +737,51 @@ ADD r0, r0, r6 BIC r0, r0, r6 ; round up linear address ENDIF - + BL MapContiguous ; make mapping IF :DEF: CFG_HasL210Cache :LOR: :DEF: CFG_HasL220Cache :LOR: :DEF: CFG_HasPL310Cache - CMP r7, #0 - LDREQ r5, [r10, #SSuperPageBase_iArmL2CacheBase] ; get L2 cache controller base address from super page - CMPEQ r1,r5 ; if physical address matches ... - STREQ r0, [r10, #SSuperPageBase_iArmL2CacheBase] ; ...set linear address in super page - MOVEQ r7, #1 ; mark that L2CacheBase PhysToLinear transfer is completed + MOV r4, r0 ; r4 = LinAddr of the current HwBank ENDIF - BL MapContiguous ; make mapping ADD r0, r0, r3 ; increment linear address + IF :DEF: CFG_HasL210Cache :LOR: :DEF: CFG_HasL220Cache :LOR: :DEF: CFG_HasPL310Cache + B MapHwBank3 ; test whether the current HwBank contains ExtCacheCtrl + ELSE B MapHwBank ; next bank + ENDIF MapHwBank2 STR r0, [sp, #-4]! ; save default linear address MOV r0, r6 ; r0 = specified linear address + BL MapContiguous ; make mapping + IF :DEF: CFG_HasL210Cache :LOR: :DEF: CFG_HasL220Cache :LOR: :DEF: CFG_HasPL310Cache + MOV r4, r0 ; r4 = LinAddr of the current HwBank + ENDIF + LDR r0, [sp], #4 ; restore default linear address IF :DEF: CFG_HasL210Cache :LOR: :DEF: CFG_HasL220Cache :LOR: :DEF: CFG_HasPL310Cache - CMP r7, #0 - LDREQ r5, [r10, #SSuperPageBase_iArmL2CacheBase] ; get L2 cache controller base address from super page - CMPEQ r1,r5 ; if physical address matches ... - STREQ r0, [r10, #SSuperPageBase_iArmL2CacheBase] ; ...set linear address in super page - MOVEQ r7, #1 ; mark that L2CacheBase PhysToLinear transfer is completed - ENDIF - BL MapContiguous ; make mapping - LDR r0, [sp], #4 ; restore default linear address +MapHwBank3 + ; Check if the current HW bank contains External Cache Controller. + ; If so, write down its virtual address into SSuperPageBase::iArmL2CacheBase. + ; r5 = phys. address of the external cache controller + ; r1 = physical address of the current HW bank + ; r4 = virtual address of the current HW bank + ; r3 = the size of the current bank + ; r7 = 0 if we have already found cache controller in of the previous HW banks + CMP r7, #0 ; Still in search for linear address of external cache controller? + BEQ MapHwBank ; If no, go to the next HwBank + + SUBS r7, r5, r1 ; r7 = PhysAddr of ExtCacheCtrl - PhysAddr of current HwBank + ; i.e. offset of cache controller with respect to the current bank + BLO MapHwBank ; ofsset(in r7) is <0 so not in this bank (and r7 != 0) + + CMP r7, r3 ; If 0 <= r7 < r3 then it's in this bank + BHS MapHwBank ; Not in this bank (and r7 != 0) + + ; The current HwBank holds External Cache Controller + ADD r5, r7, r4 ; r5 = LinAddr of ExtCacheCtrl + STR r5, [r10, #SSuperPageBase_iArmL2CacheBase] ; Set Linear Address of ExtCacheCtrl in super page + + MOV r7, #0 ; Mark that Linear Address of ExtCacheCtrl is found + ENDIF ; IF :DEF: CFG_HasL210Cache :LOR: :DEF: CFG_HasL220Cache :LOR: :DEF: CFG_HasPL310Cache + B MapHwBank ; next bank MapHwBank_End diff -r 56f325a607ea -r 0173bcd7697c kernel/eka/kernel/zlib/crc32.h --- a/kernel/eka/kernel/zlib/crc32.h Wed Dec 23 11:43:31 2009 +0000 +++ b/kernel/eka/kernel/zlib/crc32.h Thu Jan 07 13:38:45 2010 +0200 @@ -2,7 +2,7 @@ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" +* under the terms of the License "Eclipse Public License v1.0" * which accompanies this distribution, and is available * at the URL "http://www.eclipse.org/legal/epl-v10.html". * diff -r 56f325a607ea -r 0173bcd7697c kernel/eka/kernel/zlib/trees.h --- a/kernel/eka/kernel/zlib/trees.h Wed Dec 23 11:43:31 2009 +0000 +++ b/kernel/eka/kernel/zlib/trees.h Thu Jan 07 13:38:45 2010 +0200 @@ -2,7 +2,7 @@ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" +* under the terms of the License "Eclipse Public License v1.0" * which accompanies this distribution, and is available * at the URL "http://www.eclipse.org/legal/epl-v10.html". * diff -r 56f325a607ea -r 0173bcd7697c kernel/eka/memmodel/epoc/flexible/mmu/mmapping.cpp --- a/kernel/eka/memmodel/epoc/flexible/mmu/mmapping.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kernel/eka/memmodel/epoc/flexible/mmu/mmapping.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -507,19 +507,20 @@ if(pinnedPt && pinnedPt!=pt) { // previously pinned page table not needed... - PageTableAllocator::UnpinPageTable(pinnedPt,aPinArgs); + ::PageTables.UnpinPageTable(pinnedPt,aPinArgs); // make sure we have memory for next pin attempt... MmuLock::Unlock(); aPinArgs.AllocReplacementPages(KNumPagesToPinOnePageTable); - MmuLock::Lock(); if(!aPinArgs.HaveSufficientPages(KNumPagesToPinOnePageTable)) // if out of memory... { // make sure we free any unneeded page table we allocated... if(pt) FreePageTable(Mmu::PageDirectoryEntry(OsAsid(),aAddr)); + MmuLock::Lock(); return 0; } + MmuLock::Lock(); } if(!pt) @@ -539,8 +540,16 @@ return pt; // pin the page table... + if (::PageTables.PinPageTable(pt,aPinArgs) != KErrNone) + {// Couldn't pin the page table... + MmuLock::Unlock(); + // make sure we free any unneeded page table we allocated... + FreePageTable(Mmu::PageDirectoryEntry(OsAsid(),aAddr)); + MmuLock::Lock(); + return 0; + } + pinnedPt = pt; - PageTableAllocator::PinPageTable(pinnedPt,aPinArgs); } } @@ -1485,7 +1494,7 @@ MmuLock::Lock(); while(pPt (TUint)KMinUnpinnedPagedPtPages); // Unlikely to be untrue. + iUpperWaterMark = KMaxPageTablePages - KMinUnpinnedPagedPtPages; + iPinnedPageTablePages = 0; // OK to clear this without MmuLock as only one thread running so far. + } + + +static TUint32 RandomSeed = 33333; + +TUint PageTableAllocator::TPtPageAllocator::RandomPagedPtPage() + { + __NK_ASSERT_DEBUG(PageTablesLockIsHeld()); + + // Pick an allocated page at random, from iUpperWaterMark - KMaxPageTablePages. + RandomSeed = RandomSeed * 69069 + 1; // next 'random' number + TUint allocRange = KMaxPageTablePages - iUpperWaterMark - 1; + TUint bit = (TUint64(RandomSeed) * TUint64(allocRange)) >> 32; + + // All page table pages should be allocated or we shouldn't be stealing one at random. + __NK_ASSERT_DEBUG(iUpperAllocator->NotFree(bit, 1)); + + return KMaxPageTablePages - 1 - bit; } @@ -390,39 +411,53 @@ if(aDemandPaged) { TInt bit = iUpperAllocator->Alloc(); - if(bit<0) - return bit; - pageIndex = KMaxPageTablePages-1-bit; - if(pageIndex= 0); + + pageIndex = KMaxPageTablePages - 1 - bit; + + if(pageIndex < iUpperWaterMark) { // new upper watermark... - if((pageIndex&~(KPageTableGroupSize-1))<=iLowerWaterMark) + if((pageIndex & ~(KPageTableGroupSize - 1)) <= iLowerWaterMark) { // clashes with other bitmap allocator, so fail.. iUpperAllocator->Free(bit); + TRACE(("TPtPageAllocator::Alloc too low iUpperWaterMark %d ",iUpperWaterMark)); return -1; } + // Hold mmu lock so iUpperWaterMark isn't read by pinning before we've updated it. + MmuLock::Lock(); iUpperWaterMark = pageIndex; + MmuLock::Unlock(); TRACE(("TPtPageAllocator::Alloc new iUpperWaterMark=%d",pageIndex)); } } else { TInt bit = iLowerAllocator->Alloc(); - if(bit<0) + if(bit < 0) return bit; pageIndex = bit; - if(pageIndex>iLowerWaterMark) - { - // new upper watermark... - if(pageIndex>=(iUpperWaterMark&~(KPageTableGroupSize-1))) + if(pageIndex > iLowerWaterMark) + {// iLowerAllocator->Alloc() should only pick the next bit after iLowerWaterMark. + __NK_ASSERT_DEBUG(pageIndex == iLowerWaterMark + 1); + MmuLock::Lock(); + // new lower watermark... + if( pageIndex >= (iUpperWaterMark & ~(KPageTableGroupSize - 1)) || + AtPinnedPagedPtsLimit(iUpperWaterMark, pageIndex, iPinnedPageTablePages)) { - // clashes with other bitmap allocator, so fail.. + // clashes with other bitmap allocator or it would reduce the amount + // of available unpinned paged page tables too far, so fail.. + MmuLock::Unlock(); iLowerAllocator->Free(bit); + TRACE(("TPtPageAllocator::Alloc iLowerWaterMark=%d",iLowerWaterMark)); return -1; } iLowerWaterMark = pageIndex; - TRACE(("TPtPageAllocator::Alloc new iLowerWaterMark=%d",pageIndex)); + MmuLock::Unlock(); + TRACE(("TPtPageAllocator::Alloc new iLowerWaterMark=%d", iLowerWaterMark)); } } return pageIndex; @@ -461,10 +496,40 @@ { __NK_ASSERT_DEBUG(LockIsHeld()); + TBool demandPaged = aSubAllocator.iDemandPaged; + // allocate page... - TInt ptPageIndex = iPtPageAllocator.Alloc(aSubAllocator.iDemandPaged); - if(ptPageIndex<0) - return false; + TInt ptPageIndex = iPtPageAllocator.Alloc(demandPaged); + if (ptPageIndex < 0) + { + if (demandPaged) + { + TInt r; + do + { + // Can't fail to find a demand paged page table, otherwise a page fault + // could fail with KErrNoMemory. Therefore, keep attempting to steal a + // demand paged page table page until successful. + TUint index = iPtPageAllocator.RandomPagedPtPage(); + MmuLock::Lock(); + TLinAddr pageTableLin = KPageTableBase + (index << (KPtClusterShift + KPageTableShift)); + TPhysAddr ptPhysAddr = Mmu::LinearToPhysical(pageTableLin); + // Page tables must be allocated otherwise we shouldn't be stealing the page. + __NK_ASSERT_DEBUG(ptPhysAddr != KPhysAddrInvalid); + SPageInfo* ptSPageInfo = SPageInfo::FromPhysAddr(ptPhysAddr); + r = StealPage(ptSPageInfo); + MmuLock::Unlock(); + } + while(r != KErrCompletion); + // Retry the allocation now that we've stolen a page table page. + ptPageIndex = iPtPageAllocator.Alloc(demandPaged); + __NK_ASSERT_DEBUG(ptPageIndex >= 0); + } + else + { + return EFalse; + } + } // commit memory for page... __NK_ASSERT_DEBUG(iPageTableMemory); // check we've initialised iPageTableMemory @@ -1107,10 +1172,22 @@ // We don't move page table or page table info pages, however, if this page // is demand paged then we may be able to discard it. MmuLock::Lock(); - if (!(iPtPageAllocator.IsDemandPaged(aOldPageInfo))) + if (aOldPageInfo->Owner() == iPageTableInfoMemory) { - MmuLock::Unlock(); - return KErrNotSupported; + if (!(iPtPageAllocator.IsDemandPagedPtInfo(aOldPageInfo))) + { + MmuLock::Unlock(); + return KErrNotSupported; + } + } + else + { + __NK_ASSERT_DEBUG(aOldPageInfo->Owner() == iPageTableMemory); + if (!(iPtPageAllocator.IsDemandPagedPt(aOldPageInfo))) + { + MmuLock::Unlock(); + return KErrNotSupported; + } } if (aOldPageInfo->PagedState() == SPageInfo::EPagedPinned) {// The page is pinned so don't attempt to discard it as pinned pages @@ -1125,7 +1202,7 @@ } -void PageTableAllocator::PinPageTable(TPte* aPageTable, TPinArgs& aPinArgs) +TInt PageTableAllocator::PinPageTable(TPte* aPageTable, TPinArgs& aPinArgs) { __NK_ASSERT_DEBUG(MmuLock::IsHeld()); __NK_ASSERT_DEBUG(SPageTableInfo::FromPtPtr(aPageTable)->IsDemandPaged()); @@ -1135,6 +1212,12 @@ // pin page with page table in... TPhysAddr pagePhys = Mmu::PageTablePhysAddr(aPageTable); SPageInfo* pi = SPageInfo::FromPhysAddr(pagePhys); + if (!pi->PinCount()) + {// Page is being pinned having previously been unpinned. + TInt r = iPtPageAllocator.PtPagePinCountInc(); + if (r != KErrNone) + return r; + } ThePager.Pin(pi,aPinArgs); // pin page with page table info in... @@ -1142,6 +1225,7 @@ pagePhys = Mmu::UncheckedLinearToPhysical((TLinAddr)pti,KKernelOsAsid); pi = SPageInfo::FromPhysAddr(pagePhys); ThePager.Pin(pi,aPinArgs); + return KErrNone; } @@ -1157,6 +1241,11 @@ pagePhys = Mmu::PageTablePhysAddr(aPageTable); pi = SPageInfo::FromPhysAddr(pagePhys); ThePager.Unpin(pi,aPinArgs); + + if (!pi->PinCount()) + {// This page table page is no longer pinned. + iPtPageAllocator.PtPagePinCountDec(); + } } diff -r 56f325a607ea -r 0173bcd7697c kernel/eka/memmodel/epoc/flexible/mmu/mptalloc.h --- a/kernel/eka/memmodel/epoc/flexible/mmu/mptalloc.h Wed Dec 23 11:43:31 2009 +0000 +++ b/kernel/eka/memmodel/epoc/flexible/mmu/mptalloc.h Thu Jan 07 13:38:45 2010 +0200 @@ -44,6 +44,12 @@ */ const TUint KNumPagesToPinOnePageTable = 2; // 1 page table page + 1 page table info page +/** +The minimum number of unpinned paged page table pages required so a page fault +can't fail to allocate a page table. +*/ +const TUint KMinUnpinnedPagedPtPages = KMaxCpus; + /** Class for allocating MMU page tables. @@ -159,7 +165,7 @@ at least #KNumPagesToPinOnePageTable replacement pages available. */ - static void PinPageTable(TPte* aPageTable, TPinArgs& aPinArgs); + TInt PinPageTable(TPte* aPageTable, TPinArgs& aPinArgs); /** Unpin the RAM page containing a page table, as well as the RAM page @@ -172,7 +178,7 @@ completely unpinned, e.g. those which can be reused as new replacement pages or freed. */ - static void UnpinPageTable(TPte* aPageTable, TPinArgs& aPinArgs); + void UnpinPageTable(TPte* aPageTable, TPinArgs& aPinArgs); private: /** @@ -358,17 +364,97 @@ void Init2(TUint aNumInitPages); TInt Alloc(TBool aDemandPaged); void Free(TUint aPageIndex, TBool aDemandPaged); - TBool IsDemandPaged(SPageInfo* aPageInfo) - {// Is the highest page table index this page table info page can reference + + /** + Determine if the page table info page is paged. + + @param aPageInfo Pointer to the SPageInfo of the page table info page. + @return ETrue if the page table info page is paged, EFalse otherwise. + @pre MmuLock is held. + */ + inline TBool IsDemandPagedPtInfo(SPageInfo* aPageInfo) + { + // Is the highest page table index this page table info page can reference // allocated within the demand paged region of the page table address space. TUint groupIndex = aPageInfo->Index(); return ((groupIndex+1) * KPageTableGroupSize)-1 >= iUpperWaterMark; } + + /** + Determine if the page table page is paged. + + @param aPageInfo Pointer to the SPageInfo of the page table info page. + @return ETrue if the page table page is paged, EFalse otherwise. + @pre MmuLock is held. + */ + inline TBool IsDemandPagedPt(SPageInfo* aPageInfo) + { + return aPageInfo->Index() >= iUpperWaterMark; + } + + /** + Get a random paged page table page. + + @return The index of a paged page table page. + @pre All paged page table pages are allocated. + @pre Page tables lock is held. + */ + TUint RandomPagedPtPage(); + + /** + Increase the count of pinned paged page table pages. + + @return KErrNone on success, KErrNoMemory if too many pages are already pinned. + @pre MmuLock is held + */ + inline TInt PtPagePinCountInc() + { + if (AtPinnedPagedPtsLimit(iUpperWaterMark, iLowerWaterMark, iPinnedPageTablePages + 1)) + { + return KErrNoMemory; + } + iPinnedPageTablePages++; + return KErrNone; + } + + /** + Decrease the count of pinned paged page table pages. + + @pre MmuLock is held + */ + inline void PtPagePinCountDec() + { + __NK_ASSERT_DEBUG(iPinnedPageTablePages); // Can't be zero. + iPinnedPageTablePages--; + } + + private: + /** + Check whether it is safe to pin a paged page table or reduce the amount of + virtual address space available to paged page tables. By checking that we + either have spare virtual address space to increase the amount of paged page + tables or that there are already enough unpinned paged page tables. + + @return ETrue if there isn't or EFalse if it is ok to pin more paged page + tables or increase the number of unpaged page tables. + */ + TBool AtPinnedPagedPtsLimit(TUint aUpperWaterMark, TUint aLowerWaterMark, TUint aPinnedPtPages) + { + TUint adjustedUpperWaterMark = aUpperWaterMark & ~(KPageTableGroupSize - 1); + TUint availPagedPtPages = KMaxPageTablePages - adjustedUpperWaterMark; + TUint availUnpinnedPagedPtPages = availPagedPtPages - aPinnedPtPages; + // This check is sufficient as we only increase the pinned paged page table + // pages or unpaged page table pages one at a time. + return (aLowerWaterMark + 1 == adjustedUpperWaterMark && + availUnpinnedPagedPtPages < KMinUnpinnedPagedPtPages); + } + private: TBitMapAllocator* iLowerAllocator; ///< Allocator for unpaged page tables TUint iLowerWaterMark; ///< Highest page index allocated by iLowerAllocator TBitMapAllocator* iUpperAllocator; ///< Allocator for demand paged page tables TUint iUpperWaterMark; ///< Lowest page index allocated by iUpperAllocator + TUint iPinnedPageTablePages; ///< The number of pinned paged page table pages. }; /** diff -r 56f325a607ea -r 0173bcd7697c kernel/eka/memmodel/epoc/flexible/mmu/mthrash.cpp --- a/kernel/eka/memmodel/epoc/flexible/mmu/mthrash.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kernel/eka/memmodel/epoc/flexible/mmu/mthrash.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -75,6 +75,12 @@ c.iCount += aDelta; c.iLastUpdateTime = currentTime; + if(!iUpdateTimer.IsPending()) + { + TInt r = iUpdateTimer.OneShot(KUpdatePeriod, iUpdateDfc); + __NK_ASSERT_ALWAYS(r == KErrNone); + } + NKern::FMSignal(&iMutex); __NK_ASSERT_DEBUG(c.iCount >= 0); @@ -145,8 +151,21 @@ } iLastUpdateTime = currentTime; - TInt r = iUpdateTimer.Again(KUpdatePeriod); - if (r == KErrArgument) - r = iUpdateTimer.OneShot(KUpdatePeriod, iUpdateDfc); - __NK_ASSERT_ALWAYS(r == KErrNone); + + if(iThrashLevel != 0) + { + NKern::FMWait(&iMutex); + if(!iUpdateTimer.IsPending()) + { + TInt r = iUpdateTimer.Again(KUpdatePeriod); + if (r == KErrArgument) + { + r = iUpdateTimer.OneShot(KUpdatePeriod, iUpdateDfc); + } + __NK_ASSERT_ALWAYS(r == KErrNone); + } + NKern::FMSignal(&iMutex); + + } + } diff -r 56f325a607ea -r 0173bcd7697c kernel/eka/release.txt --- a/kernel/eka/release.txt Wed Dec 23 11:43:31 2009 +0000 +++ b/kernel/eka/release.txt Thu Jan 07 13:38:45 2010 +0200 @@ -1,3 +1,128 @@ +Version 2.00.2058 +================= +(Made by vinojose 03/12/2009) + + +1. ChrisNotton + 1. DEFECT FIX: DEF142863: Public header files must not include platform or internal headers + +2. NeilClifford + 1. DEFECT FIX: DEF143039: MedMMC should not use Cache for Physical Address Requests + +3. RichardCo + 1. DEFECT FIX: DEF142738: T_SMPSAFE fails on SMP unicore + +4. MarkTa + 1. DEFECT FIX: DEF143129: WDP - Allocating a demand paged page table can fault the system + Implement on demand stealing of paged page tables when allocating paged page tables. + +5. StephenSun + 1. DEFECT FIX: DEF142844: initialize SRP timeout + +6. OliverStuart + 1. DEFECT FIX: DEF142840: KERN-EXEC 3 panics in T_SHBUF_PERF + Must use kumemget to read TPtr8 from user memory. + +7. LaneRoberts + 1. DEFECT FIX: DEF143152: NaviEngine ARM4 ROMs cannot be built + +8. ChrisBeale + 1. DEFECT FIX: DEF143114: FMM thrashing monitor timer runs even when device is idle + +9. cnotton + 1. MINOR_CHANGE: Fix SMP Soak test for Header File Relocation + 2. DEFECT FIX: DEF143183: CTS79_MCL_wk46: TB92_200945 symbian tests compilation errors + +10. lanerobe + 1. DEFECT FIX: DEFECT FIX: DEF141811: T_MSTIM on Unicore SMP (Naviengine) Image + +Version 2.00.2057 +================= +(Made by vinojose 01/12/2009) + +1. ChrisNotton + 1. DEFECT FIX: DEF143217: [System Build] Rom build stage unknow keyword in MSF00270 + + +Version 2.00.2056 +================= +(Made by VincentF 25/11/2009) + +1. IndrajeetSingh + 1. DEFECT FIX: DEF141945: Base Template Port build fails + +2. PatrickConway + 2. MINOR_CHANGE: Add missing SMPSAFE keywords to mmp files (mostly test drivers) + +3. ChrisNotton + 1. DEFECT FIX: DEF142927: BSP regressions in header relocation build + 2. DEFECT FIX: DEF143040: CrashMonitor public headers should not include platform headers + 3. DEFECT FIX: DEF143042: Public header e32test.h includes platform headers... + 4. DEFECT FIX: DEF143044: Public header u32std.h includes platform header files... + 5. DEFECT FIX: DEF143053: Public header e32event.h includes platform header... + 6. DEFECT FIX: DEF142880: btrace.iby does not use KERNEL_DIR for ldd + +4. VincentF + 1. DEFECT FIX: DEF142854: Bootstrap.flm and related bld.inf changes not submitted to the MCL + Use FLM, rather than extension makefile, to build bootstraps on all SymTB10.1 + baseports with SBSv2 (Raptor). + +5. YiluZhu + 1. DEFECT FIX: DEF142969: Raptor GCCE: compsupp doesn't deal gracefully with a Raptor GCCE build + +6. DaveGordon + 1. DEFECT FIX: DEF142684: T_TIME hangs on Ivalo waiting for absolute timer after changing secure time + Improve test by making sure time + secure offset settings are sane before changing secure time + 2. DEFECT FIX: DEF142504 T_PAGELDRTST_REAPER issues + Fixes KERN-EXEC panic with code EBadHandle by restructuring loops in CopyAndFragmentFiles(). + Fixes issue with failing Attrib() leaving file unusable - now tries making file R/W if first + attempt at deleting it fails. + 3. DEFECT FIX: DEF141903 T_TIMER intermitant failure on 3430 (t_timer.cpp:633) + Fixes mismatch between getting time in UTC vs. setting alarm in Local time! + (also fixes dup PDEF136734 T_TIMER fails intermittently on SMP platforms) + +7. NeilClifford + 1. DEFECT FIX: DEF142716: Medmmc / USB enhancement + +8. Saravana Attiyap + 1. DEFECT FIX: DEF142896: t_drtaeabi.mmp references deprecated source directories + 2. DEFECT FIX: DEF142878: t_datapaging soak test fail in production environement + +9. VincentF + 1. MINOR_CHANGE: Include missing split header files + +10. JessieZh + 1. DEFECT FIX: DEF142437: t_iic failed to run in eshell + +11. RichardCo + 1. DEFECT FIX: DEF142744: Missing constant KImageHWFloat_VFPv3 + +12. RyanHarkin + 1. DEFECT FIX: DEF142549: Bridge: e32test t_timer fails on 8500 + Added an exception, via a new Machine UID so the 8500 does not run the "Test sequential locks + fail over on/off" test + +13: MiguelB + 1. DEFECT FIX: DEF142719: WDP: Media card Passwords do not work in WDP environment + 2. DEFECT FIX: DEF142819: exFAT partitions are not recognised by MMC/SD stack + +14. Saravana Attiyap + 1. DEFECT FIX DEF142943: T_THRASH - CreatePagedChunk test method fails with KErrNoMemory on gekko77 + +15. SushmitaR + 1. MINOR CHANGE: Add SMP Soak Tests + +16. JimmyZhou + 1. DEFECT FIX: DEF141425: USB ONB testing steps passing rate doesn't meet test pass critiera + 2. DEFECT FIX: DEF141212: Engineering improvement + +17. DjordjeK + 1. DEFECT FIX: DEF142736: Bootstrap should support flexible mapping of external cache controller + Previously, external cache controller had to be positioned at the start of a H/W region specified in + bootstrap. That restriction is now removed so it can be mapped in 64KB or 1MB mappings alongside with + other controllers (which may save 1KB of page table & improve performance due to less TLB misses). + + Version 2.00.2055 ================= (Made by VincentF 24/11/2009) diff -r 56f325a607ea -r 0173bcd7697c kernel/eka/rombuild/alltests.oby --- a/kernel/eka/rombuild/alltests.oby Wed Dec 23 11:43:31 2009 +0000 +++ b/kernel/eka/rombuild/alltests.oby Thu Jan 07 13:38:45 2010 +0200 @@ -61,6 +61,12 @@ data=gentestnonpaged.txt Test\test_unpaged.cpp unpaged #endif +#if defined(SMPSOAK) +data=autoexec_smpsoak.bat \autoexec.bat +#else +data=autoexec_smpsoak.bat Test\smpsoak.bat +#endif + data=##BASEPATH##kernelhwsrv\kerneltest\e32test\smp_demo\war_and_peace_ch1.txt test\war_and_peace_ch1.txt data=##BASEPATH##kernelhwsrv\kerneltest\e32test\smp_demo\war_and_peace_ch2.txt test\war_and_peace_ch2.txt data=##BASEPATH##kernelhwsrv\kerneltest\e32test\smp_demo\war_and_peace_ch3.txt test\war_and_peace_ch3.txt diff -r 56f325a607ea -r 0173bcd7697c kernel/eka/rombuild/autoexec_smpsoak.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/kernel/eka/rombuild/autoexec_smpsoak.bat Thu Jan 07 13:38:45 2010 +0200 @@ -0,0 +1,35 @@ +rem +rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +rem All rights reserved. +rem This component and the accompanying materials are made available +rem under the terms of the License "Eclipse Public License v1.0" +rem which accompanies this distribution, and is available +rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +rem + +rem Nokia Corporation - initial contribution. +rem +rem Contributors: +rem +rem Description: +rem + +start t_smpsoak.exe -p 40000 -b + +trace 2 2 +z: +cd test +format c: +format d: +runtests e32test.auto.bat -st -t 60 +format c: +format d: +runtests loader.auto.bat -st -t 540 +format c: +format d: +runtests f32test.auto.bat -d c -st -t 60 +format c: +format d: +format c: +format d: +runtests f32test.auto.bat -d d -st -t 540 -p \ No newline at end of file diff -r 56f325a607ea -r 0173bcd7697c kernel/eka/rombuild/btrace.iby --- a/kernel/eka/rombuild/btrace.iby Wed Dec 23 11:43:31 2009 +0000 +++ b/kernel/eka/rombuild/btrace.iby Thu Jan 07 13:38:45 2010 +0200 @@ -18,7 +18,7 @@ #ifndef BTRACE_INCLUDED #define BTRACE_INCLUDED -data=ABI_DIR\DEBUG_DIR\BTRACEX_LDD \sys\bin\btracex.ldd +data=KERNEL_DIR\DEBUG_DIR\BTRACEX_LDD \sys\bin\btracex.ldd file=ABI_DIR\DEBUG_DIR\btracec.dll \sys\bin\btracec.dll #endif \ No newline at end of file diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/active/t_messge.cpp --- a/kerneltest/e32test/active/t_messge.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/active/t_messge.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -50,6 +50,7 @@ #include #include #include +#include #include const TInt KHeapMinSize=0x1000; diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/buffer/t_char.cpp --- a/kerneltest/e32test/buffer/t_char.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/buffer/t_char.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -1,7 +1,7 @@ // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). // All rights reserved. // This component and the accompanying materials are made available -// under the terms of "Eclipse Public License v1.0"" +// under the terms of the License "Eclipse Public License v1.0" // which accompanies this distribution, and is available // at the URL "http://www.eclipse.org/legal/epl-v10.html". // @@ -370,9 +370,9 @@ } -// +////////////////////////////////////////////// // Test Fold, Fold(TChar::EFoldAccents), Collate, LowerCase, UpperCase -// +//////////////////////////////////////////// template GLDEF_C void TestTChar::Test4(TCharTypes CharType) { diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/debug/t_codemodifier.cpp --- a/kerneltest/e32test/debug/t_codemodifier.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/debug/t_codemodifier.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -51,6 +51,7 @@ #define __E32TEST_EXTENSION__ #include #include +#include #include #include "d_codemodifier.h" #include "../misc/prbs.h" diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/defrag/t_ramdefrag.cpp --- a/kerneltest/e32test/defrag/t_ramdefrag.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/defrag/t_ramdefrag.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/demandpaging/t_datapaging.cpp --- a/kerneltest/e32test/demandpaging/t_datapaging.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/demandpaging/t_datapaging.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -1200,12 +1200,12 @@ if (gDataPagingSupported) { + test.Next(_L("Test reading and writing to a single page")); + TestOnePage(); + test.Next(_L("Test 64-bit atomic operations are atomic with paged out data")); TestAtomic64(); - test.Next(_L("Test reading and writing to a single page")); - TestOnePage(); - test.Next(_L("Test interaction between decommit and steal")); TestDecommitAndStealInteraction(10); @@ -1220,6 +1220,17 @@ test.Next(_L("Soak tests")); DPTest::FlushCache(); + + test.Next(_L("Soak test: change maximum cache size to minimal")); + TUint cacheOriginalMin = 0; + TUint cacheOriginalMax = 0; + TUint cacheCurrentSize = 0; + //store original values + DPTest::CacheSize(cacheOriginalMin, cacheOriginalMax, cacheCurrentSize); + gMaxCacheSize = 256; + gMinCacheSize = 64; + test_KErrNone(DPTest::SetCacheSize(gMinCacheSize * gPageSize, gMaxCacheSize * gPageSize)); + for (TUint totalThreads = 1 ; totalThreads <= 64 ; totalThreads *= 4) { for (TUint processes = 1 ; processes <= 16 && processes <= totalThreads ; processes *= 4) @@ -1229,12 +1240,16 @@ { for (TUint pin = 0 ; pin <= 1 ; ++pin) { - test.Printf(_L("processes=%d threads=%d pages=%d pin=%d\r\n"),processes, threads, pages, pin); + test.Printf(_L("processes=%d threads=%d pages=%d maxcachesize=%d pin=%d\r\n"),processes, threads, pages, gMaxCacheSize,pin); SoakTest(processes, threads, pages, pin, 3); } } } } + + //Reset the cache size to normal + test.Next(_L("Soak test: Reset cache size to normal")); + test_KErrNone(DPTest::SetCacheSize(cacheOriginalMin, cacheOriginalMax)); } test.End(); diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/demandpaging/t_pagetable_limit.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/kerneltest/e32test/demandpaging/t_pagetable_limit.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -0,0 +1,356 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// e32test\demandpaging\t_pagetable_limit.cpp +// Tests to expose the limit of page table virtual address space. +// +// + +//! @SYMTestCaseID KBASE-T_PAGETABLE_LIMIT +//! @SYMTestType UT +//! @SYMPREQ PREQ1490 +//! @SYMTestCaseDesc Tests to expose the limit of page table virtual address space. +//! @SYMTestActions Test that a paged page table can always be acquired. +//! @SYMTestExpectedResults All tests should pass. +//! @SYMTestPriority High +//! @SYMTestStatus Implemented + +#define __E32TEST_EXTENSION__ +#include +#include +#include +#include +#include + +#include "t_dpcmn.h" + +RTest test(_L("T_PAGETABLE_LIMIT")); + + +_LIT(KClientPtServerName, "CClientPtServer"); +_LIT(KClientProcessName, "T_PAGETABLE_LIMIT"); + +enum TClientMsgType + { + EClientConnect = -1, + EClientDisconnect = -2, + EClientGetChunk = 0, + EClientReadChunks = 1, + }; + +class RDataPagingSession : public RSessionBase + { +public: + TInt CreateSession(const TDesC& aServerName, TInt aMsgSlots) + { + return RSessionBase::CreateSession(aServerName,User::Version(),aMsgSlots); + } + TInt PublicSendReceive(TInt aFunction, const TIpcArgs &aPtr) + { + return (SendReceive(aFunction, aPtr)); + } + TInt PublicSend(TInt aFunction, const TIpcArgs &aPtr) + { + return (Send(aFunction, aPtr)); + } + }; + + +TInt ClientProcess(TInt aLen) + { + // Read the command line to get the number of chunk to map and whether or + // not to access their data. + HBufC* buf = HBufC::New(aLen); + test(buf != NULL); + TPtr ptr = buf->Des(); + User::CommandLine(ptr); + + TLex lex(ptr); + TInt chunkCount; + TInt r = lex.Val(chunkCount); + test_KErrNone(r); + lex.SkipSpace(); + + TBool accessData; + r = lex.Val(accessData); + test_KErrNone(r); + + + RDataPagingSession session; + test_KErrNone(session.CreateSession(KClientPtServerName, 1)); + + RChunk* chunks = new RChunk[chunkCount]; + for (TInt i = 0; i < chunkCount; i++) + { + TInt r = chunks[i].SetReturnedHandle(session.PublicSendReceive(EClientGetChunk, TIpcArgs(i))); + if (r != KErrNone) + { + test.Printf(_L("Failed to create a handle to the server's chunk r=%d\n"), r); + for (TInt j = 0; j < i; j++) + chunks[j].Close(); + session.Close(); + return r; + } + test_Value(chunks[i].Size(), chunks[i].Size() >= gPageSize); + } + if (!accessData) + { + // Touch the 1st page of each of the chunks. + for (TInt i = 0; i < chunkCount; i++) + { + // Write the chunk data from top to bottom of the chunk's first page. + TUint8* base = chunks[i].Base(); + TUint8* end = base + gPageSize - 1; + *base = *end; + } + // Tell parent we've touched each chunk. + TInt r = (TThreadId)session.PublicSendReceive(EClientReadChunks,TIpcArgs()); // Assumes id is only 32-bit. + test_KErrNone(r); + for(;;) + {// Wake up every 100ms to be killed by the main process. + User::After(100000); + } + } + else + { + for (;;) + { + TInt offset = 0; + for (TInt i = 0; i < chunkCount; i++) + { + // Write the chunk data from top to bottom of the chunk's first page. + TUint8* base = chunks[i].Base(); + TUint8* end = base + gPageSize - 1; + *(base + offset) = *(end - offset); + } + if (++offset >= (gPageSize >> 1)) + offset = 0; + } + } + } + + +void TestMaxPt() + { + // Flexible memory model reserves 0xF800000-0xFFF00000 for page tables + // this allows 130,048 pages tables. Therefore mapping 1000 one + // page chunks into 256 processes would require 256,000 page tables, i.e. + // more than enough to hit the limit. So that the limit is reached in the middle, + // map 500 unpaged and 500 paged chunks in each process. + const TUint KNumChunks = 1000; + const TUint KPagedChunksStart = (KNumChunks >> 1); + const TUint KNumProcesses = 256; + const TInt KMinFreeRam = (1000 * gPageSize) + (130048 * (gPageSize>>2)); + TInt freeRam; + HAL::Get(HALData::EMemoryRAMFree, freeRam); + if (freeRam < KMinFreeRam) + { + test.Printf(_L("Only 0x%x bytes of free RAM not enough to perform the test. Skipping test.\n"), freeRam); + return; + } + + // Remove the maximum limit on the cache size as the test requires that it can + // allocate as many page tables as possible but without stealing any pages as + // stealing pages may indirectly steal paged page table pages. + TUint minCacheSize, maxCacheSize, currentCacheSize; + DPTest::CacheSize(minCacheSize,maxCacheSize,currentCacheSize); + test_KErrNone(DPTest::SetCacheSize(minCacheSize, KMaxTUint)); + + RServer2 ptServer; + TInt r = ptServer.CreateGlobal(KClientPtServerName); + test_KErrNone(r); + + // Create the global unpaged chunks. They have one page committed + // but have a maximum size large enough to prevent their page tables being + // shared between the chunks. On arm with 4KB pages each page table maps 1MB + // so make chunk 1MB+4KB so chunk requires 2 page tables and is not aligned on + // a 1MB boundary so it is a fine memory object. + const TUint KChunkSize = (1024 * 1024) + gPageSize; + RChunk* chunks = new RChunk[KNumChunks]; + TChunkCreateInfo createInfo; + createInfo.SetNormal(gPageSize, KChunkSize); + createInfo.SetGlobal(KNullDesC); + createInfo.SetPaging(TChunkCreateInfo::EUnpaged); + TUint i = 0; + for (; i < KPagedChunksStart; i++) + { + r = chunks[i].Create(createInfo); + test_KErrNone(r); + } + // Create paged chunks. + createInfo.SetPaging(TChunkCreateInfo::EPaged); + for (; i< KNumChunks; i++) + { + r = chunks[i].Create(createInfo); + test_KErrNone(r); + } + + // Start remote processes, giving each process handles to each chunk. + RProcess* processes = new RProcess[KNumProcesses]; + RMessage2 ptMessage; + TUint processIndex = 0; + TUint processLimit = 0; + for (; processIndex < KNumProcesses; processIndex++) + { + // Start the process. + test.Printf(_L("Creating process %d\n"), processIndex); + TBuf<80> args; + args.AppendFormat(_L("%d %d"), KNumChunks, EFalse); + r = processes[processIndex].Create(KClientProcessName, args); + test_KErrNone(r); + TRequestStatus s; + processes[processIndex].Logon(s); + test_Equal(KRequestPending, s.Int()); + processes[processIndex].Resume(); + + ptServer.Receive(ptMessage); + test_Equal(EClientConnect, ptMessage.Function()); + ptMessage.Complete(KErrNone); + TInt func = EClientGetChunk; + TUint chunkIndex = 0; + for (; chunkIndex < KNumChunks && func == EClientGetChunk; chunkIndex++) + {// Pass handles to all the unpaged chunks to the new process. + ptServer.Receive(ptMessage); + func = ptMessage.Function(); + if (func == EClientGetChunk) + { + TUint index = ptMessage.Int0(); + ptMessage.Complete(chunks[index]); + } + } + if (func != EClientGetChunk) + { + // Should hit the limit of page tables and this process instance should exit + // sending a disconnect message in the process. + test_Equal(EClientDisconnect, func); + // Should only fail when mapping unpaged chunks. + test_Value(chunkIndex, chunkIndex < (KNumChunks >> 1)); + break; + } + // Wait for the process to access all the chunks and therefore + // allocate the paged page tables before moving onto the next process. + ptServer.Receive(ptMessage); + func = ptMessage.Function(); + test_Equal(EClientReadChunks, func); + ptMessage.Complete(KErrNone); + + // Should have mapped all the required chunks. + test_Equal(KNumChunks, chunkIndex); + } + // Should hit page table limit before KNumProcesses have been created. + test_Value(processIndex, processIndex < KNumProcesses - 1); + processLimit = processIndex; + + // Now create more processes to access paged data even though the page table + // address space has been exhausted. Limit to 10 more processes as test takes + // long enough already. + processIndex++; + TUint excessProcesses = KNumProcesses - processIndex; + TUint pagedIndexEnd = (excessProcesses > 10)? processIndex + 10 : processIndex + excessProcesses; + for (; processIndex < pagedIndexEnd; processIndex++) + { + // Start the process. + test.Printf(_L("Creating process %d\n"), processIndex); + TBuf<80> args; + args.AppendFormat(_L("%d %d"), KNumChunks-KPagedChunksStart, ETrue); + r = processes[processIndex].Create(KClientProcessName, args); + if (r != KErrNone) + {// Have hit the limit of processes. + processIndex--; + // Should have created at least one more process. + test_Value(processIndex, processIndex > processLimit); + break; + } + TRequestStatus s; + processes[processIndex].Logon(s); + test_Equal(KRequestPending, s.Int()); + processes[processIndex].Resume(); + + ptServer.Receive(ptMessage); + test_Equal(EClientConnect, ptMessage.Function()); + ptMessage.Complete(KErrNone); + + TInt func = EClientGetChunk; + TUint chunkIndex = KPagedChunksStart; + for (; chunkIndex < KNumChunks && func == EClientGetChunk; chunkIndex++) + {// Pass handles to all the unpaged chunks to the new process. + ptServer.Receive(ptMessage); + func = ptMessage.Function(); + if (func == EClientGetChunk) + { + TUint index = ptMessage.Int0() + KPagedChunksStart; + ptMessage.Complete(chunks[index]); + } + } + if (func != EClientGetChunk) + {// Reached memory limits so exit. + test_Equal(EClientDisconnect, func); + // Should have created at least one more process. + test_Value(processIndex, processIndex > processLimit+1); + break; + } + + // Should have mapped all the required chunks. + test_Equal(KNumChunks, chunkIndex); + } + // If we reached the end of then ensure that we kill only the running processes. + if (processIndex == pagedIndexEnd) + processIndex--; + // Kill all the remote processes + for(TInt j = processIndex; j >= 0; j--) + { + test.Printf(_L("killing process %d\n"), j); + TRequestStatus req; + processes[j].Logon(req); + if (req == KRequestPending) + { + processes[j].Kill(KErrNone); + User::WaitForRequest(req); + } + processes[j].Close(); + } + delete[] processes; + // Close the chunks. + for (TUint k = 0; k < KNumChunks; k++) + chunks[k].Close(); + delete[] chunks; + + test_KErrNone(DPTest::SetCacheSize(minCacheSize, maxCacheSize)); + } + + +TInt E32Main() + { + test_KErrNone(UserHal::PageSizeInBytes(gPageSize)); + + TUint len = User::CommandLineLength(); + if (len > 0) + { + return ClientProcess(len); + } + + test.Title(); + test_KErrNone(GetGlobalPolicies()); + + if (!gDataPagingSupported) + { + test.Printf(_L("Data paging not enabled so skipping test...\n")); + return KErrNone; + } + + test.Start(_L("Test the system can always acquire a paged page table")); + TestMaxPt(); + + test.End(); + return KErrNone; + } diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/demandpaging/t_svrpinning.cpp --- a/kerneltest/e32test/demandpaging/t_svrpinning.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/demandpaging/t_svrpinning.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/demandpaging/t_thrash.cpp --- a/kerneltest/e32test/demandpaging/t_thrash.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/demandpaging/t_thrash.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -405,6 +405,20 @@ test_KErrNone(GetGlobalPolicies()); + TUint cacheOriginalMin = 0; + TUint cacheOriginalMax = 0; + TUint cacheCurrentSize = 0; + + if (gDataPagingSupported) + { + test.Next(_L("Thrash test: change maximum cache size to minimal")); + //store original values + DPTest::CacheSize(cacheOriginalMin, cacheOriginalMax, cacheCurrentSize); + gMaxCacheSize = 256; + gMinCacheSize = 64; + test_KErrNone(DPTest::SetCacheSize(gMinCacheSize * gPageSize, gMaxCacheSize * gPageSize)); + } + TBool flexibleMemoryModel = (MemModelAttributes() & EMemModelTypeMask) == EMemModelTypeFlexible; if (flexibleMemoryModel) TestThrashHal(); @@ -416,6 +430,12 @@ test.Next(_L("Extended thrashing tests")); TestThrashing(); } + if (gDataPagingSupported) + { + //Reset the cache size to normal + test.Next(_L("Thrash test: Reset cache size to normal")); + test_KErrNone(DPTest::SetCacheSize(cacheOriginalMin, cacheOriginalMax)); + } test.End(); return 0; diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/dll/d_ldrtst.h --- a/kerneltest/e32test/dll/d_ldrtst.h Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/dll/d_ldrtst.h Thu Jan 07 13:38:45 2010 +0200 @@ -18,6 +18,7 @@ #ifndef __D_LDRTST_H__ #define __D_LDRTST_H__ #include +#include _LIT(KLdrTestLddName, "LdrTest"); diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/dll/oe/t_oeexport2.cpp --- a/kerneltest/e32test/dll/oe/t_oeexport2.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/dll/oe/t_oeexport2.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -19,6 +19,7 @@ #include #include +#include RTest test(_L("T_OEEXPORT2")); diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/dll/t_path.cpp --- a/kerneltest/e32test/dll/t_path.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/dll/t_path.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -35,6 +35,8 @@ #define __E32TEST_EXTENSION__ #include #include +#include +#include RTest test(_L("T_PATH")); RFs gFs; diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/emul/t_emul.cpp --- a/kerneltest/e32test/emul/t_emul.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/emul/t_emul.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -34,8 +34,10 @@ #define __E32TEST_EXTENSION__ #include #include -#include "e32std.h" -#include "e32std_private.h" +#include +#include +#include +#include #include "e32test.h" #include "emulator.h" #include "t_emul.h" diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/group/bld.inf --- a/kerneltest/e32test/group/bld.inf Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/group/bld.inf Thu Jan 07 13:38:45 2010 +0200 @@ -31,8 +31,6 @@ PRJ_TESTEXPORTS -../../../kernel/eka/debug/crashMonitor/inc/crashlogwalker.h /epoc32/include/ - ../../../kernel/eka/include/kernel/dobject.h /epoc32/include/kernel/ ../../../userlibandfileserver/domainmgr/inc/domainobserver.h /epoc32/include/ @@ -181,6 +179,7 @@ #if !defined(WINS) && !defined(X86) d_ramdefrag support d_pagemove support +d_smpsoak support #endif #if !defined(X86) @@ -585,6 +584,12 @@ t_empty t_empty2 +#if !defined(WINS) && !defined(X86) +t_smpsoak +t_smpsoakprocess support +t_smpsoakspin support +#endif + // /E32TEST/MMU tests t_chunk t_chunk2 @@ -889,6 +894,7 @@ t_dpapi_cu t_datapaging +t_pagetable_limit t_svrpinning t_svrpinning_p t_svrpinning_up diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/group/d_atomic.mmp --- a/kerneltest/e32test/group/d_atomic.mmp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/group/d_atomic.mmp Thu Jan 07 13:38:45 2010 +0200 @@ -30,3 +30,4 @@ vendorid 0x70000001 capability all epocallowdlldata +SMPSAFE diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/group/d_btrace.mmp --- a/kerneltest/e32test/group/d_btrace.mmp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/group/d_btrace.mmp Thu Jan 07 13:38:45 2010 +0200 @@ -29,3 +29,4 @@ capability all vendorid 0x70000001 +SMPSAFE diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/group/d_cache.mmp --- a/kerneltest/e32test/group/d_cache.mmp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/group/d_cache.mmp Thu Jan 07 13:38:45 2010 +0200 @@ -36,3 +36,4 @@ macro __SECURE_API__ vendorid 0x70000001 +SMPSAFE diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/group/d_codemodifier.mmp --- a/kerneltest/e32test/group/d_codemodifier.mmp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/group/d_codemodifier.mmp Thu Jan 07 13:38:45 2010 +0200 @@ -35,3 +35,4 @@ start wins win32_headers end // wins +SMPSAFE diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/group/d_context.mmp --- a/kerneltest/e32test/group/d_context.mmp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/group/d_context.mmp Thu Jan 07 13:38:45 2010 +0200 @@ -35,3 +35,4 @@ capability all VENDORID 0x70000001 +SMPSAFE diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/group/d_debugapi.mmp --- a/kerneltest/e32test/group/d_debugapi.mmp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/group/d_debugapi.mmp Thu Jan 07 13:38:45 2010 +0200 @@ -32,3 +32,4 @@ VENDORID 0x70000001 epocallowdlldata +SMPSAFE diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/group/d_demandpaging.mmp --- a/kerneltest/e32test/group/d_demandpaging.mmp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/group/d_demandpaging.mmp Thu Jan 07 13:38:45 2010 +0200 @@ -27,4 +27,5 @@ capability all vendorid 0x70000001 +SMPSAFE diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/group/d_dmasim.mmp --- a/kerneltest/e32test/group/d_dmasim.mmp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/group/d_dmasim.mmp Thu Jan 07 13:38:45 2010 +0200 @@ -35,3 +35,4 @@ macro __DMASIM__ VENDORID 0x70000001 +SMPSAFE diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/group/d_dobject.mmp --- a/kerneltest/e32test/group/d_dobject.mmp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/group/d_dobject.mmp Thu Jan 07 13:38:45 2010 +0200 @@ -39,3 +39,4 @@ capability all EPOCALLOWDLLDATA +SMPSAFE diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/group/d_emitest.mmp --- a/kerneltest/e32test/group/d_emitest.mmp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/group/d_emitest.mmp Thu Jan 07 13:38:45 2010 +0200 @@ -28,3 +28,4 @@ start wins win32_headers end +SMPSAFE diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/group/d_eventtracker.mmp --- a/kerneltest/e32test/group/d_eventtracker.mmp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/group/d_eventtracker.mmp Thu Jan 07 13:38:45 2010 +0200 @@ -39,3 +39,4 @@ start wins win32_headers end // wins +SMPSAFE diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/group/d_gobble.mmp --- a/kerneltest/e32test/group/d_gobble.mmp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/group/d_gobble.mmp Thu Jan 07 13:38:45 2010 +0200 @@ -29,3 +29,4 @@ uid 0x100000af vendorid 0x70000001 capability all +SMPSAFE diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/group/d_guiconfig.mmp --- a/kerneltest/e32test/group/d_guiconfig.mmp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/group/d_guiconfig.mmp Thu Jan 07 13:38:45 2010 +0200 @@ -30,3 +30,4 @@ vendorid 0x70000001 capability all +SMPSAFE diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/group/d_implicit.mmp --- a/kerneltest/e32test/group/d_implicit.mmp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/group/d_implicit.mmp Thu Jan 07 13:38:45 2010 +0200 @@ -32,3 +32,4 @@ capability all +SMPSAFE diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/group/d_kern_msg.mmp --- a/kerneltest/e32test/group/d_kern_msg.mmp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/group/d_kern_msg.mmp Thu Jan 07 13:38:45 2010 +0200 @@ -29,3 +29,4 @@ VENDORID 0x70000001 capability all +SMPSAFE diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/group/d_kernasmbm.mmp --- a/kerneltest/e32test/group/d_kernasmbm.mmp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/group/d_kernasmbm.mmp Thu Jan 07 13:38:45 2010 +0200 @@ -31,3 +31,4 @@ capability all vendorid 0x70000001 macro __SECURE_API__ +SMPSAFE diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/group/d_kheap.mmp --- a/kerneltest/e32test/group/d_kheap.mmp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/group/d_kheap.mmp Thu Jan 07 13:38:45 2010 +0200 @@ -35,3 +35,4 @@ start wins win32_headers end // wins +SMPSAFE diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/group/d_kucopy.mmp --- a/kerneltest/e32test/group/d_kucopy.mmp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/group/d_kucopy.mmp Thu Jan 07 13:38:45 2010 +0200 @@ -28,3 +28,4 @@ capability all +SMPSAFE diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/group/d_ldd.mmp --- a/kerneltest/e32test/group/d_ldd.mmp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/group/d_ldd.mmp Thu Jan 07 13:38:45 2010 +0200 @@ -30,3 +30,4 @@ VENDORID 0x70000001 capability all +SMPSAFE diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/group/d_ldd2.mmp --- a/kerneltest/e32test/group/d_ldd2.mmp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/group/d_ldd2.mmp Thu Jan 07 13:38:45 2010 +0200 @@ -27,3 +27,4 @@ EPOCALLOWDLLDATA capability all +SMPSAFE diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/group/d_ldd2_ram.mmp --- a/kerneltest/e32test/group/d_ldd2_ram.mmp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/group/d_ldd2_ram.mmp Thu Jan 07 13:38:45 2010 +0200 @@ -30,3 +30,4 @@ ramtarget + capability all +SMPSAFE diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/group/d_ldd_ram.mmp --- a/kerneltest/e32test/group/d_ldd_ram.mmp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/group/d_ldd_ram.mmp Thu Jan 07 13:38:45 2010 +0200 @@ -32,3 +32,4 @@ RAMTARGET + capability all +SMPSAFE diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/group/d_ldddigitisertest.mmp --- a/kerneltest/e32test/group/d_ldddigitisertest.mmp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/group/d_ldddigitisertest.mmp Thu Jan 07 13:38:45 2010 +0200 @@ -41,3 +41,4 @@ start wins win32_headers end +SMPSAFE diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/group/d_lddns.mmp --- a/kerneltest/e32test/group/d_lddns.mmp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/group/d_lddns.mmp Thu Jan 07 13:38:45 2010 +0200 @@ -31,3 +31,4 @@ RAMTARGET D_LDDNS_ram.LDD capability all +SMPSAFE diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/group/d_lddpowerseqtest.mmp --- a/kerneltest/e32test/group/d_lddpowerseqtest.mmp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/group/d_lddpowerseqtest.mmp Thu Jan 07 13:38:45 2010 +0200 @@ -34,3 +34,4 @@ start wins win32_headers end +SMPSAFE diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/group/d_lddturnaroundtimertest.mmp --- a/kerneltest/e32test/group/d_lddturnaroundtimertest.mmp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/group/d_lddturnaroundtimertest.mmp Thu Jan 07 13:38:45 2010 +0200 @@ -34,3 +34,4 @@ start wins win32_headers end +SMPSAFE diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/group/d_ldrtst.mmp --- a/kerneltest/e32test/group/d_ldrtst.mmp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/group/d_ldrtst.mmp Thu Jan 07 13:38:45 2010 +0200 @@ -29,3 +29,4 @@ capability all VENDORID 0x70000001 +SMPSAFE diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/group/d_logtofile.mmp --- a/kerneltest/e32test/group/d_logtofile.mmp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/group/d_logtofile.mmp Thu Jan 07 13:38:45 2010 +0200 @@ -35,3 +35,4 @@ start wins win32_headers end // wins +SMPSAFE diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/group/d_memorytest.mmp --- a/kerneltest/e32test/group/d_memorytest.mmp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/group/d_memorytest.mmp Thu Jan 07 13:38:45 2010 +0200 @@ -29,4 +29,5 @@ capability all vendorid 0x70000001 +SMPSAFE diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/group/d_mmcsc.mmp --- a/kerneltest/e32test/group/d_mmcsc.mmp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/group/d_mmcsc.mmp Thu Jan 07 13:38:45 2010 +0200 @@ -29,3 +29,4 @@ start wins win32_headers end +SMPSAFE diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/group/d_newldd.mmp --- a/kerneltest/e32test/group/d_newldd.mmp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/group/d_newldd.mmp Thu Jan 07 13:38:45 2010 +0200 @@ -38,3 +38,4 @@ VENDORID 0x70000001 capability all +SMPSAFE diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/group/d_nktrace.mmp --- a/kerneltest/e32test/group/d_nktrace.mmp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/group/d_nktrace.mmp Thu Jan 07 13:38:45 2010 +0200 @@ -32,3 +32,4 @@ capability all +SMPSAFE diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/group/d_pagemove.mmp --- a/kerneltest/e32test/group/d_pagemove.mmp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/group/d_pagemove.mmp Thu Jan 07 13:38:45 2010 +0200 @@ -28,3 +28,4 @@ ROMTARGET RAMTARGET + capability all +SMPSAFE diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/group/d_pagestress.mmp --- a/kerneltest/e32test/group/d_pagestress.mmp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/group/d_pagestress.mmp Thu Jan 07 13:38:45 2010 +0200 @@ -28,4 +28,5 @@ capability all vendorid 0x70000001 +SMPSAFE diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/group/d_pagingexample_1_post.mmp --- a/kerneltest/e32test/group/d_pagingexample_1_post.mmp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/group/d_pagingexample_1_post.mmp Thu Jan 07 13:38:45 2010 +0200 @@ -28,4 +28,5 @@ capability all vendorid 0x70000001 +SMPSAFE diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/group/d_pagingexample_1_pre.mmp --- a/kerneltest/e32test/group/d_pagingexample_1_pre.mmp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/group/d_pagingexample_1_pre.mmp Thu Jan 07 13:38:45 2010 +0200 @@ -28,4 +28,5 @@ capability all vendorid 0x70000001 +SMPSAFE diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/group/d_pagingexample_2_post.mmp --- a/kerneltest/e32test/group/d_pagingexample_2_post.mmp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/group/d_pagingexample_2_post.mmp Thu Jan 07 13:38:45 2010 +0200 @@ -28,4 +28,5 @@ capability all vendorid 0x70000001 +SMPSAFE diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/group/d_pagingexample_2_pre.mmp --- a/kerneltest/e32test/group/d_pagingexample_2_pre.mmp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/group/d_pagingexample_2_pre.mmp Thu Jan 07 13:38:45 2010 +0200 @@ -28,4 +28,5 @@ capability all vendorid 0x70000001 +SMPSAFE diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/group/d_prmacctst.mmp --- a/kerneltest/e32test/group/d_prmacctst.mmp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/group/d_prmacctst.mmp Thu Jan 07 13:38:45 2010 +0200 @@ -33,3 +33,4 @@ epocallowdlldata noexportlibrary +SMPSAFE diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/group/d_prmacctstsim.mmp --- a/kerneltest/e32test/group/d_prmacctstsim.mmp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/group/d_prmacctstsim.mmp Thu Jan 07 13:38:45 2010 +0200 @@ -37,3 +37,4 @@ macro RESOURCE_MANAGER_SIMULATED_PSL macro PRM_ENABLE_EXTENDED_VERSION +SMPSAFE diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/group/d_prof.mmp --- a/kerneltest/e32test/group/d_prof.mmp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/group/d_prof.mmp Thu Jan 07 13:38:45 2010 +0200 @@ -26,3 +26,4 @@ VENDORID 0x70000001 capability all +SMPSAFE diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/group/d_ramdefrag.mmp --- a/kerneltest/e32test/group/d_ramdefrag.mmp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/group/d_ramdefrag.mmp Thu Jan 07 13:38:45 2010 +0200 @@ -30,3 +30,4 @@ VENDORID 0x70000001 capability all +SMPSAFE diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/group/d_ramstress.mmp --- a/kerneltest/e32test/group/d_ramstress.mmp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/group/d_ramstress.mmp Thu Jan 07 13:38:45 2010 +0200 @@ -30,4 +30,5 @@ capability all vendorid 0x70000001 +SMPSAFE diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/group/d_rndtim.mmp --- a/kerneltest/e32test/group/d_rndtim.mmp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/group/d_rndtim.mmp Thu Jan 07 13:38:45 2010 +0200 @@ -50,3 +50,4 @@ VENDORID 0x70000001 capability all +SMPSAFE diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/group/d_schedhook.mmp --- a/kerneltest/e32test/group/d_schedhook.mmp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/group/d_schedhook.mmp Thu Jan 07 13:38:45 2010 +0200 @@ -28,3 +28,4 @@ VENDORID 0x70000001 capability all +SMPSAFE diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/group/d_shadow.mmp --- a/kerneltest/e32test/group/d_shadow.mmp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/group/d_shadow.mmp Thu Jan 07 13:38:45 2010 +0200 @@ -29,3 +29,4 @@ VENDORID 0x70000001 capability all +SMPSAFE diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/group/d_sharedchunk.mmp --- a/kerneltest/e32test/group/d_sharedchunk.mmp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/group/d_sharedchunk.mmp Thu Jan 07 13:38:45 2010 +0200 @@ -29,4 +29,5 @@ capability all vendorid 0x70000001 +SMPSAFE diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/group/d_sharedio.mmp --- a/kerneltest/e32test/group/d_sharedio.mmp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/group/d_sharedio.mmp Thu Jan 07 13:38:45 2010 +0200 @@ -31,3 +31,4 @@ VENDORID 0x70000001 capability all +SMPSAFE diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/group/d_shbuf_client.mmp --- a/kerneltest/e32test/group/d_shbuf_client.mmp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/group/d_shbuf_client.mmp Thu Jan 07 13:38:45 2010 +0200 @@ -35,3 +35,4 @@ start wins win32_headers end +SMPSAFE diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/group/d_shbuf_own.mmp --- a/kerneltest/e32test/group/d_shbuf_own.mmp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/group/d_shbuf_own.mmp Thu Jan 07 13:38:45 2010 +0200 @@ -33,3 +33,4 @@ start wins win32_headers end +SMPSAFE diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/group/d_sldd.mmp --- a/kerneltest/e32test/group/d_sldd.mmp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/group/d_sldd.mmp Thu Jan 07 13:38:45 2010 +0200 @@ -34,3 +34,4 @@ start wins win32_headers end +SMPSAFE \ No newline at end of file diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/group/d_smpsoak.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/kerneltest/e32test/group/d_smpsoak.mmp Thu Jan 07 13:38:45 2010 +0200 @@ -0,0 +1,32 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// e32test\group\d_smpsoak.mmp +// + + + +#include "kernel/kern_ext.mmh" + +target d_smpsoak.ldd +targettype ldd +sourcepath ../smpsoak +source d_smpsoak.cpp + +vendorid 0x70000001 + +SMPSAFE + +capability all + + diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/group/d_testearlyextension.mmp --- a/kerneltest/e32test/group/d_testearlyextension.mmp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/group/d_testearlyextension.mmp Thu Jan 07 13:38:45 2010 +0200 @@ -36,3 +36,4 @@ uid 0x100000af capability all +SMPSAFE diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/group/d_tick.mmp --- a/kerneltest/e32test/group/d_tick.mmp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/group/d_tick.mmp Thu Jan 07 13:38:45 2010 +0200 @@ -67,3 +67,4 @@ END capability all +SMPSAFE diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/group/d_traceredirect.mmp --- a/kerneltest/e32test/group/d_traceredirect.mmp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/group/d_traceredirect.mmp Thu Jan 07 13:38:45 2010 +0200 @@ -32,3 +32,4 @@ start wins win32_headers end +SMPSAFE diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/group/dmasim.mmp --- a/kerneltest/e32test/group/dmasim.mmp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/group/dmasim.mmp Thu Jan 07 13:38:45 2010 +0200 @@ -54,3 +54,4 @@ VENDORID 0x70000001 +SMPSAFE diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/group/earlyextension.mmp --- a/kerneltest/e32test/group/earlyextension.mmp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/group/earlyextension.mmp Thu Jan 07 13:38:45 2010 +0200 @@ -32,4 +32,5 @@ capability all vendorid 0x70000001 +SMPSAFE \ No newline at end of file diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/group/medt1.mmp --- a/kerneltest/e32test/group/medt1.mmp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/group/medt1.mmp Thu Jan 07 13:38:45 2010 +0200 @@ -26,3 +26,4 @@ VENDORID 0x70000001 capability all +SMPSAFE diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/group/medt2.mmp --- a/kerneltest/e32test/group/medt2.mmp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/group/medt2.mmp Thu Jan 07 13:38:45 2010 +0200 @@ -26,3 +26,4 @@ VENDORID 0x70000001 capability all +SMPSAFE diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/group/seromawd.mmp --- a/kerneltest/e32test/group/seromawd.mmp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/group/seromawd.mmp Thu Jan 07 13:38:45 2010 +0200 @@ -36,3 +36,4 @@ capability all +SMPSAFE diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/group/t_dispchan.mmp --- a/kerneltest/e32test/group/t_dispchan.mmp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/group/t_dispchan.mmp Thu Jan 07 13:38:45 2010 +0200 @@ -30,3 +30,4 @@ library euser.lib hal.lib UID 0 0x0100b003 +SMPSAFE diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/group/t_drtaeabi.mmp --- a/kerneltest/e32test/group/t_drtaeabi.mmp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/group/t_drtaeabi.mmp Thu Jan 07 13:38:45 2010 +0200 @@ -17,13 +17,8 @@ TARGETTYPE dll -#if defined ARMCC_2_1 -SOURCEPATH ../../../kernel/eka/compsupp/rvct2_1 -#elif defined ARMCC_2_2 -SOURCEPATH ../../../kernel/eka/compsupp/rvct2_2 -#elif defined ARMCC_3_1 -SOURCEPATH ../../../kernel/eka/compsupp/rvct3_1 -#endif +SOURCEPATH ../../../kernel/eka/compsupp/rvct + SOURCE aeabidiv0.cpp SOURCE drtaeabi.cpp SOURCE type_info.cpp diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/group/t_lat2m.mmp --- a/kerneltest/e32test/group/t_lat2m.mmp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/group/t_lat2m.mmp Thu Jan 07 13:38:45 2010 +0200 @@ -21,6 +21,7 @@ SOURCE t_lat2.cpp LIBRARY euser.lib OS_LAYER_SYSTEMINCLUDE_SYMBIAN +USERINCLUDE ../../../userlibandfileserver/fileserver/inc capability all diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/group/t_pagetable_limit.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/kerneltest/e32test/group/t_pagetable_limit.mmp Thu Jan 07 13:38:45 2010 +0200 @@ -0,0 +1,28 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// e32test/group/t_pagetable_limit.mmp +// +// + +target t_pagetable_limit.exe +targettype exe +sourcepath ../demandpaging +source t_pagetable_limit.cpp +source t_dpcmn.cpp +library euser.lib hal.lib dptest.lib +OS_LAYER_SYSTEMINCLUDE_SYMBIAN +capability all +vendorid 0x70000001 + +smpsafe diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/group/t_prop_ldd.mmp --- a/kerneltest/e32test/group/t_prop_ldd.mmp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/group/t_prop_ldd.mmp Thu Jan 07 13:38:45 2010 +0200 @@ -30,4 +30,5 @@ start wins win32_headers end +SMPSAFE diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/group/t_smpsoak.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/kerneltest/e32test/group/t_smpsoak.mmp Thu Jan 07 13:38:45 2010 +0200 @@ -0,0 +1,31 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// e32test\group\t_smpsoak.mmp + +target t_smpsoak.exe +targettype exe +sourcepath ../smpsoak +source t_smpsoak.cpp +library euser.lib efsrv.lib hal.lib dptest.lib +capability all +vendorid 0x70000001 + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +SMPSAFE + +// This binary goes in rom and is not paged +romtarget + +unpagedcode +unpageddata diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/group/t_smpsoakprocess.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/kerneltest/e32test/group/t_smpsoakprocess.mmp Thu Jan 07 13:38:45 2010 +0200 @@ -0,0 +1,32 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// e32test\group\t_smpsoakprocess.mmp + +target t_smpsoakprocess.exe +targettype exe +sourcepath ../smpsoak +source t_smpsoakprocess.cpp +library euser.lib efsrv.lib hal.lib dptest.lib +capability all +vendorid 0x70000001 + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +SMPSAFE + +// This binary goes in rom and is not paged +romtarget + +unpagedcode +unpageddata + diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/group/t_smpsoakspin.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/kerneltest/e32test/group/t_smpsoakspin.mmp Thu Jan 07 13:38:45 2010 +0200 @@ -0,0 +1,34 @@ +/* +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of the License "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +target t_smpsoakspin.exe +targettype exe +sourcepath ../smpsoak +source t_smpsoakspin.cpp +library euser.lib hal.lib dptest.lib +capability all +vendorid 0x70000001 + +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +SMPSAFE + +// This binary goes in rom and is not paged +romtarget + +unpagedcode +unpageddata diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/heap/t_fail.cpp --- a/kerneltest/e32test/heap/t_fail.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/heap/t_fail.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -37,6 +37,8 @@ #include #include #include +#include +#include #include "d_kheap.h" LOCAL_D RTest test(_L("T_FAIL")); diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/iic/iic_psl/i2c.cpp --- a/kerneltest/e32test/iic/iic_psl/i2c.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/iic/iic_psl/i2c.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -125,10 +125,6 @@ aDes.Copy((TUint8*)&caps,size); } - -DSimulatedI2cDevice* gDummyDevice; - - // supported channels for this implementation static DIicBusChannel* ChannelPtrArray[NUM_CHANNELS]; @@ -136,12 +132,6 @@ //DECLARE_EXTENSION_WITH_PRIORITY(BUS_IMPLMENTATION_PRIORITY) DECLARE_STANDARD_PDD() // I2c test driver to be explicitly loaded as an LDD, not kernel extension { - if(gDummyDevice == NULL) - gDummyDevice = new DSimulatedI2cDevice; - if(gDummyDevice == NULL) - return NULL; - I2C_PRINT(("\n\nI2C PDD, channel creation loop follows ...\n")); - #ifndef STANDALONE_CHANNEL DIicBusChannel* chan=NULL; for(TInt i=0; i const TInt KIicClientMajorVersionNumber = 1; const TInt KIicClientMinorVersionNumber = 0; diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/lffs/t_lfsdrv2.cpp --- a/kerneltest/e32test/lffs/t_lfsdrv2.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/lffs/t_lfsdrv2.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -532,7 +532,7 @@ test(r==KErrNone); test.Printf(_L("Size : %08x\n"),I64LOW(DriveCaps.iSize)); test.Printf(_L("Type : %d\n"),DriveCaps.iType); - test.Printf(_L("BatState : %d\n"),DriveCaps.iBattery); + test.Printf(_L("Connection Bus : %d\n"),DriveCaps.iConnectionBusType); test.Printf(_L("DriveAtt : %02x\n"),DriveCaps.iDriveAtt); test.Printf(_L("MediaAtt : %02x\n"),DriveCaps.iMediaAtt); test.Printf(_L("BaseAddress : %08x\n"),DriveCaps.iBaseAddress); diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/lffs/tf_fsscan.cpp --- a/kerneltest/e32test/lffs/tf_fsscan.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/lffs/tf_fsscan.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -49,7 +49,7 @@ { RDebug::Print( _L(" size=%ld"), aCaps.iSize ); RDebug::Print( _L(" media type=%d"), aCaps.iType ); - RDebug::Print( _L(" battery state=%d"), aCaps.iBattery ); + RDebug::Print( _L(" connection bus=%d"), aCaps.iConnectionBusType ); RDebug::Print( _L(" drive attributes=0x%x"), aCaps.iDriveAtt ); RDebug::Print( _L(" media attributes=0x%x"), aCaps.iMediaAtt ); RDebug::Print( _L(" base address=0x%x"), aCaps.iBaseAddress ); @@ -134,9 +134,9 @@ { RDebug::Print( _L(" media type=%d"), aInfo.iDrive.iType ); - RDebug::Print( _L(" battery state=%d"), aInfo.iDrive.iBattery ); RDebug::Print( _L(" drive attributes=0x%x"), aInfo.iDrive.iDriveAtt ); RDebug::Print( _L(" media attributes=0x%x"), aInfo.iDrive.iMediaAtt ); + RDebug::Print( _L(" connection bus=%d"), aInfo.iDrive.iConnectionBusType ); RDebug::Print( _L(" UID=0x%x"), aInfo.iUniqueID ); RDebug::Print( _L(" size=0x%lx"), aInfo.iSize ); diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/locl/t_lat1.cpp --- a/kerneltest/e32test/locl/t_lat1.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/locl/t_lat1.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -1,7 +1,7 @@ // Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies). // All rights reserved. // This component and the accompanying materials are made available -// under the terms of "Eclipse Public License v1.0"" +// under the terms of the License "Eclipse Public License v1.0" // which accompanies this distribution, and is available // at the URL "http://www.eclipse.org/legal/epl-v10.html". // diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/misc/inflate.c --- a/kerneltest/e32test/misc/inflate.c Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/misc/inflate.c Thu Jan 07 13:38:45 2010 +0200 @@ -2,7 +2,7 @@ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" +* under the terms of the License "Eclipse Public License v1.0" * which accompanies this distribution, and is available * at the URL "http://www.eclipse.org/legal/epl-v10.html". * diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/misc/t_destruct.cpp --- a/kerneltest/e32test/misc/t_destruct.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/misc/t_destruct.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -20,6 +20,8 @@ #include #include +#include +#include #include #include #include diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/mmu/d_shbuf.cpp --- a/kerneltest/e32test/mmu/d_shbuf.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/mmu/d_shbuf.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -339,12 +339,15 @@ // Descriptor writes case RShBufTestChannel::EFromTPtr8ProcessAndReturn: { - TUint size = ((const TDes8*)a1)->Size(); + TPtr8 tempPtr(0, 0, 0); + kumemget(&tempPtr, a1, sizeof(tempPtr)); + + TUint size = tempPtr.Size(); if(size <= sizeof(iDriverRxBuffer)) { NKern::ThreadEnterCS(); - r = Kern::CreateAndPinVirtualMemory(iPin, (TLinAddr)((const TDes8*)a1)->Ptr(), size); + r = Kern::CreateAndPinVirtualMemory(iPin, (TLinAddr)tempPtr.Ptr(), size); NKern::ThreadLeaveCS(); } else diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/pccd/d_medt1.cpp --- a/kerneltest/e32test/pccd/d_medt1.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/pccd/d_medt1.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -228,7 +228,7 @@ TLocalDriveCapsV2 caps; caps.iType=EMediaRam; - caps.iBattery=EBatNotSupported; + caps.iConnectionBusType=EConnectionBusInternal; caps.iDriveAtt=KDriveAttLocal|KDriveAttRemovable; caps.iMediaAtt=KMediaAttFormattable; caps.iFileSystemId=KDriveFileSysFAT; diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/pccd/d_medt2.cpp --- a/kerneltest/e32test/pccd/d_medt2.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/pccd/d_medt2.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -233,7 +233,7 @@ TLocalDriveCapsV2 caps; caps.iType=EMediaFlash; // Pretend its a Flash device - caps.iBattery=EBatNotSupported; + caps.iConnectionBusType=EConnectionBusInternal; caps.iDriveAtt=KDriveAttLocal|KDriveAttRemovable; caps.iMediaAtt=KMediaAttFormattable; caps.iFileSystemId=KDriveFileSysFAT; diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/pccd/t_atadr3.cpp --- a/kerneltest/e32test/pccd/t_atadr3.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/pccd/t_atadr3.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -355,7 +355,7 @@ DriveSizeInSectors=(driveSize&~0xfff)>>KSectorShift; // round down to multiple of 8 sectors test.Printf(_L("Drive size = %08x (%dK)\n"),driveSize,driveSize>>10); test.Printf(_L("Media type = %d\n"),driveCaps.iType); - test.Printf(_L("Battery state = %d\n"),driveCaps.iBattery); + test.Printf(_L("Connection Bus = %d\n"),driveCaps.iConnectionBusType); test.Printf(_L("Drive attributes = %08x\n"),driveCaps.iDriveAtt); test.Printf(_L("Media attributes = %08x\n"),driveCaps.iMediaAtt); test.Printf(_L("Base address = %08x\n"),driveCaps.iBaseAddress); diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/pccd/t_atadrv.cpp --- a/kerneltest/e32test/pccd/t_atadrv.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/pccd/t_atadrv.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -259,7 +259,7 @@ #endif // test.Getch(); test(info.iType==EMediaHardDisk); - test(info.iBattery==EBatNotSupported); + test(info.iConnectionBusType==EConnectionBusInternal); test(info.iDriveAtt==(TUint)(KDriveAttLocal|KDriveAttRemovable)); test(info.iMediaAtt==KMediaAttFormattable); test(info.iFileSystemId==KDriveFileSysFAT); diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/pccd/t_crrdrv.cpp --- a/kerneltest/e32test/pccd/t_crrdrv.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/pccd/t_crrdrv.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -148,7 +148,7 @@ test(theCRomDrive.Caps(info)==KErrNone); test(info().iSize==(TInt64)KMaxDriveLen); test(info().iType==EMediaFlash); - test(info().iBattery==EBatNotSupported); + test(info().iConnectionBusType==EConnectionBusInternal); test(info().iDriveAtt==(KDriveAttLocal|KDriveAttRemovable)); test(info().iMediaAtt==KMediaAttFormattable); test(info().iFileSystemId==KDriveFileSysFAT); diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/pccd/t_idrv.cpp --- a/kerneltest/e32test/pccd/t_idrv.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/pccd/t_idrv.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -131,7 +131,7 @@ test(theInternalDrive.Caps(infoPckg)==KErrNone); TUint saveSize=I64LOW(info.iSize); test(info.iType==EMediaRam); - test(info.iBattery==EBatNotSupported); + test(info.iConnectionBusType==EConnectionBusInternal); test(info.iDriveAtt==(KDriveAttLocal|KDriveAttInternal)); test(info.iMediaAtt==(KMediaAttVariableSize|KMediaAttFormattable)); test(info.iFileSystemId==KDriveFileSysFAT); diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/pccd/t_lfsdrv.cpp --- a/kerneltest/e32test/pccd/t_lfsdrv.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/pccd/t_lfsdrv.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -73,7 +73,7 @@ test.Printf( _L("Check drive size: %d\r\n"),diskSize); // test.Getch(); test(info().iType==EMediaFlash); - test(info().iBattery==EBatNotSupported); + test(info().iConnectionBusType==EConnectionBusInternal); test(info().iDriveAtt==(TUint)(KDriveAttLocal|KDriveAttInternal)); test(info().iMediaAtt==KMediaAttFormattable); test(info().iFileSystemId==KDriveFileSysLFFS); diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/pccd/t_media.cpp --- a/kerneltest/e32test/pccd/t_media.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/pccd/t_media.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -187,7 +187,7 @@ TUint driveSize=I64LOW(driveCaps.iSize); test.Printf(_L("Drive size = %08x (%dK)\n"),driveSize,driveSize>>10); test.Printf(_L("Media type = %d\n"),driveCaps.iType); - test.Printf(_L("Battery state = %d\n"),driveCaps.iBattery); + test.Printf(_L("Connection Bus = %d\n"),driveCaps.iConnectionBusType); test.Printf(_L("Drive attributes = %08x\n"),driveCaps.iDriveAtt); test.Printf(_L("Media attributes = %08x\n"),driveCaps.iMediaAtt); test.Printf(_L("Base address = %08x\n"),driveCaps.iBaseAddress); diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/pccd/t_mmcdrv.cpp --- a/kerneltest/e32test/pccd/t_mmcdrv.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/pccd/t_mmcdrv.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -1247,10 +1247,10 @@ TEST_FOR_ERROR( TheMmcDrive.Caps( DriveCaps ) ); - test.Printf( _L("Caps V1:\n\tiSize=0x%lx\n\tiType=%d\n\tiBattery=%d\n\tiDriveAtt=0x%x\n\tiMediaAtt=0x%x\n\tiBaseAddress=0x%x\n\tiFileSystemId=0x%x\n\tiPartitionType=0x%x\n"), + test.Printf( _L("Caps V1:\n\tiSize=0x%lx\n\tiType=%d\n\tiConnectionBusType=%d\n\tiDriveAtt=0x%x\n\tiMediaAtt=0x%x\n\tiBaseAddress=0x%x\n\tiFileSystemId=0x%x\n\tiPartitionType=0x%x\n"), DriveCaps().iSize, DriveCaps().iType, - DriveCaps().iBattery, + DriveCaps().iConnectionBusType, DriveCaps().iDriveAtt, DriveCaps().iMediaAtt, DriveCaps().iBaseAddress, diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/pccd/t_multislot.cpp --- a/kerneltest/e32test/pccd/t_multislot.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/pccd/t_multislot.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -16,6 +16,7 @@ */ #include #include +#include static RTest test(_L("Testing t_multislot")); _LIT(KYes, "yes"); diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/pccd/t_pccdbm.cpp --- a/kerneltest/e32test/pccd/t_pccdbm.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/pccd/t_pccdbm.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -305,10 +305,10 @@ TLocalDriveCapsV6Buf DriveCaps; TheDrive.Caps( DriveCaps ); - test.Printf( _L("Caps V1:\n\tiSize=0x%lx\n\tiType=%d\n\tiBattery=%d\n\tiDriveAtt=0x%x\n\tiMediaAtt=0x%x\n\tiBaseAddress=0x%x\n\tiFileSystemId=0x%x\n\tiPartitionType=0x%x\n"), + test.Printf( _L("Caps V1:\n\tiSize=0x%lx\n\tiType=%d\n\tiConnectionBusType=%d\n\tiDriveAtt=0x%x\n\tiMediaAtt=0x%x\n\tiBaseAddress=0x%x\n\tiFileSystemId=0x%x\n\tiPartitionType=0x%x\n"), DriveCaps().iSize, DriveCaps().iType, - DriveCaps().iBattery, + DriveCaps().iConnectionBusType, DriveCaps().iDriveAtt, DriveCaps().iMediaAtt, DriveCaps().iBaseAddress, diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/power/t_domain.cpp --- a/kerneltest/e32test/power/t_domain.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/power/t_domain.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -58,6 +58,8 @@ #include "domainpolicytest.h" #include #include +#include +#include LOCAL_D RTest test(_L(" T_DOMAIN ")); _LIT(KThreadName, "t_domain_panic_thread"); diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/power/t_power.cpp --- a/kerneltest/e32test/power/t_power.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/power/t_power.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -39,6 +39,8 @@ #include #include #include +#include +#include LOCAL_D RTest test(_L(" T_POWER ")); diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/prime/t_timer.cpp --- a/kerneltest/e32test/prime/t_timer.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/prime/t_timer.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -33,7 +33,7 @@ // Assumptions/Requirement/Pre-requisites: // Failures and causes: // Base Port information: -// +// // // the following was used to help debug emulator implemenation of user mode callbacks @@ -86,12 +86,12 @@ return s != KRequestPending; } + LOCAL_C void testRel() // // Test relative timers. // { - test.Start(_L("After 0")); RTimer t; TInt r=t.CreateLocal(); @@ -101,7 +101,7 @@ test(s==KRequestPending || s==KErrNone); User::WaitForRequest(s); test(s==KErrNone); -// + test.Next(_L("After 1 tenth")); t.After(s,100000); #ifdef __WINS__ @@ -115,7 +115,7 @@ #endif User::WaitForRequest(s); test(s==KErrNone); -// + test.Next(_L("After -1 millionth")); RThread thread; r=thread.Create(_L("After -1"),AfterNegative,KDefaultStackSize,NULL,&thread); @@ -132,13 +132,13 @@ test(thread.ExitType()==EExitPanic); CLOSE_AND_WAIT(thread); User::SetJustInTime(justInTime); -// + test.Next(_L("After 1 second")); t.After(s,1000000); test(s==KRequestPending); User::WaitForRequest(s); test(s==KErrNone); -// + test.Next(_L("After 1 second polling")); t.After(s,1000000); test(s==KRequestPending); @@ -147,7 +147,7 @@ ; // poll test(s==KErrNone); User::WaitForRequest(s); -// + test.Next(_L("Cancel")); t.After(s,1000000); test(s==KRequestPending); @@ -155,7 +155,7 @@ User::WaitForRequest(s); test(s==KErrCancel); t.Close(); -// + test.Next(_L("Request twice")); r=thread.Create(_L("After twice"),AfterTwice,KDefaultStackSize,NULL,&thread); test(r==KErrNone); @@ -170,7 +170,7 @@ test(thread.ExitType()==EExitPanic); CLOSE_AND_WAIT(thread); User::SetJustInTime(justInTime); -// + test.End(); } @@ -196,7 +196,7 @@ TInt totalComplete = 0; TInt totalWaiting = 0; - + while(PollTestRunning) { for (i = 0 ; i < KMaxTimers ; ++i) @@ -207,7 +207,7 @@ // do nothing ++totalWaiting; break; - + case KErrNone: User::WaitForRequest(statuses[i]); ++totalComplete; @@ -225,7 +225,7 @@ } } } - + for (i = 0 ; i < KMaxTimers ; ++i) { User::WaitForRequest(statuses[i]); @@ -245,7 +245,7 @@ RThread threads[KMaxThreads]; TRequestStatus statuses[KMaxThreads]; - + test.Start(_L("Test polling")); PollTestRunning = ETrue; @@ -259,7 +259,7 @@ } User::After(KSecondsToTest * 1000 * 1000); - + PollTestRunning = EFalse; for (i = 0 ; i < KMaxThreads ; ++i) @@ -269,18 +269,18 @@ test_Equal(EExitKill, threads[i].ExitType()); threads[i].Close(); } - + test.End(); } #endif + LOCAL_C void testHomeTime() // // Test HomeTime. // { - TTime t1, t2; t1.HomeTime(); for (TInt x=0;x<100;x++) @@ -344,12 +344,12 @@ return KErrNone; } + LOCAL_C void testAbs() // // Test absolute timers. // { - test.Start(_L("Now -1")); RTimer t; TInt r=t.CreateLocal(); @@ -361,7 +361,7 @@ test(s==KErrUnderflow); // =KRequestPending User::WaitForRequest(s); test(s==KErrUnderflow); -// + TTime time2; test.Next(_L("Synchronise to clock")); time.UniversalTime(); @@ -395,11 +395,11 @@ // Test we are in the same second as the requested time... test(delay>=TTimeIntervalMicroSeconds(0)); test(delay=TTimeIntervalMicroSeconds(0)); test(delay=TTimeIntervalMicroSeconds(0)); test(delay #include #include +#include #include #include #include diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/smp_demo/smp_demo.cpp --- a/kerneltest/e32test/smp_demo/smp_demo.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/smp_demo/smp_demo.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -18,6 +18,7 @@ #include #include +#include #include #include #include diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/smpsoak/d_smpsoak.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/kerneltest/e32test/smpsoak/d_smpsoak.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -0,0 +1,185 @@ +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// e32test\smpsoak\d_smpsoak.cpp +// + +// LDD for smpsoak - setting Thread CPU Affinity +// + +#include "d_smpsoak.h" +#include +#include + +const TInt KMajorVersionNumber=0; +const TInt KMinorVersionNumber=1; +const TInt KBuildVersionNumber=1; + +class DSmpSoakFactory : public DLogicalDevice +// +// IPC copy LDD factory +// + { +public: + DSmpSoakFactory(); + virtual TInt Install(); //overriding pure virtual + virtual void GetCaps(TDes8& aDes) const; //overriding pure virtual + virtual TInt Create(DLogicalChannelBase*& aChannel); //overriding pure virtual + }; + +class DSmpSoak : public DLogicalChannelBase + { +public: + DSmpSoak(); + virtual ~DSmpSoak(); +protected: + virtual TInt DoCreate(TInt aUnit, const TDesC8* aInfo, const TVersion& aVer); + virtual TInt Request(TInt aReqNo, TAny* a1, TAny* a2); +public: + static void IDfcFn(TAny* aPtr); +public: + void OccupyCpus(); + }; + +DECLARE_STANDARD_LDD() + { + Kern::Printf("DSmpSoak called"); + return new DSmpSoakFactory; + } + +DSmpSoakFactory::DSmpSoakFactory() +// +// Constructor +// + { + Kern::Printf("DSmpSoakFactory::DSmpSoakFactory called"); + iVersion=TVersion(KMajorVersionNumber,KMinorVersionNumber,KBuildVersionNumber); + } + +TInt DSmpSoakFactory::Create(DLogicalChannelBase*& aChannel) +// +// Create a new DSmpSoak on this logical device +// + { + Kern::Printf("DSmpSoakFactory::Create called"); + aChannel=new DSmpSoak; + return aChannel?KErrNone:KErrNoMemory; + } + +TInt DSmpSoakFactory::Install() +// +// Install the LDD - overriding pure virtual +// + { + Kern::Printf("DSmpSoakFactory::Install called"); + return SetName(&KSmpSoakLddName); + } + +void DSmpSoakFactory::GetCaps(TDes8& aDes) const +// +// Get capabilities - overriding pure virtual +// + { + Kern::Printf("DSmpSoakFactory::GetCaps called"); + } + +DSmpSoak::DSmpSoak() +// +// Constructor +// + { + Kern::Printf("DSmpSoak::DSmpSoak called"); + } + +DSmpSoak::~DSmpSoak() + { + Kern::Printf("DSmpSoak::~DSmpSoak called"); + } + +TInt DSmpSoak::DoCreate(TInt /*aUnit*/, const TDesC8* /*anInfo*/, const TVersion& aVer) +// +// Create channel +// + { + Kern::Printf("DSmpSoak::DoCreate called"); + + if (!Kern::QueryVersionSupported(TVersion(KMajorVersionNumber,KMinorVersionNumber,KBuildVersionNumber),aVer)) + return KErrNotSupported; + + return KErrNone; + } + + +TInt DSmpSoak::Request(TInt aFunction, TAny* a1, TAny* a2) + { + DThread *pT = NULL; + NThread *pMyNThread = NULL; + TInt handle = (TInt)a1; + TInt priority = (TInt)a2; + + TInt r = KErrNotSupported; + Kern::Printf("DSmpSoak::Request called aFunction = %d, a1 = %d, a2 = %d", aFunction, a1, a2); + + switch (aFunction) + { + case RSMPSoak::KGETPROCESSORCOUNT: + r = NKern::NumberOfCpus(); + Kern::Printf("DSmpSoak::Request Processor count = %d", r); + break; + case RSMPSoak::KGETCURRENTCPU: + r = NKern::CurrentCpu(); + Kern::Printf("DSmpSoak::Request Current CPU = %d", r); + break; + case RSMPSoak::KGETCURRENTTHREAD: + r = (TInt)NKern::CurrentThread(); + Kern::Printf("DSmpSoak::Request Current Thread %02x", r); + break; + case RSMPSoak::KTHREADSETCPUAFFINITY: + r = NKern::ThreadSetCpuAffinity(NKern::CurrentThread(), (TInt)a1); + r = (TInt)NKern::CurrentCpu(); + Kern::Printf("DSmpSoak::Request Current Cpu = %d", r); + break; + case RSMPSoak::KOCCUPYCPUS: + Kern::Printf("DSmpSoak::Request OCCUPYCPUS: called"); + OccupyCpus(); + break; + case RSMPSoak::KCHANGEAFFINITY: + Kern::Printf("DSmpSoak::Request CHANGEAFFINITY"); + NKern::LockSystem(); + pT=(DThread*)Kern::CurrentThread().ObjectFromHandle(handle); + pMyNThread=(NThread*)&pT->iNThread; + NKern::ThreadSetCpuAffinity((NThread*)pMyNThread, (TInt)a2); + NKern::UnlockSystem(); + break; + case RSMPSoak::KCHANGETHREADPRIORITY: + Kern::Printf("DSmpSoak::Request CHANGETHREADPRIORITY"); + NKern::LockSystem(); + pT=(DThread*)Kern::CurrentThread().ObjectFromHandle(handle); + Kern::Printf("DSmpSoak::Request Current Thread %d", pT); + pT->SetThreadPriority(priority); + Kern::Printf("DSmpSoak::CHANGETHREADPRIORITY now %d", pT->iThreadPriority); + NKern::UnlockSystem(); + break; + default: + Kern::Printf("DSmpSoak::Request default: called"); + break; + } + return r; + } + +void DSmpSoak::OccupyCpus() + { + Kern::Printf(">>>DSmpSoak::OccupyCpus()"); + } + + + diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/smpsoak/d_smpsoak.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/kerneltest/e32test/smpsoak/d_smpsoak.h Thu Jan 07 13:38:45 2010 +0200 @@ -0,0 +1,55 @@ +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// e32test\smpsoak\d_smpsoak.h +// + +#if !defined(__D_SMPSOAK_H__) +#define __D_RNDTIM_H__ +#include +#ifndef __KERNEL_MODE__ +#include +#endif + +_LIT(KSmpSoakLddName,"SmpSoak"); + + +class RSMPSoak : public RBusLogicalChannel + { +public: + + enum TCommands + { + KGETPROCESSORCOUNT, + KGETCURRENTCPU, + KGETCURRENTTHREAD, + KTHREADSETCPUAFFINITY, + KOCCUPYCPUS, + KCHANGEAFFINITY, + KCHANGETHREADPRIORITY + }; + +#ifndef __KERNEL_MODE__ + inline TInt Open() + { return DoCreate(KSmpSoakLddName(),TVersion(0,1,1),KNullUnit,NULL,NULL); } + inline TInt TryControl(TInt aCommand, TInt aTestNum) + { return DoControl((TInt)aCommand,(TAny*)aTestNum); } + inline TInt ChangeThreadAffinity(RThread* aThread, TInt cpu) + { return DoControl((TInt)KCHANGEAFFINITY,(TAny*)aThread->Handle(), (TAny*) cpu); } + inline TInt GetThreadCPU(RThread* aThread) + { return DoControl((TInt)KGETCURRENTCPU,(TAny*)aThread->Handle(), (TAny*) NULL); } +#endif + }; + +#endif + + diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/smpsoak/t_smpsoak.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/kerneltest/e32test/smpsoak/t_smpsoak.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -0,0 +1,903 @@ +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// e32test\smpsoak\t_smpsoak.cpp + +// User Includes +#include "t_smpsoak.h" + +void ParseCommandLine (); + +// Global Variables +static TInt gPageSize; +//Timeout 2 Minutes +static TUint gTimeout = 120; + +//class for smpsoak thread and it creates memory, device, timer and spin threads. +class CSMPSoakThread + { +public: + CSMPSoakThread(); + ~CSMPSoakThread(); + void CreateThread(); + void ResumeThread(); + void CreateChildProcess(TInt aIndex); + void ResumeChildProcess(); + void TerminateChildProcess(); +private: + //Thread Functions + static TInt SMPStressMemoryThread(TAny*); + static TInt SMPStressDeviceThread(TAny*); + static TInt SMPStressTimerThread(TAny*); + static TInt SMPStressSpinThread(TAny*); + //Thread Priority + void DoCreateThread(TAny*); + void SetThreadPriority(); +private: + //Utils for memory thread + void CreateChunk(TChunkInfo * aChunkInfo, TMemory * aMemoryTablePtr); + void CommitChunk(TChunkInfo * aChunkInfo, TMemory * aMemoryTablePtr); + void WriteReadChunk(TChunkInfo * aChunkInfo, TMemory * aMemoryTablePtr); +private: + //Memebers for threads + TInt DoSMPStressMemoryThread(); + TInt DoSMPStressDeviceThread(); + TInt DoSMPStressTimerThread(); + TInt DoSMPStressSpinThread(); +private: + TThreadData iThreadData; + RProcess iProcess; + RThread iThread; + TInt iPriority; +private: +// Thread Data for each thread- low priority +static TThread KThreadTableLow[]; +// Thread Data for each thread- high priority +static TThread KThreadTableHigh[]; +//Process Data for each process +static const TProcess KProcessTable[]; +//Memory table for memory thread +static const TMemory KMemoryTable[]; +//Device table for device thread +static const TDesC* KDeviceTable[]; + + }; +TThread CSMPSoakThread::KThreadTableLow[] = + { + { _L("Memory Thread"), CSMPSoakThread::SMPStressMemoryThread, {{EPriorityAbsoluteLow, EPriorityAbsoluteVeryLow, EPriorityNormal, 0}, EPriorityList, KCpuAffinityAny, 250, 1, (TAny *)&KMemoryTable, NULL, NULL}}, + { _L("Device Thread"), CSMPSoakThread::SMPStressDeviceThread, {{EPriorityAbsoluteLow, EPriorityAbsoluteVeryLow, EPriorityNormal, 0}, EPriorityList, KCpuAffinityAny, 300, 1, &KDeviceTable, NULL, NULL}}, + { _L("Spin Thread 0"), CSMPSoakThread::SMPStressSpinThread, {{EPriorityAbsoluteVeryLow, EPriorityNormal, EPriorityNormal, EPriorityNormal}, EPriorityList, KCpuAffinityAny, 200, 0, NULL, NULL, NULL}}, + { _L("Spin Thread 1"), CSMPSoakThread::SMPStressSpinThread, {{EPriorityNormal, EPriorityAbsoluteVeryLow, EPriorityNormal, EPriorityNormal}, EPriorityList, KCpuAffinityAny, 300, 0, NULL, NULL, NULL}}, + { _L("Spin Thread 2"), CSMPSoakThread::SMPStressSpinThread, {{EPriorityNormal, EPriorityNormal, EPriorityAbsoluteVeryLow, EPriorityNormal}, EPriorityList, KCpuAffinityAny, 400, 0, NULL, NULL, NULL}}, + { _L("Spin Thread 3"), CSMPSoakThread::SMPStressSpinThread, {{EPriorityNormal, EPriorityNormal, EPriorityAbsoluteLow, EPriorityAbsoluteVeryLow}, EPriorityList, KCpuAffinityAny, 500, 0, NULL, NULL, NULL}}, + { _L("Timer Thread"), CSMPSoakThread::SMPStressTimerThread, {{EPriorityNormal, 0, 0, 0}, EPriorityList, KCpuAffinityAny, 1000, 4, NULL}}, + }; +TThread CSMPSoakThread::KThreadTableHigh[] = + { + { _L("Memory Thread"), CSMPSoakThread::SMPStressMemoryThread, {{EPriorityAbsoluteLow, EPriorityAbsoluteVeryLow, EPriorityNormal, 0}, EPriorityList, KCpuAffinityAny, 250, 1, (TAny *)&KMemoryTable, NULL, NULL}}, + { _L("Device Thread"), CSMPSoakThread::SMPStressDeviceThread, {{EPriorityAbsoluteLow, EPriorityAbsoluteVeryLow, EPriorityNormal, 0}, EPriorityList, KCpuAffinityAny, 300, 1, &KDeviceTable, NULL, NULL}}, + { _L("Spin Thread 0"), CSMPSoakThread::SMPStressSpinThread, {{EPriorityAbsoluteVeryLow, EPriorityNormal, EPriorityNormal, EPriorityNormal}, EPriorityList, KCpuAffinityAny, 200, 0, NULL, NULL, NULL}}, + { _L("Spin Thread 1"), CSMPSoakThread::SMPStressSpinThread, {{EPriorityNormal, EPriorityAbsoluteVeryLow, EPriorityNormal, EPriorityNormal}, EPriorityList, KCpuAffinityAny, 300, 0, NULL, NULL, NULL}}, + { _L("Spin Thread 2"), CSMPSoakThread::SMPStressSpinThread, {{EPriorityNormal, EPriorityNormal, EPriorityAbsoluteVeryLow, EPriorityNormal}, EPriorityList, KCpuAffinityAny, 400, 0, NULL, NULL, NULL}}, + { _L("Spin Thread 3"), CSMPSoakThread::SMPStressSpinThread, {{EPriorityNormal, EPriorityNormal, EPriorityAbsoluteLow, EPriorityAbsoluteVeryLow}, EPriorityList, KCpuAffinityAny, 500, 0, NULL, NULL, NULL}}, + { _L("Timer Thread"), CSMPSoakThread::SMPStressTimerThread, {{EPriorityNormal, 0, 0, 0}, EPriorityList, KCpuAffinityAny, 1000, 4, NULL}}, + }; +const TProcess CSMPSoakThread::KProcessTable[] = + { + { _L("t_smpsoakprocess.exe"), _L("-W"), KCpuAffinityAny}, + { _L("t_smpsoakprocess.exe"), _L("-R"), KCpuAffinityAny}, + { _L("t_smpsoakprocess.exe"), _L("-F"), KCpuAffinityAny}, + { _L("t_smpsoakprocess.exe"), _L("-T"), KCpuAffinityAny}, + { _L("t_smpsoakprocess.exe"), _L("-O"), KCpuAffinityAny}, + }; +const TMemory CSMPSoakThread::KMemoryTable[] = + { + {_L(""), EChunkNormalThread, 0, 10, 100 }, + {_L("Global Chunk 1"), EChunkNormalThread, 0, 20, 200 }, + {_L(""), EChunkDisconnectedThread, 3, 30, 300 }, + {_L("Global Chunk 2"), EChunkDisconnectedThread, 4, 40, 400 }, + {_L(""), EChunkDoubleEndedThread, 5, 50, 500 }, + {_L("Global Chunk 3"), EChunkDoubleEndedThread, 6, 60, 600 }, + {_L(""), EChunkNormalProcess, 0, 10, 100 }, + {_L("Global Chunk 4"), EChunkNormalProcess, 0, 20, 200 }, + {_L(""), EChunkDisconnectedProcess, 3, 30, 300 }, + {_L("Global Chunk 5"), EChunkDisconnectedProcess, 4, 40, 400 }, + {_L(""), EChunkDoubleEndedProcess, 5, 50, 500 }, + {_L("Global Chunk 6"), EChunkDoubleEndedProcess, 6, 60, 600 }, + {_L(""), EChunkNone, 0, 0, 0 }, + }; +const TDesC* CSMPSoakThread::KDeviceTable[] = + { + &KDevices, &KDevLdd1, &KDevLdd1Name, &KDevLdd2, &KDevLdd2Name, &KDevLdd3, &KDevLdd3Name, + &KDevLdd4, &KDevLdd4Name, &KDevLdd5, &KDevLdd5Name, NULL + }; + +//Constructor +CSMPSoakThread::CSMPSoakThread() + { + } +//Destructor +CSMPSoakThread::~CSMPSoakThread() + { + } +//All child process creation +void CSMPSoakThread::CreateChildProcess(TInt aIndex) + { + if(TestSilent) + gCmdLine.Format(KCmdLineBackground,(KProcessTable[aIndex].operation).Ptr()); + else if (Period) + gCmdLine.Format(KCmdLinePeriod,gPeriod,(KProcessTable[aIndex].operation).Ptr()); + else + gCmdLine.Format(KCmdLineProcess,(KProcessTable[aIndex].operation).Ptr()); + + TInt r = iProcess.Create(KProcessTable[aIndex].processFileName,gCmdLine); + test_KErrNone(r); + iProcess.SetPriority(EPriorityLow); + gSMPStressDrv.ChangeThreadAffinity(&iThread, KProcessTable[aIndex].cpuAffinity); + PRINT ((_L("SetProcessPriority CPU %d Priority %d\n"),gSMPStressDrv.GetThreadCPU(&iThread), iProcess.Priority())); + } +//Terminate process when user press "Esc key" +void CSMPSoakThread::ResumeChildProcess() + { + iProcess.Resume(); + } +//Terminate process when user press "Esc key" +void CSMPSoakThread::TerminateChildProcess() + { + iProcess.Kill(KErrNone); + } +//Changes the thread priority each time time, for each thread by Random, Increment, from List, Fixed. +//pick up the priority option from thread table +void CSMPSoakThread::SetThreadPriority() + { + static TInt64 randSeed = KRandSeed; + static const TThreadPriority priorityTable[]= + { + EPriorityMuchLess, EPriorityLess, EPriorityNormal, EPriorityMore, EPriorityMuchMore, + EPriorityRealTime, EPriorityRealTime, EPriorityAbsoluteVeryLow, EPriorityAbsoluteLowNormal, + EPriorityAbsoluteLow, EPriorityAbsoluteBackgroundNormal, EPriorityAbsoluteBackground, + EPriorityAbsoluteForegroundNormal, EPriorityAbsoluteForeground, EPriorityAbsoluteHighNormal, EPriorityAbsoluteHigh + }; + TInt priorityIndex = 0; + switch (iThreadData.threadPriorityChange) + { + case EpriorityFixed: + break; + + case EPriorityList: + if (++iPriority >= KPriorityOrder) + iPriority = 0; + if (iThreadData.threadPriorities[iPriority] == 0) + iPriority = 0; + // PRINT(_L("SetPriority List CPU %d index %d priority %d\n"),gSMPStressDrv.GetThreadCPU(&iThread),iPriority, iThreadData.threadPriorities[iPriority]); + iThread.SetPriority((TThreadPriority)iThreadData.threadPriorities[iPriority]); + break; + + case EPriorityIncrement: + while (priorityTable[priorityIndex] <= iPriority) + { + priorityIndex++; + } + iPriority = priorityTable[priorityIndex]; + if (iPriority > iThreadData.threadPriorities[2]) + iPriority = iThreadData.threadPriorities[1]; + // PRINT(_L("SetPriority Increment CPU %d iPriority %d\n"),gSMPStressDrv.GetThreadCPU(&iThread), iPriority); + iThread.SetPriority((TThreadPriority)iPriority); + break; + + case EPriorityRandom: + iPriority = Math::Rand(randSeed) % (iThreadData.threadPriorities[2] - iThreadData.threadPriorities[1] + 1); + iPriority += iThreadData.threadPriorities[1]; + while (priorityTable[priorityIndex] < iPriority) + { + priorityIndex++; + } + iPriority = priorityTable[priorityIndex]; + // PRINT(_L("SetPriority Random CPU %d priority %d\n"),gSMPStressDrv.GetThreadCPU(&iThread), iPriority); + iThread.SetPriority((TThreadPriority)iPriority); + break; + } + } +//Resume each thread +void CSMPSoakThread::ResumeThread() + { + iThread.Resume(); + } +//thread creation +void CSMPSoakThread::CreateThread() + { + CSMPSoakThread* smpthread = new CSMPSoakThread[KNumThreads]; + for (TInt i = 0; i < KNumThreads ; i++) + { + if(ThreadPriorityLow) + { + PRINT ((_L("Thread Table - Priority Low \n"))); + smpthread[i].DoCreateThread(&KThreadTableLow[i]); + } + else + { + PRINT ((_L("Thread Table - Priority High \n"))); + smpthread[i].DoCreateThread(&KThreadTableHigh[i]); + } + } + PRINT (_L("Resuming all threads\n")); + for (TInt i = 0; i < KNumThreads; i++) + smpthread[i].ResumeThread(); + } +/** + * CSMPSoakThread Thread Creation. + * @param aIndex to exercise each row(thread) in the thread table + * + * @return N/A + * + * @pre Initialize thread Table values + * @post None + */ +void CSMPSoakThread::DoCreateThread(TAny* aThread) + { + //Initialize each thread data + iThreadData = ((TThread*)aThread)->threadData; + test.Next(_L("Create Thread")); + PRINT ((_L("%s CPU affinity %d Priority %d\n"),((TThread*)aThread)->threadName.Ptr(),iThreadData.cpuAffinity,iThreadData.threadPriorities[0])); + TInt r = iThread.Create(((TThread*)aThread)->threadName, ((TThread*)aThread)->threadFunction, KDefaultStackSize, KHeapMinSize, KHeapMaxSize,(TAny*)this); + test_KErrNone(r); + if (iThreadData.threadPriorityChange == EPriorityList) + { + iPriority = 0; + } + else + { + iPriority = iThreadData.threadPriorities[0]; + } + iThread.SetPriority((TThreadPriority)iThreadData.threadPriorities[0]); + //Set the thread CPU Affinity + gSMPStressDrv.ChangeThreadAffinity(&iThread, iThreadData.cpuAffinity); + } +//Create Chunk - different types +void CSMPSoakThread::CreateChunk (TChunkInfo * aChunkInfo, TMemory * aMemoryTablePtr) + { + //RDebug::Print(_L("Creating chunk name %s type %d bottom %d top %d max %d\n"),aMemoryTablePtr->globalChunkName.Ptr(),aMemoryTablePtr->chunkType,aMemoryTablePtr->initialBottom,aMemoryTablePtr->initialTop,aMemoryTablePtr->maxSize); + TOwnerType ownerType = EOwnerProcess; + aChunkInfo->lastBottom = aMemoryTablePtr->initialBottom; + aChunkInfo->lastTop = aMemoryTablePtr->initialTop; + switch (aMemoryTablePtr->chunkType) + { + case EChunkNormalThread: + ownerType = EOwnerThread; // drop through to create chunk + case EChunkNormalProcess: + if (aMemoryTablePtr->globalChunkName.Length()) + { + test_KErrNone(aChunkInfo->chunk.CreateGlobal(aMemoryTablePtr->globalChunkName,aMemoryTablePtr->initialTop*gPageSize,aMemoryTablePtr->maxSize*gPageSize,ownerType)); + } + else + { + test_KErrNone(aChunkInfo->chunk.CreateLocal(aMemoryTablePtr->initialTop*gPageSize,aMemoryTablePtr->maxSize*gPageSize,ownerType)); + } + aChunkInfo->lastBottom = 0; // ensure that this is zero + break; + + case EChunkDisconnectedThread: + ownerType = EOwnerThread; // drop through to create chunk + case EChunkDisconnectedProcess: + if (aMemoryTablePtr->globalChunkName.Length()) + { + test_KErrNone(aChunkInfo->chunk.CreateDisconnectedGlobal(aMemoryTablePtr->globalChunkName,aMemoryTablePtr->initialBottom*gPageSize,aMemoryTablePtr->initialTop*gPageSize,aMemoryTablePtr->maxSize*gPageSize,ownerType)); + } + else + { + test_KErrNone(aChunkInfo->chunk.CreateDisconnectedLocal(aMemoryTablePtr->initialBottom*gPageSize,aMemoryTablePtr->initialTop*gPageSize,aMemoryTablePtr->maxSize*gPageSize,ownerType)); + } + break; + + case EChunkDoubleEndedThread: + ownerType = EOwnerThread; // drop through to create chunk + case EChunkDoubleEndedProcess: + if (aMemoryTablePtr->globalChunkName.Length()) + { + test_KErrNone(aChunkInfo->chunk.CreateDoubleEndedGlobal(aMemoryTablePtr->globalChunkName,aMemoryTablePtr->initialBottom*gPageSize,aMemoryTablePtr->initialTop*gPageSize,aMemoryTablePtr->maxSize*gPageSize,ownerType)); + } + else + { + test_KErrNone(aChunkInfo->chunk.CreateDoubleEndedLocal(aMemoryTablePtr->initialBottom*gPageSize,aMemoryTablePtr->initialTop*gPageSize,aMemoryTablePtr->maxSize*gPageSize,ownerType)); + } + break; + } + } +//Commit chunk +void CSMPSoakThread::CommitChunk (TChunkInfo * aChunkInfo, TMemory * aMemoryTablePtr) + { + TInt commitPages; + + switch (aMemoryTablePtr->chunkType) + { + case EChunkNormalThread: + case EChunkNormalProcess: + if (aChunkInfo->lastTop < (aMemoryTablePtr->maxSize - 1)) + { + aChunkInfo->lastTop += (aMemoryTablePtr->maxSize - 1 - aChunkInfo->lastTop) / 2 + 1; + //PRINT(_L("Adjust chunk memory - top %d pagesize %d\n"),aChunkInfo->lastTop,gPageSize); + test_KErrNone(aChunkInfo->chunk.Adjust(aChunkInfo->lastTop*gPageSize)); + } + break; + + case EChunkDisconnectedThread: + case EChunkDisconnectedProcess: + commitPages = ((aChunkInfo->lastTop - aChunkInfo->lastBottom) / 2) + 1; + //PRINT(_L("Decommitting from bottom %d of %d pages\n"),aChunkInfo->lastBottom,commitPages); + test_KErrNone(aChunkInfo->chunk.Decommit(aChunkInfo->lastBottom*gPageSize,commitPages * gPageSize)); + if ((aChunkInfo->lastBottom > 0) && (aChunkInfo->lastTop <= aMemoryTablePtr->initialTop)) + { + aChunkInfo->lastTop = aChunkInfo->lastBottom + commitPages - 1; + aChunkInfo->lastBottom /= 2; + commitPages = aChunkInfo->lastTop - aChunkInfo->lastBottom + 1; + } + else + { + if (aChunkInfo->lastTop < (aMemoryTablePtr->maxSize -1)) + { + if (aChunkInfo->lastTop <= aMemoryTablePtr->initialTop) + { + aChunkInfo->lastBottom = aMemoryTablePtr->initialTop + 1; + } + else + { + aChunkInfo->lastBottom = aChunkInfo->lastTop + 1; + } + commitPages = ((aMemoryTablePtr->maxSize - aChunkInfo->lastBottom) / 2) + 1; + aChunkInfo->lastTop = aChunkInfo->lastBottom + commitPages - 1; + } + else + { + commitPages = 0; + } + } + if (commitPages) + { + //PRINT(_L("Commit chunk memory bottom %d size %d pages\n"),aChunkInfo->lastBottom,commitPages); + test_KErrNone(aChunkInfo->chunk.Commit(aChunkInfo->lastBottom*gPageSize,commitPages*gPageSize)); + } + break; + + case EChunkDoubleEndedThread: + case EChunkDoubleEndedProcess: + if (aChunkInfo->lastBottom > 0 || aChunkInfo->lastTop < (aMemoryTablePtr->maxSize - 1)) + { + if (aChunkInfo->lastBottom > 0) + { + aChunkInfo->lastBottom--; + } + if (aChunkInfo->lastTop < (aMemoryTablePtr->maxSize - 1)) + { + aChunkInfo->lastTop++; + } + // PRINT(_L("Adjust Double Ended bottom %d top %d\n"),aChunkInfo->lastBottom,aChunkInfo->lastTop); + test_KErrNone(aChunkInfo->chunk.AdjustDoubleEnded(aChunkInfo->lastBottom*gPageSize,aChunkInfo->lastTop*gPageSize)); + } + break; + } + } +//Write then read chunk +void CSMPSoakThread::WriteReadChunk (TChunkInfo * aChunkInfo, TMemory * aMemoryTablePtr) + { + if (aChunkInfo->lastTop < (aMemoryTablePtr->maxSize - 1)) + { + TInt chunkSize = aChunkInfo->lastTop*gPageSize - aChunkInfo->lastBottom*gPageSize; + //RDebug::Print(_L("WriteReadChunk Last Top %d lastBottom %d\n"),aChunkInfo->lastTop,aChunkInfo->lastBottom); + TUint8 *writeaddr = aChunkInfo->chunk.Base()+ aChunkInfo->lastBottom*gPageSize; + TPtr8 write(writeaddr,chunkSize); + write.Copy(pattern,sizeof(pattern)); + test_KErrNone(Mem::Compare(writeaddr,sizeof(pattern),pattern,sizeof(pattern))); + } + } +//Memory Thread : will do memory associated operation +//param aSmp - CSMPSoakUtil pointer +TInt CSMPSoakThread::SMPStressMemoryThread(TAny* aSmp) + { + CSMPSoakThread* self = (CSMPSoakThread*)aSmp; + __ASSERT_ALWAYS(self !=NULL, User::Panic(_L("CSMPSoakThread::SMPStressMemoryThread Panic"),0)); + return self->DoSMPStressMemoryThread(); + } +// Member for thread function +TInt CSMPSoakThread::DoSMPStressMemoryThread() + { + RTest test(_L("SMPStressMemoryThread")); + + TMemory *memoryTablePtr; + TChunkInfo chunkTable[KNumChunks]; + TInt ctIndex = 0; + test_KErrNone(UserHal::PageSizeInBytes(gPageSize)); + + FOREVER + { + SetThreadPriority(); + + if (gAbort) + break; + + memoryTablePtr = (TMemory *) (iThreadData.listPtr); + ctIndex = 0; + + //Create different type of chunks and write/read/verfiy it + while (memoryTablePtr->chunkType != EChunkNone) + { + PRINT((_L("Create Chunk"))); + CreateChunk (&chunkTable[ctIndex],memoryTablePtr); + + PRINT(_L("Write and Read Chunk")); + WriteReadChunk (&chunkTable[ctIndex],memoryTablePtr); + + ctIndex++; + memoryTablePtr++; + } + + //Commit different type of chunks + TBool anyCommit; + do + { + anyCommit = EFalse; + memoryTablePtr = (TMemory *) (iThreadData.listPtr); + ctIndex = 0; + while (memoryTablePtr->chunkType != EChunkNone) + { + //Commit Chunks + PRINT((_L("Commit Chunk Memory"))); + PRINT ((_L("CommitChunk %d bottom %d top %d\n"),ctIndex,memoryTablePtr->initialBottom,memoryTablePtr->initialTop)); + CommitChunk (&chunkTable[ctIndex],memoryTablePtr); + anyCommit = ETrue; + + //Write into Chunks + WriteReadChunk (&chunkTable[ctIndex],memoryTablePtr); + PRINT((_L("Write Read Chunk Size %d\n"), (memoryTablePtr->initialTop) - (memoryTablePtr->initialBottom))); + ctIndex++; + memoryTablePtr++; + } + } + while (anyCommit); + + //Close the Chunks + memoryTablePtr = (TMemory *) (iThreadData.listPtr); + ctIndex = 0; + while (memoryTablePtr->chunkType != EChunkNone) + { + chunkTable[ctIndex].chunk.Close(); + + ctIndex++; + memoryTablePtr++; + } + User::After(gPeriod); + } + return 0x00; + } +//Device Thread : will do device associated operation +//param aSmp - CSMPSoakUtil pointer +TInt CSMPSoakThread::SMPStressDeviceThread(TAny* aSmp) + { + CSMPSoakThread* self = (CSMPSoakThread*)aSmp; + __ASSERT_ALWAYS(self !=NULL, User::Panic(_L("CSMPSoakThread::SMPStressDeviceThread Panic"),0)); + return self->DoSMPStressDeviceThread(); + } +// Member for thread function +TInt CSMPSoakThread::DoSMPStressDeviceThread() + { + RTest test(_L("SMPStressDeviceThread")); + + RTimer timer; + RFs session; + TFileName sessionPath; + + test_KErrNone(timer.CreateLocal()); + TRequestStatus s; + + TDesC** ptrDevices = (TDesC**) (iThreadData.listPtr); + PRINT ((_L("Devices Number %d [%s]\n"), ptrDevices[0]->Length(), ptrDevices[0]->Ptr())); + for (TInt i = 1; ptrDevices[i] ; i++) + PRINT ((_L("LDD%d=%s "),i,ptrDevices[i]->Ptr())); + PRINT (_L("\n")); + + FOREVER + { + for (TInt i = 0; i < ptrDevices[0]->Length(); i++) + { + TText driveLetter = (*ptrDevices[0])[i]; + PRINT ((_L("Device %c\n"),driveLetter)); + + test_KErrNone(session.Connect()); + + sessionPath=(_L("?:\\SESSION_TEST\\")); + sessionPath[0]=driveLetter; + test_KErrNone(session.SetSessionPath(sessionPath)); + + TInt driveNumber; + test_KErrNone(session.CharToDrive(driveLetter, driveNumber)); + + TBuf<64> fileSystemName; + test_KErrNone(session.FileSystemName(fileSystemName,driveNumber)); + + PRINT ((_L("File System Name %s\n"),fileSystemName.PtrZ())); + + TDriveInfo driveInfo; + test_KErrNone(session.Drive(driveInfo, driveNumber)); + + TVolumeInfo volumeInfo; + test_KErrNone(session.Volume(volumeInfo, driveNumber)); + + session.Close(); + } + for (TInt i = 1; ptrDevices[i] ; i += 2) + { + RDevice device; + + TInt r = User::LoadLogicalDevice(*ptrDevices[i]); + test(r == KErrNone || r == KErrAlreadyExists); + + test_KErrNone(device.Open(*ptrDevices[i+1])); + + TBuf8<64> deviceCaps; + device.GetCaps(deviceCaps); + + TVersion deviceVersion; + device.QueryVersionSupported(deviceVersion); + + device.Close(); + } + SetThreadPriority(); + timer.After(s, iThreadData.delayTime*1000); + User::WaitForRequest(s); + test (s == KErrNone); + + if (gAbort) + break; + User::After(gPeriod); + } + timer.Close(); + PRINT((_L("SMPStressDeviceThread MyTimer.Cancel() called\n"))); + return 0x00; + } +//Spin Thread : will do thread sync +//param aSmp - CSMPSoakUtil pointer +TInt CSMPSoakThread::SMPStressSpinThread(TAny* aSmp) + { + CSMPSoakThread* self = (CSMPSoakThread*)aSmp; + __ASSERT_ALWAYS(self !=NULL, User::Panic(_L("CSMPSoakThread::SMPStressSpinThread Panic"),0)); + return self->DoSMPStressSpinThread(); + } +// Member for thread function +TInt CSMPSoakThread::DoSMPStressSpinThread() + { + RTest test(_L("SMPStressSpinThread")); + + TTime startTime; + TTime endTime; + TTimeIntervalMicroSeconds loopTimeMicroSeconds; + PRINT (_L("SMPStressSpinThread\n")); + FOREVER + { + SetThreadPriority(); + gSwitchSem.Wait(); + startTime.UniversalTime(); + do + { + endTime.UniversalTime(); + loopTimeMicroSeconds = endTime.MicroSecondsFrom(startTime); + }while (loopTimeMicroSeconds <= iThreadData.delayTime*1000); + + if (gAbort) + break; + User::After(gPeriod); + } + return 0x00; + } +//Timer Thread : Timer operation and thread sync +//param aSmp - CSMPSoakUtil pointer +TInt CSMPSoakThread::SMPStressTimerThread(TAny* aSmp) + { + CSMPSoakThread* self = (CSMPSoakThread*)aSmp; + __ASSERT_ALWAYS(self !=NULL, User::Panic(_L("CSMPSoakThread::SMPStressTimerThread Panic"),0)); + return self->DoSMPStressTimerThread(); + } +// Member for thread function +TInt CSMPSoakThread::DoSMPStressTimerThread() + { + RTest test(_L("SMPStressTimerThread")); + + PRINT (_L("SMPStressTimerThread\n")); + RTimer timer; + test_KErrNone(timer.CreateLocal()); + TRequestStatus s; + + FOREVER + { + timer.After(s, iThreadData.delayTime*1000); + User::WaitForRequest(s); + test (s == KErrNone); + PRINT ((_L("*"))); + gSwitchSem.Signal(iThreadData.numThreads); + + if (gAbort) + break; + User::After(gPeriod); + } + timer.Cancel(); + PRINT((_L("SMPStressTimerThread MyTimer.Cancel() called\n"))); + return 0x00; + } +// CActive class to monitor KeyStrokes from User +class CActiveConsole : public CActive + { +public: + CActiveConsole(); + ~CActiveConsole(); + void GetCharacter(); + static TInt Callback(TAny* aCtrl); + static CPeriodic* TimerL(); +private: + // Defined as pure virtual by CActive; + // implementation provided by this class. + virtual void DoCancel(); + // Defined as pure virtual by CActive; + // implementation provided by this class, + virtual void RunL(); + void ProcessKeyPressL(TChar aChar); +private: + + }; +// Class CActiveConsole +CActiveConsole::CActiveConsole() + : CActive(EPriorityHigh) + { + CActiveScheduler::Add(this); + } + +CActiveConsole::~CActiveConsole() + { + Cancel(); + } +CPeriodic* CActiveConsole::TimerL() + { + return(CPeriodic::NewL(EPriorityNormal)); + } +// Callback function for timer expiry +TInt CActiveConsole::Callback(TAny* aControl) + { + return KErrNone; + } + +void CActiveConsole::GetCharacter() + { + test.Console()->Read(iStatus); + SetActive(); + } + +void CActiveConsole::DoCancel() + { + PRINT(_L("CActiveConsole::DoCancel\n")); + test.Console()->ReadCancel(); + } + +void CActiveConsole::ProcessKeyPressL(TChar aChar) + { + if (aChar == EKeyEscape) + { + PRINT(_L("CActiveConsole: ESC key pressed -> stopping active scheduler...\n")); + gAbort = ETrue; + CActiveScheduler::Stop(); + return; + } + aChar.UpperCase(); + GetCharacter(); + } + +void CActiveConsole::RunL() + { + ProcessKeyPressL(static_cast(test.Console()->KeyCode())); + } + +// CActiveTimer class to monitor timeout expiry +class CActiveTimer : public CActive + { +public: + CActiveTimer(); + ~CActiveTimer(); + void Delay(TTimeIntervalMicroSeconds32 aDelay); +private: + RTimer iTimer; + // Defined as pure virtual by CActive; + // implementation provided by this class. + virtual void DoCancel(); + // Defined as pure virtual by CActive; + // implementation provided by this class, + virtual void RunL(); + + }; +// Class CActiveConsole +CActiveTimer::CActiveTimer() + : CActive(EPriorityHigh) + { + CActiveScheduler::Add(this); + User::LeaveIfError(iTimer.CreateLocal()); + } + +CActiveTimer::~CActiveTimer() + { + Cancel(); + iTimer.Close(); + } + + +void CActiveTimer::Delay(TTimeIntervalMicroSeconds32 aDelay) + { + iTimer.After(iStatus, aDelay); + SetActive(); + } + +void CActiveTimer::DoCancel() + { + iTimer.Cancel(); + } + +void CActiveTimer::RunL() + { + PRINT(_L("CActiveTimer: Application runtime expired...")); + gAbort = ETrue; + CActiveScheduler::Stop(); + return; + } + +//T_SMPSOAK Entry Point +TInt E32Main() + { + test.Title(); + __UHEAP_MARK; + test.Start(_L("t_smpsoak.exe")); + + // When running as a stand alone test, + // there needs to be a timeout + timeout = ETrue; + + ParseCommandLine(); + if (gAbort) + return 0x00; + + PRINT (_L("Load device driver\n")); + TInt r = User::LoadLogicalDevice(_L("d_smpsoak.ldd")); + if (r == KErrNotFound) + { + PRINT (_L("Test not supported on this platform because the D_SMPSOAK.LDD Driver is Not Present\n")); + test(EFalse); + } + PRINT (_L("Calling SMPStressDrv Open\n")); + r = gSMPStressDrv.Open(); + test_KErrNone(r); + + PRINT (_L("Creating our local semaphore\n")); + r=gSwitchSem.CreateLocal(0); + test_KErrNone(r); + + CSMPSoakThread smpthread; + PRINT ((_L("Creating all threads =%d\n"),KNumThreads)); + smpthread.CreateThread(); + + CSMPSoakThread *smpprocess= new CSMPSoakThread[NumProcess]; + PRINT ((_L("Creating all process =%d\n"),NumProcess)); + for (TInt i = 0; i < NumProcess; i++) + smpprocess[i].CreateChildProcess(i); + + PRINT (_L("Resuming all process \n")); + for (TInt i = 0; i < NumProcess; i++) + smpprocess[i].ResumeChildProcess(); + + PRINT (_L("Starting ActiveScheduler\n")); + test.Next(_L("Press ESC Key to Shutdown SMPSoak...\n")); + CActiveScheduler* myScheduler = new (ELeave) CActiveScheduler(); + test(myScheduler != NULL); + CActiveScheduler::Install(myScheduler); + + CPeriodic* theTimer=NULL; + TRAPD(ret,theTimer=CActiveConsole::TimerL()) + test_KErrNone(ret); + theTimer->Start(0,KTimerPeriod,TCallBack(CActiveConsole::Callback)); + if(timeout) + { + CActiveTimer* myActiveTimer = new CActiveTimer(); + test(myActiveTimer != NULL); + myActiveTimer->Delay(gTimeout*1000000); + } + CActiveConsole* myActiveConsole = new CActiveConsole(); + test(myActiveConsole != NULL); + myActiveConsole->GetCharacter(); + CActiveScheduler::Start(); + if (gAbort) + { + PRINT (_L("gAbort TRUE \n")); + for (TInt i = 0; i < NumProcess; i++) + smpprocess[i].TerminateChildProcess(); + delete[] smpprocess; + delete theTimer; + gSMPStressDrv.Close(); + gSwitchSem.Close(); + return 0; + } + __UHEAP_MARKEND; + test.End(); + return 0; + } +void ParseCommandLine() + { + TBuf<256> args; + User::CommandLine(args); + TLex lex(args); + PRINT ((_L("****Command line = %s\n"), args.PtrZ())); + + FOREVER + { + TPtrC token=lex.NextToken(); + if(token.Length()!=0) + { + if (token.Length()==0) + break; // ignore trailing whitespace + else if (token.Mid(0) == _L("-h")) + { + PRINT (_L("T_SMPSOAK.EXE Usage Options:\n")); + PRINT (_L("Type t_smpsoak.exe -h\n")); + ShowHelp(); + gAbort = ETrue; + break; + } + else if (token.Mid(0) == _L("-l")) + { + //Read OOM entry from KProcessTable and run + test.Printf(_L("SMPSOAK:lowmem\n")); + NumProcess = KNumProcess+1; + break; + } + else if (token.Mid(0) == _L("-b")) + { + test.Printf(_L("SMPSOAK: Test Silent Mode\n")); + ThreadPriorityLow = ETrue; + TestSilent = ETrue; + // If we have tests running in the background + // we want an endless loop + timeout = EFalse; + break; + } + else if (token.Left(2) == _L("-t")) + { + test.Printf(_L("SMPSOAK:Timeout\n")); + lex.SkipSpaceAndMark(); + token.Set(lex.NextToken()); + TLex lexNum(token); + lexNum.Val(gTimeout,EDecimal); + test.Printf(_L("Timeout in Seconds=%u \n"),gTimeout); + timeout = ETrue; + break; + } + else if (token.Left(2) == _L("-p")) + { + test.Printf(_L("SMPSOAK:period\n")); + lex.SkipSpaceAndMark(); + token.Set(lex.NextToken()); + TLex lexNum(token); + lexNum.Val(gPeriod,EDecimal); + test.Printf(_L("period in mSeconds=%d \n"),gPeriod); + Period = ETrue; + break; + } + else + { + test.Printf(_L("Error- Invalid SMPSOAK CMD Line Argument")); + break; + } + } + break; + } + } diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/smpsoak/t_smpsoak.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/kerneltest/e32test/smpsoak/t_smpsoak.h Thu Jan 07 13:38:45 2010 +0200 @@ -0,0 +1,182 @@ +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// e32test\smpsoak\t_smpsoak.h + +#if (!defined __T_SMPSOAK_H__) +#define __T_SMPSOAK_H__ + +#define __E32TEST_EXTENSION__ +// EPOC includes +#include +#include +#include +#include + +// User Includes +#include "d_smpsoak.h" + +TBool TestSilent = EFalse; +TBool Period = EFalse; +TBool timeout = EFalse; +TBool ThreadPriorityLow = EFalse; +TBuf<25> gCmdLine; +_LIT(KCmdLineProcess, "%s"); +_LIT(KCmdLineBackground, "-b %s"); +_LIT(KCmdLinePeriod, "-p %d %s"); + +TUint gPeriod = 10000; + +#define PRINT(args)\ + if (!TestSilent)\ + test.Printf args + +//Global Literals +_LIT(KGlobalWriteSem, "GlobalWriteSem"); +_LIT(KGlobalReadSem, "GlobalReadSem"); +_LIT(KGlobalWRChunk, "GlobalWRChunk"); +_LIT(KSessionPath, "?:\\SMPSOAK-TST\\"); +_LIT(KDir, "Dir%d\\"); +_LIT(KFile, "\\SMPSOAK-TST\\Dir%d\\File%d.txt"); +_LIT(KFileData, "A$$$BCDEFGHIJKLMNOPQRSTUVWXY$$$Z"); +const TUint8* pattern = (TText8*)("A11$$222BCDEUVWXY££££$$$Z"); + + +//Global's used between the process +const TUint32 KCpuAffinityAny=0xffffffffu; + +static RSemaphore gWriteSem; +static RSemaphore gReadSem; +static RChunk gChunk; +static volatile TBool gAbort = EFalse; // Set true when escape key pressed +static RSMPSoak gSMPStressDrv; +static RSemaphore gSwitchSem; + +//Chunk Allocation IPC Read/Write operations +static const TInt KChunkMaxSize = 0x01000000; //16 MB +static const TInt KChunkSize = 0x400000; //4MB +TBuf8 memData; + +//Heap Allocations for OOM Threads +const TInt KHeapMaxiSize = 0x200000; //2MB +const TInt KHeapReserveSize = 0x100000; //1MB +RSemaphore ooMemSem; + +//For Thread Creation +const TInt KHeapMinSize= 0x1000; +const TInt KHeapMaxSize= 0x1000; +const TInt KTimerPeriod = 10000; +const TInt KRandSeed= 1234; +//Used by File thread's +const TInt KFileNameLength = 100; +const TInt KPriorityOrder = 4; +static RTest test(_L("T_SMPSoak")); +//Enum's for Memory Thread Operations +enum + { + EChunkNone, + EChunkNormalThread, + EChunkDisconnectedThread, + EChunkDoubleEndedThread, + EChunkNormalProcess, + EChunkDisconnectedProcess, + EChunkDoubleEndedProcess, + }; +//Process Priority +enum + { + EpriorityFixed, + EPriorityList, + EPriorityIncrement, + EPriorityRandom, + }; +//Memory table structure for Memory thread +struct TMemory + { + TPtrC globalChunkName; + TInt chunkType; + TInt initialBottom; + TInt initialTop; + TInt maxSize; + }; + +struct TChunkInfo + { + RChunk chunk; + TInt lastBottom; + TInt lastTop; + }; +enum + { + KNumThreads = 7, + KNumProcess = 4, + KNumFileThreads = 4, + KNumTimerThreads = 2, + KNumOOMThreads = 4, + KNumChunks = 13 + }; +TInt NumProcess = KNumProcess; +//Device information for device thread +_LIT(KDevices,"CDZ"); +_LIT(KDevLdd1,"ecomm.ldd"); +_LIT(KDevLdd1Name,"comm"); +_LIT(KDevLdd2,"elocd.ldd"); +_LIT(KDevLdd2Name,"LocDrv"); +_LIT(KDevLdd3,"enet.ldd"); +_LIT(KDevLdd3Name,"Ethernet"); +_LIT(KDevLdd4,"esoundsc.ldd"); +_LIT(KDevLdd4Name,"SoundSc"); +_LIT(KDevLdd5,"eusbc.ldd"); +_LIT(KDevLdd5Name, "Usbc"); + +//Thread data for each thread +struct TThreadData + { + TInt threadPriorities[4]; + TInt threadPriorityChange; + TUint32 cpuAffinity; + TInt delayTime; + TInt numThreads; + TAny *listPtr; + TInt dirID; + TInt numFile; + }; + +struct TThread + { + TPtrC threadName; + TThreadFunction threadFunction; + TThreadData threadData; + }; + +struct TProcess + { + TPtrC processFileName; + TPtrC operation; + TUint32 cpuAffinity; + }; + +inline void ShowHelp() + { + PRINT(_L("***************************************\n")); + PRINT(_L("The following are immediate commands\n")); + PRINT(_L("-l run includes Out of Memory thread tests \n")); + PRINT(_L("-b run in silent mode\n")); + PRINT(_L("-t nn test run with timeout in seconds\n")); + PRINT(_L("-p nnnn period for each thread to sleep in iteration\n")); + PRINT(_L("-h show this help\n")); + PRINT(_L("Esc to shutdown\n")); + PRINT(_L("***************************************\n")); + } +#endif /* __T_SMPSOAK_H__ */ + diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/smpsoak/t_smpsoakprocess.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/kerneltest/e32test/smpsoak/t_smpsoakprocess.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -0,0 +1,596 @@ +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +//e32test\smpsoak\t_smpsoakprocess.cpp + +// User Includes +#include "t_smpsoak.h" + +#define PRINT(args)\ + if (!TestSilent)\ + test.Printf args + +void ParseCmdLine(); + +//class for soak process and same executable(t_smpsoakprocess.exe) will be lauched with different process operation +//Example: IPC Read, IPC Write, File Process, Timer Process +class CSMPSoakProcess + { +public: + CSMPSoakProcess(); + ~CSMPSoakProcess(); + void CreateThread(TPtrC aThreadType); +private: + //Thread Functions + static TInt FileThread(TAny*); + static TInt TimerThread(TAny*); + static TInt MemoryThread(TAny*); +private: + // Thread member functions + TInt DoFileThread(); + TInt DoTimerThread(); + TInt DoMemoryThread(); + void DoCreateThread(TAny*); + void ResumeThread(); + //IPC's + void WriteProcess(); + void ReadProcess(); + //Thread Priority + void SetThreadPriority(); + //Utils for soak process + void SetSoakProcessPriority(); + void CommitChunk(RChunk& aChunk, TInt aSize); + void ReadChunk(RChunk& aChunk, TInt aSize); + void WriteToChunk(RChunk& aChunk, TInt aSize); + void DeleteChunk(RChunk& aChunk); +private: + //Thread tables + static TThread KOOMemoryTable[]; + static TThread KFileTable[]; + static TThread KTimerTable[]; +private: + TThreadData iThreadData; + RThread iThread; + TInt iPriority; + }; + +//Memory thread data +TThread CSMPSoakProcess::KOOMemoryTable[] = + { + { _L("SMPOOMemoryThread1"), CSMPSoakProcess::MemoryThread, {{EPriorityAbsoluteLowNormal, EPriorityAbsoluteVeryLow, EPriorityNormal, 0}, EPriorityList, KCpuAffinityAny, 0, 4, NULL, NULL,NULL}}, + { _L("SMPOOMemoryThread2"), CSMPSoakProcess::MemoryThread, {{EPriorityAbsoluteLow, EPriorityAbsoluteVeryLow, EPriorityNormal, 0}, EPriorityList, KCpuAffinityAny, 0, 4, NULL, NULL,NULL}}, + { _L("SMPOOMemoryThread3"), CSMPSoakProcess::MemoryThread, {{EPriorityMore, EPriorityAbsoluteVeryLow, EPriorityNormal, 0}, EPriorityList, KCpuAffinityAny, 0, 4, NULL, NULL,NULL}}, + { _L("SMPOOMemoryThread4"), CSMPSoakProcess::MemoryThread, {{EPriorityAbsoluteLow, EPriorityAbsoluteVeryLow, EPriorityNormal, 0}, EPriorityList, KCpuAffinityAny, 0, 4, NULL, NULL,NULL}}, + }; + +//File thread data +TThread CSMPSoakProcess::KFileTable[] = + { + { _L("SMPFileThread1"), CSMPSoakProcess::FileThread, {{EPriorityAbsoluteLow, EPriorityAbsoluteVeryLow, EPriorityNormal, 0}, EPriorityList, KCpuAffinityAny, 0, 4, NULL, 11, 5}}, + { _L("SMPFileThread2"), CSMPSoakProcess::FileThread, {{EPriorityNormal, EPriorityAbsoluteVeryLow, EPriorityNormal, 0}, EPriorityList, KCpuAffinityAny, 0, 4, NULL, 22, 10}}, + { _L("SMPFileThread3"), CSMPSoakProcess::FileThread, {{EPriorityMore, EPriorityAbsoluteVeryLow, EPriorityNormal, 0}, EPriorityList, KCpuAffinityAny, 0, 4, NULL, 33, 15}}, + { _L("SMPFileThread4"), CSMPSoakProcess::FileThread, {{EPriorityAbsoluteVeryLow, EPriorityMore, EPriorityNormal, 0}, EPriorityList, KCpuAffinityAny, 0, 4, NULL, 44, 20}}, + }; + +//Timer thread data +TThread CSMPSoakProcess::KTimerTable[] = + { + { _L("SMPTimerThread1"), CSMPSoakProcess::TimerThread, {{EPriorityAbsoluteLowNormal, EPriorityAbsoluteVeryLow, EPriorityNormal, 0}, EPriorityList, KCpuAffinityAny, 1000, 2, NULL, NULL,NULL}}, + { _L("SMPTimerThread2"), CSMPSoakProcess::TimerThread, {{EPriorityAbsoluteLow, EPriorityAbsoluteVeryLow, EPriorityNormal, 0}, EPriorityList, KCpuAffinityAny, 1500, 2, NULL, NULL,NULL}}, + }; +//Constructor +CSMPSoakProcess::CSMPSoakProcess() + { + } +//Destructor +CSMPSoakProcess::~CSMPSoakProcess() + { + } +//Set the process priority each time for each process +void CSMPSoakProcess::SetSoakProcessPriority() + { + RProcess proc; + TInt priority; + static TInt priorityindex = 0; + static const TProcessPriority priorityTable[]= + { + EPriorityLow, + EPriorityBackground, + EPriorityForeground, + EPriorityHigh + }; + if(++priorityindex >= 4) + priorityindex=0; + priority = priorityTable[priorityindex]; + proc.SetPriority((TProcessPriority)priority); + PRINT((_L("Process Priority:%d \n"),proc.Priority())); + } +//Changes the thread priority each time time, for each thread by Random, Increment, from List, Fixed. +//pick up the priority option from thread table +void CSMPSoakProcess::SetThreadPriority() + { + static TInt64 randSeed = KRandSeed; + static const TThreadPriority priorityTable[]= + { + EPriorityMuchLess, EPriorityLess, EPriorityNormal, EPriorityMore, EPriorityMuchMore, + EPriorityRealTime, EPriorityRealTime, EPriorityAbsoluteVeryLow, EPriorityAbsoluteLowNormal, + EPriorityAbsoluteLow, EPriorityAbsoluteBackgroundNormal, EPriorityAbsoluteBackground, + EPriorityAbsoluteForegroundNormal, EPriorityAbsoluteForeground, EPriorityAbsoluteHighNormal, EPriorityAbsoluteHigh + }; + TInt priorityIndex = 0; + switch (iThreadData.threadPriorityChange) + { + case EpriorityFixed: + break; + + case EPriorityList: + if (++iPriority >= KPriorityOrder) + iPriority = 0; + if (iThreadData.threadPriorities[iPriority] == 0) + iPriority = 0; + // PRINT(_L("SetPriority List CPU %d index %d priority %d\n"),gSMPStressDrv.GetThreadCPU(&iThread),iPriority, iThreadData.threadPriorities[iPriority]); + iThread.SetPriority((TThreadPriority)iThreadData.threadPriorities[iPriority]); + break; + + case EPriorityIncrement: + while (priorityTable[priorityIndex] <= iPriority) + { + priorityIndex++; + } + iPriority = priorityTable[priorityIndex]; + if (iPriority > iThreadData.threadPriorities[2]) + iPriority = iThreadData.threadPriorities[1]; + // PRINT(_L("SetPriority Increment CPU %d priority %d\n"),gSMPStressDrv.GetThreadCPU(&iThread), iPriority); + iThread.SetPriority((TThreadPriority)iPriority); + break; + + case EPriorityRandom: + iPriority = Math::Rand(randSeed) % (iThreadData.threadPriorities[2] - iThreadData.threadPriorities[1] + 1); + iPriority += iThreadData.threadPriorities[1]; + while (priorityTable[priorityIndex] < iPriority) + { + priorityIndex++; + } + iPriority = priorityTable[priorityIndex]; + // PRINT(_L("SetPriority Random CPU %d iPriority %d\n"),gSMPStressDrv.GetThreadCPU(&iThread), iPriority); + iThread.SetPriority((TThreadPriority)iPriority); + break; + } + } +//Resume each thread +void CSMPSoakProcess::ResumeThread() + { + iThread.Resume(); + } +// CSMPSoakProcess Thread Creation. +// @param aThread thread table data +void CSMPSoakProcess::DoCreateThread(TAny* aThread) + { + //Initialize each thread data + iThreadData = ((TThread*)aThread)->threadData; + test.Next(_L("Create Thread")); + PRINT ((_L("%s CPU affinity %d Priority %d\n"),((TThread*)aThread)->threadName.Ptr(),iThreadData.cpuAffinity,iThreadData.threadPriorities[0])); + TInt r = iThread.Create(((TThread*)aThread)->threadName, ((TThread*)aThread)->threadFunction, KDefaultStackSize, KHeapMinSize, KHeapMaxSize,(TAny*)this); + test_KErrNone(r); + if (iThreadData.threadPriorityChange == EPriorityList) + { + iPriority = 0; + } + else + { + iPriority = iThreadData.threadPriorities[0]; + } + iThread.SetPriority((TThreadPriority)iThreadData.threadPriorities[0]); + //Set the thread CPU Affinity + gSMPStressDrv.ChangeThreadAffinity(&iThread, iThreadData.cpuAffinity); + } +//Commit the chunk with aSize +void CSMPSoakProcess::CommitChunk(RChunk& aChunk, TInt aSize) + { + //PRINT ((_L("Commit Chunk \n"))); + test_KErrNone(aChunk.Adjust(aSize)); + } +//Write some data into the chunk +void CSMPSoakProcess::WriteToChunk(RChunk& aChunk, TInt aSize) + { + TUint8 *writeaddr = aChunk.Base(); + TPtr8 write(writeaddr,aSize); + write.Fill('S',aSize); + write.Copy(memData); + } +//Read the data from chunk and verify +void CSMPSoakProcess::ReadChunk(RChunk& aChunk, TInt aSize) + { + TUint8 *readaddr = aChunk.Base(); + TPtr8 read(readaddr,aSize); + test_KErrNone(read.Compare(memData)); + } +//Cleaunup chunk +void CSMPSoakProcess::DeleteChunk(RChunk& aChunk) + { + test_KErrNone(aChunk.Adjust(0)); + } +//IPC Read operation +void CSMPSoakProcess::ReadProcess() + { + RTest test(_L("SMPSoakReadProcess")); + FOREVER + { + // SetSoakProcessPriority(); + gWriteSem.Wait(); //Wait for write completion + PRINT((_L("Read Chunk\n"))); + ReadChunk( gChunk,KChunkSize); + PRINT((_L("Delete Chunk\n"))); + DeleteChunk(gChunk); + gReadSem.Signal(); //Read completion + } + } +//IPC Write operation +void CSMPSoakProcess::WriteProcess() + { + RTest test(_L("SMPSoakWriteProcess")); + FOREVER + { + // SetSoakProcessPriority(); + CommitChunk( gChunk, KChunkSize); + PRINT((_L("Write To Chunk\n"))); + WriteToChunk( gChunk,KChunkSize); + gWriteSem.Signal(); //Write completion + gReadSem.Wait(); //Wait for read completion + } + } +//File Thread - creates Dir's, Files, Fileread, Filewrite and verify +//param aSoakThread - CSMPSoakUtil pointer +TInt CSMPSoakProcess::FileThread(TAny* aSoakThread) + { + CSMPSoakProcess* self = (CSMPSoakProcess*)aSoakThread; + __ASSERT_ALWAYS(self !=NULL, User::Panic(_L("CSMPSoakProcess::TimerThread Panic"),0)); + return self->DoFileThread(); + } +//Member Filethread + TInt CSMPSoakProcess::DoFileThread() + { + RTest test(_L("SMPFileThread")); + TInt r = KErrNone; + + TFileName sessionPath; + TBuf8 fileData; + fileData.Copy(KFileData); + RFs fs; + RFile file; + + TBuf filename; + TBuf directory; + TBuf tempdir; + + //Setup Dir structure + tempdir.Format(KDir,iThreadData.dirID); + test_KErrNone(fs.Connect()); + sessionPath=KSessionPath; + TChar driveLetter; + + //Setup Drive and Session + test_KErrNone(fs.DriveToChar(EDriveD,driveLetter)); + sessionPath[0]=(TText)driveLetter; + test_KErrNone(fs.SetSessionPath(sessionPath)); + test.Printf(_L("SessionPath=%S\n"),&sessionPath); + directory=sessionPath; + directory.Append(tempdir); + PRINT((_L("Dir Level =%S Creation\n"),&directory)); + + FOREVER + { + r= fs.MkDirAll(directory); + test(r == KErrNone || r == KErrAlreadyExists); + + //Create Number of files then write data into it. + for (TInt i = 0; i < iThreadData.numFile; i++) + { + filename.Format(KFile,iThreadData.dirID,i); + PRINT((_L("File = %S Write\n"),&filename)); + test_KErrNone(file.Create(fs,filename,EFileWrite)); + test_KErrNone(file.Write(fileData)); + file.Close(); + } + + //Read those files and verify it + for (TInt i = 0; i < iThreadData.numFile; i++) + { + TBuf8 readData; + filename.Format(KFile,iThreadData.dirID,i); + PRINT((_L("File = %S Read/Verify\n"),&filename)); + test_KErrNone(file.Open(fs,filename,EFileRead)); + test_KErrNone(file.Read(readData)); + test_KErrNone(readData.Compare(fileData)); + file.Close(); + } + + //Delete files + for (TInt i = 0; i < iThreadData.numFile; i++) + { + filename.Format(KFile,iThreadData.dirID,i); + PRINT((_L("File = %S Delete\n"),&filename)); + test_KErrNone(fs.Delete(filename)); + } + + //Remove Dir's + PRINT((_L("Dir Level =%S Removed\n"),&directory)); + test_KErrNone(fs.RmDir(directory)); + SetThreadPriority(); + if (gAbort) + break; + User::After(gPeriod); + } + fs.Close(); + return 0x00; + } +//Timer Thread - produces DFC's in the kernel side +//param aSoakThread - CSMPSoakUtil pointer + TInt CSMPSoakProcess::TimerThread(TAny* aSoakThread) + { + CSMPSoakProcess* self = (CSMPSoakProcess*)aSoakThread; + __ASSERT_ALWAYS(self !=NULL, User::Panic(_L("CSMPSoakProcess::TimerThread Panic"),0)); + return self->DoTimerThread(); + } +//Member TimerThread +TInt CSMPSoakProcess::DoTimerThread() + { + RTest test(_L("SMPSoakTimerThread")); + + RTimer timer; + test_KErrNone(timer.CreateLocal()); + TRequestStatus status; + + FOREVER + { + timer.After(status, iThreadData.delayTime*1000); + User::WaitForRequest(status); + test(status == KErrNone); + PRINT((_L("$"))); + SetThreadPriority(); + if (gAbort) + break; + User::After(gPeriod); + } + + timer.Close(); + return 0x00; + } + + //OOM Thread - produces out of memory condition on SMP threads run on different cpu cores + //param aSoakThread - this pointer + TInt CSMPSoakProcess::MemoryThread(TAny* aSoakThread) + { + CSMPSoakProcess* self = (CSMPSoakProcess*)aSoakThread; + __ASSERT_ALWAYS(self !=NULL, User::Panic(_L("CSMPSoakProcess::MemoryThread Panic"),0)); + return self->DoMemoryThread(); + } +//Memory thread member + TInt CSMPSoakProcess::DoMemoryThread() + { + RTest test(_L("SMPOOMemoryThread")); + + static TInt memOKCount =0; + TAny* oomheap = NULL; + TAny* prev = NULL; + + //Reserve the memory in heap + RHeap* heap; + heap = UserHeap::ChunkHeap(NULL, KHeapMinSize, KHeapMaxiSize); + + //Keep produce OOM condition and inform to other threads (run on different CPU cores) + FOREVER + { + TInt allocsize = KHeapMaxiSize - KHeapReserveSize; + + if(memOKCount == iThreadData.numThreads-1) + allocsize = KHeapMaxiSize; + + prev = oomheap; + oomheap = heap->Alloc(allocsize); + if(oomheap == NULL) + { + PRINT(_L("Out Of Memory\n")); + heap->Free(prev); + PRINT(_L("Recover Back Memory\n")); + memOKCount = 0; + ooMemSem.Signal(iThreadData.numThreads - 1); + } + else + { + ++memOKCount; + PRINT((_L("%d:Here MemOK\n"),memOKCount)); + ooMemSem.Wait(); + } + //Change Thread Priority + SetThreadPriority(); + if (gAbort) + break; + User::After(gPeriod); + } + if(heap != NULL) + heap->Close(); + return 0x00; + } +//Create thread + void CSMPSoakProcess::CreateThread(TPtrC aThreadType) + { + if (aThreadType == _L("-W")) + { + CSMPSoakProcess smpipcwrite; + smpipcwrite.WriteProcess(); + } + else if (aThreadType == _L("-R")) + { + CSMPSoakProcess smpipcread; + smpipcread.ReadProcess(); + } + else if (aThreadType == _L("-F")) + { + CSMPSoakProcess smpfilethread[KNumFileThreads]; + for (TInt i = 0; i < KNumFileThreads; i++) + smpfilethread[i].DoCreateThread(&KFileTable[i]); + for (TInt i = 0; i < KNumFileThreads; i++) + smpfilethread[i].ResumeThread(); + } + else if (aThreadType == _L("-T")) + { + CSMPSoakProcess smptimerthread[KNumTimerThreads]; + for (TInt i = 0; i < KNumTimerThreads; i++) + smptimerthread[i].DoCreateThread(&KTimerTable[i]); + for (TInt i = 0; i < KNumTimerThreads; i++) + smptimerthread[i].ResumeThread(); + } + else if (aThreadType == _L("-O")) + { + CSMPSoakProcess smpoomthread[KNumOOMThreads]; + for (TInt i = 0; i < KNumOOMThreads; i++) + smpoomthread[i].DoCreateThread(&KOOMemoryTable[i]); + for (TInt i = 0; i < KNumOOMThreads; i++) + smpoomthread[i].ResumeThread(); + } + /* else + { + test.Printf(_L("Invalid Argument for Soak Process \n")); + test(EFalse); + }*/ + } +//Command line arg to launch operation specific process +void ParseCmdLine() + { + TBuf<256> cmd; + User::CommandLine(cmd); + TLex lex(cmd); + PRINT ((_L("Command for Process = %s\n"), cmd.PtrZ())); + CSMPSoakProcess smpp; + FOREVER + { + TPtrC token=lex.NextToken(); + if(token.Length()!=0) + { + if (token.Length()==0) + break; // ignore trailing whitespace + else if (token.Mid(0) == _L("-b")) + { + test.Printf(_L("SMPSOAKPROCESS: Silent Mode\n")); + TestSilent = ETrue; + lex.SkipSpaceAndMark(); + token.Set(lex.NextToken()); + test.Printf(_L("-b Thread Type = %s\n"), token.Ptr()); + smpp.CreateThread(token); + break; + } + else if (token.Left(2) == _L("-p")) + { + test.Printf(_L("SMPSOAKPROCESS: period\n")); + lex.SkipSpaceAndMark(); + token.Set(lex.NextToken()); + TLex lexNum(token); + lexNum.Val(gPeriod,EDecimal); + test.Printf(_L("SMPSOAKPROCESS:period in mSeconds=%d \n"),gPeriod); + token.Set(lex.NextToken()); + test.Printf(_L("-p Thread Type = %s\n"), token.Ptr()); + smpp.CreateThread(token); + break; + } + else + { + test.Printf(_L("-d Thread Type = %s\n"), token.Ptr()); + smpp.CreateThread(token); + break; + } + } + break; + } + } +// Child process called by (T_SMPSOAK) Main Process +TInt E32Main() + { + test.Title(); + __UHEAP_MARK; + test.Start(_L("t_SMPSoakProcess.exe")); + test.Next(_L("Load device driver")); + TInt r = User::LoadLogicalDevice(_L("d_smpsoak.ldd")); + if (r == KErrNotFound) + { + PRINT (_L("Test not supported on this platform because the D_SMPSOAK.LDD Driver is Not Present\n")); + test(EFalse); + } + + PRINT (_L("Calling SMPStressDrv.Open\n")); + r = gSMPStressDrv.Open(); + test_KErrNone(r); + + PRINT (_L("Create/Open Global Write Semaphores\n")); + r = gWriteSem.CreateGlobal(KGlobalWriteSem,0); + if (r==KErrAlreadyExists) + { + r = gWriteSem.OpenGlobal(KGlobalWriteSem); + } + if (r!=KErrNone) + { + PRINT ((_L("Error- OpenGlobal Write Semaphore:%d\n"),r)); + test(EFalse); + } + + PRINT (_L("Create/Open Global Read Semaphores\n")); + r = gReadSem.CreateGlobal(KGlobalReadSem,0); + if (r==KErrAlreadyExists) + { + r = gReadSem.OpenGlobal(KGlobalReadSem); + } + if (r!=KErrNone) + { + PRINT( (_L("Error- OpenGlobal Read Semaphore:%d\n"),r)); + test(EFalse); + } + + PRINT (_L("Creating Global Chunk\n")); + r = gChunk.CreateGlobal(KGlobalWRChunk,KChunkSize,KChunkMaxSize); + if(r==KErrAlreadyExists) + { + test_KErrNone( gChunk.OpenGlobal(KGlobalWRChunk,EFalse)); + } + + PRINT (_L("Creating local OOM Memory semaphore\n")); + r=ooMemSem.CreateLocal(0); + if (r!=KErrNone) + { + PRINT ((_L("Error- Creating local OOM Memory semaphore:%d\n"),r)); + test(EFalse); + } + + ParseCmdLine(); + + CActiveScheduler* myScheduler = new (ELeave) CActiveScheduler(); + test(myScheduler != NULL); + CActiveScheduler::Install(myScheduler); + CActiveScheduler::Start(); + + ooMemSem.Close(); + gWriteSem.Close(); + gReadSem.Close(); + gChunk.Close(); + gSMPStressDrv.Close(); + CActiveScheduler::Stop(); + __UHEAP_MARKEND; + test.End(); + return 0x00; + } + + + + + + + diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/smpsoak/t_smpsoakspin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/kerneltest/e32test/smpsoak/t_smpsoakspin.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -0,0 +1,287 @@ +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// e32test\t_smpsoakspin.cpp +// + +#define __E32TEST_EXTENSION__ +#include +#include +#include + + +#include "d_smpsoak.h" + +#define PRINT(string) if (!gQuiet) test.Printf(string) +#define PRINT1(string,param) if (!gQuiet) test.Printf(string,param) +#define TESTNEXT(string) if (!gQuiet) test.Next(string) + +#define DEBUG_PRINT(__args) test.Printf __args + +//------------globals--------------------- +LOCAL_D RTest test(_L("T_SMPSOAKSPIN")); +LOCAL_D TBool gQuiet = EFalse; +LOCAL_D TBool gAbort = EFalse; + +TInt TestCpuCount = 0; + +const TInt KTimerPeriod = 10000; + +const TInt KHeapMinSize=0x1000; +const TInt KHeapMaxSize=0x1000; + +// Create a new thread +RThread *spinthread = new RThread; + +//Periadic Bip +CPeriodic* Timer; + +TInt SMPSpinThread(TAny*); + + +struct TThread + { + RThread thread; + TDesC threadName; + TInt threadPriority; + TInt cpuAffinity; + TInt loopCount; + TInt endLoopDelay; + TBool fixedCPU; + TBool endFlag; + }; + +TThread ThreadTable[] = + { + { RThread(), _L("Thread1"), EPriorityAbsoluteHigh, 0, 1000, 100, EFalse, EFalse}, + { RThread(), _L("Thread2"), EPriorityAbsoluteHigh, 0, 1000, 100, EFalse, EFalse}, + }; + +enum + { + KThreads = (TInt)(sizeof(ThreadTable) / sizeof(TThread)) +}; + +void ShowHelp() + { + PRINT(_L("***************************************\n")); + PRINT(_L("The following are available commands\n")); + PRINT(_L("Esc to exit\n")); + PRINT(_L("***************************************\n")); + } + +TInt NumberOfCpus() + { + TInt r = UserSvr::HalFunction(EHalGroupKernel, EKernelHalNumLogicalCpus, 0, 0); + test(r>0); + return r; + } + + +void ParseCommandLine () + { + TBuf<64> c; + + User::CommandLine(c); + c.LowerCase(); + + if (c != KNullDesC) + { + TLex lex(c); + TPtrC token; + + while (token.Set(lex.NextToken()), token != KNullDesC) + { + if (token.Mid(0) == _L("quiet")) + { + gQuiet = ETrue; + continue; + } + + if (token.Mid(0) == _L("verbose")) + { + gQuiet = EFalse; + continue; + } + } + } + } + +// CActive class to monitor KeyStrokes from User +class CActiveConsole : public CActive + { +public: + CActiveConsole(); + ~CActiveConsole(); + void GetCharacter(); + static TInt Callback(TAny* aCtrl); + static CPeriodic* TimerL(); +private: + + + // Defined as pure virtual by CActive; + // implementation provided by this class. + virtual void DoCancel(); + // Defined as pure virtual by CActive; + // implementation provided by this class, + virtual void RunL(); + void ProcessKeyPressL(TChar aChar); + }; + +// Class CActiveConsole +CActiveConsole::CActiveConsole() + : CActive(EPriorityHigh) + { + CActiveScheduler::Add(this); + } + +CActiveConsole::~CActiveConsole() + { + Cancel(); + } + +CPeriodic* CActiveConsole::TimerL() + { + return(CPeriodic::NewL(EPriorityNormal)); + } + +// Callback function for timer expiry +TInt CActiveConsole::Callback(TAny* aControl) + { + return KErrNone; + } + +void CActiveConsole::GetCharacter() + { + test.Console()->Read(iStatus); + SetActive(); + } + +void CActiveConsole::DoCancel() + { + PRINT(_L("CActiveConsole::DoCancel\n")); + test.Console()->ReadCancel(); + } + +void CActiveConsole::ProcessKeyPressL(TChar aChar) + { + if (aChar == EKeyEscape) + { + PRINT(_L("CActiveConsole: ESC key pressed -> stopping active scheduler...\n")); + CActiveScheduler::Stop(); + return; + } + aChar.UpperCase(); + GetCharacter(); + } + +void CActiveConsole::RunL() + { + ProcessKeyPressL(static_cast(test.Console()->KeyCode())); + } + +TInt E32Main() + { + test.Title(); + __UHEAP_MARK; + test.Start(_L("SMP Soak Test")); + + test.Next(_L("Load device driver")); + TInt r = User::LoadLogicalDevice(_L("d_smpsoak.ldd")); + if (r == KErrNotFound) + { + test.Printf(_L("Test not supported on this platform because the D_SMPSOAK.LDD Driver is Not Present\n")); + test.End(); + return 0; + } + + test.Next(_L("Calling rt.Open")); + RSMPSoak rt; + r = rt.Open(); + if (r!=KErrNone) + { + test.Printf(_L("Error- Couldn't able to open soak driver:%d"),r); + return r; + } + test.Next(_L("rt.Open called")); + + spinthread->Create(_L("SMPSpinThread"), SMPSpinThread, KDefaultStackSize, KHeapMinSize, KHeapMaxSize, &rt); + DEBUG_PRINT((_L("SMPSoak Thread is %x\n"), spinthread)); + + spinthread->SetPriority(EPriorityAbsoluteLow); + + spinthread->Resume(); + + ParseCommandLine(); + + CActiveScheduler* myScheduler = new (ELeave) CActiveScheduler(); + test(myScheduler !=NULL); + CActiveScheduler::Install(myScheduler); + + CPeriodic* theTimer=NULL; + TRAPD(ret,theTimer=CActiveConsole::TimerL()) + test_KErrNone(ret); + theTimer->Start(0,KTimerPeriod,TCallBack(CActiveConsole::Callback)); + + CActiveConsole* myActiveConsole = new CActiveConsole(); + test(myActiveConsole !=NULL); + myActiveConsole->GetCharacter(); + + CActiveScheduler::Start(); + + delete theTimer; + + __UHEAP_MARKEND; + + test.End(); + + return 0; + } + +TInt SMPSpinThread(TAny* rt) +{ + TInt startCpu = 0x00; + TInt endCpu = 0x00; + RTimer timer; + test(timer.CreateLocal()==KErrNone); + TRequestStatus s; + + RSMPSoak* pMyDriver = (RSMPSoak*)rt; + RTest test(_L("SMPSpinThread")); + test.Title(); + + FOREVER + { + startCpu = pMyDriver->TryControl(RSMPSoak::KGETCURRENTCPU, 0); + + timer.After(s, 250000); + User::WaitForRequest(s); + test(s==KErrNone); + DEBUG_PRINT((_L("+"))); + + endCpu = pMyDriver->TryControl(RSMPSoak::KGETCURRENTCPU, 0); + + if(startCpu != endCpu) + { + DEBUG_PRINT((_L("\r\nSMPSoakSpin app:- Thread moved from cpu %d to cpu %d ************\n"), startCpu, endCpu)); + } + if (gAbort) + break; + } + + timer.Cancel(); + DEBUG_PRINT((_L("MyTimer.Cancel() called\n"))); + return 0x00; +} + + diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/system/d_mstim.cpp --- a/kerneltest/e32test/system/d_mstim.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/system/d_mstim.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -860,11 +860,16 @@ case RMsTim::EControlGetInfo: { SMsTimerInfo info; - info.iMin=TicksToMicroseconds(m.iMin); - info.iMax=TicksToMicroseconds(m.iMax); info.iCount=m.iCount; Int64 avg=m.iTotal/m.iCount; info.iAvg=TicksToMicroseconds((TInt)avg); +#ifdef __SMP__ + info.iMin=info.iAvg; + info.iMax=info.iAvg; +#else + info.iMin=TicksToMicroseconds(m.iMin); + info.iMax=TicksToMicroseconds(m.iMax); +#endif r=Kern::ThreadRawWrite(iThread,a2,&info,sizeof(info)); break; diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/thread/smpsafe.cpp --- a/kerneltest/e32test/thread/smpsafe.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/thread/smpsafe.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -49,41 +49,62 @@ #else // !MAKE_DLL -TInt Affinity; +volatile TInt Affinity; +RSemaphore Start; +RSemaphore Stop; + +const TInt KLoopTries = 100; +// This gets run in a low priority thread. Each time around the loop it waits to be told to go, +// then sets Affinity to 0, then tells the other thread it's done. If we're actually locked to +// the same processor as the main thread, however, then we won't get to run until the other thread +// waits for the Stop semaphore, and thus Affinity will not get set to 0 until the other thread +// checked it already. TInt AffinitySlave(TAny*) { - for (;;) + for (TInt i = KLoopTries; i>0; --i) { - __e32_atomic_store_rel32(&Affinity, 0); // we can't be locked if this runs - User::AfterHighRes(1); + Start.Wait(); + Affinity = 0; + Stop.Signal(); } + return KErrNone; } TInt CheckAffinity() { - __e32_atomic_store_rel32(&Affinity, 1); // assume we are locked to a single cpu - RThread t; TInt r = t.Create(_L("AffinitySlave"), AffinitySlave, KDefaultStackSize, NULL, NULL); if (r != KErrNone) return r; + Start.CreateLocal(0); + Stop.CreateLocal(0); + TRequestStatus s; t.Logon(s); t.SetPriority(EPriorityLess); t.Resume(); - TUint32 target = User::NTickCount() + 10; - while (User::NTickCount() < target) {} - - r = __e32_atomic_load_acq32(&Affinity); + for (TInt i = KLoopTries; i>0; --i) + { + Affinity = 1; // assume we are locked to a single cpu + Start.Signal(); // tell the other thread to run + TUint32 target = User::NTickCount() + 10; + while (User::NTickCount() < target) + { + // spin, waiting to see if the other thread actually *does* run + } + if (Affinity == 0) + break; + Stop.Wait(); // We didn't see it this time, but try again in case of scheduling fluke + } t.Kill(0); User::WaitForRequest(s); t.Close(); - return r; + return Affinity; } #ifndef OMIT_MAIN diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/thread/t_killer.cpp --- a/kerneltest/e32test/thread/t_killer.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/thread/t_killer.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -21,6 +21,7 @@ #include #include #include +#include #include const TInt KHeapMinSize=0x1000; diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/thread/t_smpsafe.cpp --- a/kerneltest/e32test/thread/t_smpsafe.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/thread/t_smpsafe.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -23,6 +23,37 @@ #include #include +///////////////////////////////////////////////////////////////////////////// +// +//! @SYMTestCaseID KBASE-T_SMPSAFE-2700 +//! @SYMTestType UT +//! @SYMPREQ PREQ2094 +//! @SYMTestCaseDesc SMP compatibility mode test +//! @SYMTestActions +//! @SYMTestExpectedResults All tests should pass. +//! @SYMTestPriority Medium +//! @SYMTestStatus Implemented +// +// The test attempts to prove that the SMPSAFE compatibility mode mechanism +// works and correctly forces processes which contain any unsafe code to run +// as if they were on a single-cpu machine. This is done by loading and +// unloading various combinations of DLLs into the test process itself, and +// by spawning and exiting various EXEs. +// +// Two things are checked for each combination: +// +// 1) D_LDRTST is used to retrieve the relevant process's SMP unsafe count, +// the number of top-level binaries loaded into that process which are not +// SMP safe. This works on all systems, including uniprocessor, even if +// compatibility mode is not enabled, as this accounting is done +// unconditionally. +// +// 2) If the system running the test has multiple processors, and one of the +// compatibility modes is actually enabled, the test process runs a loop +// designed to see if concurrent execution of threads actually happens. +// (the loop is in smpsafe.cpp because it is shared between the test and +// the small slave programs used). + RTest test(_L("T_SMPSAFE")); RLdrTest ldd; @@ -32,12 +63,17 @@ extern TInt CheckAffinity(); +// load an exe and check that it has the expected SMP unsafe count (check 1) +// don't resume/delete it yet. void DoStartExe(RProcess& p, const TDesC &aFilename, TInt aExpectedUnsafe) { test_KErrNone(p.Create(aFilename, KNullDesC)); test_Equal(aExpectedUnsafe, ldd.ProcessSMPUnsafeCount(p.Handle())); } +// resume the exe and if compatibility mode is available, check that the +// expected outcome of the test loop was observed (check 2) +// delete it afterward. void DoStopExe(RProcess& p, TInt aExpectedUnsafe) { TRequestStatus s; @@ -62,6 +98,7 @@ DoStopExe(pLoaded, aExpectedUnsafe); } +// start and stop an exe, doing both checks 1 and 2. void TryExe(const TDesC &aFilename, TInt aExpectedUnsafe) { RProcess p; @@ -69,6 +106,7 @@ DoStopExe(p, aExpectedUnsafe); } +// check the main test process, both checks 1 and 2. void CheckSelf(TInt aExpectedUnsafe) { test_Equal(aExpectedUnsafe, ldd.ProcessSMPUnsafeCount(RProcess().Handle())); @@ -93,16 +131,25 @@ TInt cpus = UserSvr::HalFunction(EHalGroupKernel, EKernelHalNumLogicalCpus, 0, 0); test_Compare(cpus, >, 0); SMPPlatform = cpus > 1; - - test.Next(_L("Get compatibility mode setting")); - TInt flags = UserSvr::HalFunction(EHalGroupKernel, EKernelHalConfigFlags, 0, 0); - test_Compare(flags, >=, 0); - CompatMode = flags & (EKernelConfigSMPUnsafeCompat | EKernelConfigSMPUnsafeCPU0); - if (SMPPlatform && !CompatMode) + if (!SMPPlatform) + { + CompatMode = EFalse; + test.Printf(_L("*****************************************************\n")); + test.Printf(_L("Uniprocessor system, not actually testing compat mode\n")); + test.Printf(_L("*****************************************************\n")); + } + else { - test.Printf(_L("*************************************************\n")); - test.Printf(_L("Compatibility mode is not enabled, not testing it\n")); - test.Printf(_L("*************************************************\n")); + test.Next(_L("Get compatibility mode setting")); + TInt flags = UserSvr::HalFunction(EHalGroupKernel, EKernelHalConfigFlags, 0, 0); + test_Compare(flags, >=, 0); + CompatMode = flags & (EKernelConfigSMPUnsafeCompat | EKernelConfigSMPUnsafeCPU0); + if (!CompatMode) + { + test.Printf(_L("*************************************************\n")); + test.Printf(_L("Compatibility mode is not enabled, not testing it\n")); + test.Printf(_L("*************************************************\n")); + } } test.Next(_L("Load test LDD")); diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/usb/t_usb_win/scripts/massstorage/bmwritelargefile.pl --- a/kerneltest/e32test/usb/t_usb_win/scripts/massstorage/bmwritelargefile.pl Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/usb/t_usb_win/scripts/massstorage/bmwritelargefile.pl Thu Jan 07 13:38:45 2010 +0200 @@ -2,7 +2,7 @@ # Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). # All rights reserved. # This component and the accompanying materials are made available -# under the terms of "Eclipse Public License v1.0"" +# under the terms of the License "Eclipse Public License v1.0" # which accompanies this distribution, and is available # at the URL "http://www.eclipse.org/legal/epl-v10.html". # diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/usb/t_usb_win/scripts/massstorage/bmwritemanyfiles.pl --- a/kerneltest/e32test/usb/t_usb_win/scripts/massstorage/bmwritemanyfiles.pl Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/usb/t_usb_win/scripts/massstorage/bmwritemanyfiles.pl Thu Jan 07 13:38:45 2010 +0200 @@ -2,7 +2,7 @@ # Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). # All rights reserved. # This component and the accompanying materials are made available -# under the terms of "Eclipse Public License v1.0"" +# under the terms of the License "Eclipse Public License v1.0" # which accompanies this distribution, and is available # at the URL "http://www.eclipse.org/legal/epl-v10.html". # diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/usb/t_usb_win/scripts/massstorage/createfilesanddirs.pl --- a/kerneltest/e32test/usb/t_usb_win/scripts/massstorage/createfilesanddirs.pl Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/usb/t_usb_win/scripts/massstorage/createfilesanddirs.pl Thu Jan 07 13:38:45 2010 +0200 @@ -2,7 +2,7 @@ # Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). # All rights reserved. # This component and the accompanying materials are made available -# under the terms of "Eclipse Public License v1.0"" +# under the terms of the License "Eclipse Public License v1.0" # which accompanies this distribution, and is available # at the URL "http://www.eclipse.org/legal/epl-v10.html". # diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/usb/t_usb_win/scripts/massstorage/createlargefile.pl --- a/kerneltest/e32test/usb/t_usb_win/scripts/massstorage/createlargefile.pl Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/usb/t_usb_win/scripts/massstorage/createlargefile.pl Thu Jan 07 13:38:45 2010 +0200 @@ -2,7 +2,7 @@ # Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). # All rights reserved. # This component and the accompanying materials are made available -# under the terms of "Eclipse Public License v1.0"" +# under the terms of the License "Eclipse Public License v1.0" # which accompanies this distribution, and is available # at the URL "http://www.eclipse.org/legal/epl-v10.html". # diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32test/window/t_wsimp.cpp --- a/kerneltest/e32test/window/t_wsimp.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32test/window/t_wsimp.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include diff -r 56f325a607ea -r 0173bcd7697c kerneltest/e32utils/crashread/crashread.cpp --- a/kerneltest/e32utils/crashread/crashread.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/e32utils/crashread/crashread.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -16,6 +16,7 @@ #include #include #include +#include #include #include "crashflash.h" #include diff -r 56f325a607ea -r 0173bcd7697c kerneltest/f32test/bench/t_fsysbm.cpp --- a/kerneltest/f32test/bench/t_fsysbm.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/f32test/bench/t_fsysbm.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -19,8 +19,11 @@ #include #include +#include #include #include +#include +#include #include "t_server.h" #include "../../e32test/mmu/d_sharedchunk.h" diff -r 56f325a607ea -r 0173bcd7697c kerneltest/f32test/concur/cfafsdly.cpp --- a/kerneltest/f32test/concur/cfafsdly.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/f32test/concur/cfafsdly.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -227,7 +227,7 @@ void CTestFileSystem::DriveInfo(TDriveInfo& anInfo,TInt aDriveNumber) const /// -/// Return drive info - iDriveAtt and iBatteryState are already set +/// Return drive info - iDriveAtt already set /// { TTestDebug::Printf(_L("CTestFileSystem::DriveInfo(%d)\n"), aDriveNumber); diff -r 56f325a607ea -r 0173bcd7697c kerneltest/f32test/concur/cfafshmem.h --- a/kerneltest/f32test/concur/cfafshmem.h Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/f32test/concur/cfafshmem.h Thu Jan 07 13:38:45 2010 +0200 @@ -19,6 +19,7 @@ #define __CFAFSHMEM_H__ #include +#include #include #include "t_server.h" diff -r 56f325a607ea -r 0173bcd7697c kerneltest/f32test/concur/t_cfssimple.cpp --- a/kerneltest/f32test/concur/t_cfssimple.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/f32test/concur/t_cfssimple.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -111,8 +111,8 @@ r=TheFs.Drive(info,aDrive); test_KErrNone(r); - test.Printf(_L("iType=%d,iBattery=%d,iDriveAtt=%x,iMediaAtt=%x\n"),(TUint)info.iType,\ - (TUint)info.iBattery,info.iDriveAtt,info.iMediaAtt); + test.Printf(_L("iType=%d,iConnctionBusType=%d,iDriveAtt=%x,iMediaAtt=%x\n"),(TUint)info.iType,\ + (TUint)info.iConnectionBusType,info.iDriveAtt,info.iMediaAtt); return c; } diff -r 56f325a607ea -r 0173bcd7697c kerneltest/f32test/demandpaging/loader/t_pageldrtst.cpp --- a/kerneltest/f32test/demandpaging/loader/t_pageldrtst.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/f32test/demandpaging/loader/t_pageldrtst.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -120,6 +120,7 @@ #include #include +#include #include #include #include @@ -127,6 +128,7 @@ #include #include #include +#include #include #include "t_hash.h" diff -r 56f325a607ea -r 0173bcd7697c kerneltest/f32test/demandpaging/t_fragmentdp.cpp --- a/kerneltest/f32test/demandpaging/t_fragmentdp.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/f32test/demandpaging/t_fragmentdp.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -32,7 +32,9 @@ //! @SYMTestStatus Implemented #include +#include #include +#include #include "t_server.h" #include #include diff -r 56f325a607ea -r 0173bcd7697c kerneltest/f32test/demandpaging/t_mmcpaging.cpp --- a/kerneltest/f32test/demandpaging/t_mmcpaging.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/f32test/demandpaging/t_mmcpaging.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -31,9 +31,11 @@ RTest test(_L("T_MMCPAGING")); #include +#include #include #include #include +#include #include #define __TEST_PAGING_MEDIA_DRIVER__ #include "mmcdp.h" diff -r 56f325a607ea -r 0173bcd7697c kerneltest/f32test/demandpaging/t_nandpaging.cpp --- a/kerneltest/f32test/demandpaging/t_nandpaging.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/f32test/demandpaging/t_nandpaging.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -32,6 +32,7 @@ RTest test(_L("T_NANDPAGING")); #include +#include #include #include #include diff -r 56f325a607ea -r 0173bcd7697c kerneltest/f32test/demandpaging/t_pagestress.cpp --- a/kerneltest/f32test/demandpaging/t_pagestress.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/f32test/demandpaging/t_pagestress.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -71,6 +71,7 @@ RTest test(_L("T_PAGESTRESS")); #include +#include #include #include #include diff -r 56f325a607ea -r 0173bcd7697c kerneltest/f32test/demandpaging/t_paginginfo.cpp --- a/kerneltest/f32test/demandpaging/t_paginginfo.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/f32test/demandpaging/t_paginginfo.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -20,9 +20,11 @@ RTest test(_L("t_paginginfo")); #include +#include #include #include #include +#include #include "testdefs.h" #include diff -r 56f325a607ea -r 0173bcd7697c kerneltest/f32test/demandpaging/t_ramstress.cpp --- a/kerneltest/f32test/demandpaging/t_ramstress.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/f32test/demandpaging/t_ramstress.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -32,6 +32,7 @@ #include #include #include +#include #include #include "t_ramstress.h" diff -r 56f325a607ea -r 0173bcd7697c kerneltest/f32test/demandpaging/t_reaper.cpp --- a/kerneltest/f32test/demandpaging/t_reaper.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/f32test/demandpaging/t_reaper.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -43,6 +43,7 @@ #define __E32TEST_EXTENSION__ #include +#include #include #include #include diff -r 56f325a607ea -r 0173bcd7697c kerneltest/f32test/demandpaging/t_wdpstress.cpp --- a/kerneltest/f32test/demandpaging/t_wdpstress.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/f32test/demandpaging/t_wdpstress.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -45,11 +45,14 @@ // #define __E32TEST_EXTENSION__ #include +#include RTest test(_L("T_WDPSTRESS")); #include #include #include +#include +#include #include #include #include diff -r 56f325a607ea -r 0173bcd7697c kerneltest/f32test/filesystem/fat/t_compat32.cpp --- a/kerneltest/f32test/filesystem/fat/t_compat32.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/f32test/filesystem/fat/t_compat32.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -18,6 +18,7 @@ #define __E32TEST_EXTENSION__ #include +#include #include #include #include "t_server.h" diff -r 56f325a607ea -r 0173bcd7697c kerneltest/f32test/filesystem/fat/t_scn32dr3.cpp --- a/kerneltest/f32test/filesystem/fat/t_scn32dr3.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/f32test/filesystem/fat/t_scn32dr3.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -17,6 +17,7 @@ #include #include +#include #include "t_server.h" #include "fat_utils.h" diff -r 56f325a607ea -r 0173bcd7697c kerneltest/f32test/fileutils/inc/t_chlffs.h --- a/kerneltest/f32test/fileutils/inc/t_chlffs.h Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/f32test/fileutils/inc/t_chlffs.h Thu Jan 07 13:38:45 2010 +0200 @@ -18,6 +18,9 @@ #if !defined(__T_CHLFFS_H__) #define __T_CHLFFS_H__ +#include +#include + #if defined(__WINS__) // #define __TEST_LFFS_ONLY__ #endif diff -r 56f325a607ea -r 0173bcd7697c kerneltest/f32test/fsstress/t_remfsy.cpp --- a/kerneltest/f32test/fsstress/t_remfsy.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/f32test/fsstress/t_remfsy.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -139,7 +139,7 @@ void CRemote::DriveInfo(TDriveInfo& anInfo,TInt aDriveNumber) const // -// Return the drive info iDriveAtt && iBatteryState already set +// Return the drive info, iDriveAtt already set // { diff -r 56f325a607ea -r 0173bcd7697c kerneltest/f32test/fsstress/t_remses.cpp --- a/kerneltest/f32test/fsstress/t_remses.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/f32test/fsstress/t_remses.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -308,7 +308,7 @@ r=iFs.Volume(w,EDriveO); aTest(r==KErrNone); aTest(w.iDrive.iType==v.iDrive.iType); - aTest(w.iDrive.iBattery==v.iDrive.iBattery); + aTest(w.iDrive.iConnectionBusType==v.iDrive.iConnectionBusType); aTest(w.iDrive.iDriveAtt==v.iDrive.iDriveAtt); aTest(w.iDrive.iMediaAtt==v.iDrive.iMediaAtt); aTest(w.iUniqueID==v.iUniqueID); @@ -601,12 +601,11 @@ aTest.Printf(_L("Formattable ")); if (anInfo.iMediaAtt&KMediaAttWriteProtected) aTest.Printf(_L("WProtected ")); - aTest.Printf(_L("\n BATTERY=")); - switch(anInfo.iBattery) + aTest.Printf(_L("\n CONNECTION BUS TYPE=")); + switch(anInfo.iConnectionBusType) { - case EBatNotSupported: aTest.Printf(_L("Not supported\n")); break; - case EBatGood: aTest.Printf(_L("Good\n")); break; - case EBatLow: aTest.Printf(_L("Low\n")); break; + case EConnectionBusInternal: aTest.Printf(_L("Internal\n")); break; + case EConnectionBusUsb: aTest.Printf(_L("USB\n")); break; default: aTest.Printf(_L("Unknown value\n")); } @@ -633,7 +632,7 @@ // { - aTest(anInfo.iBattery==EBatLow || anInfo.iBattery==EBatGood || anInfo.iBattery==EBatNotSupported); + aTest(anInfo.iConnectionBusType==EConnectionBusInternal || anInfo.iConnectionBusType==EConnectionBusUsb); if (aDrive==EDriveZ) { diff -r 56f325a607ea -r 0173bcd7697c kerneltest/f32test/fsstress/t_sesfs.cpp --- a/kerneltest/f32test/fsstress/t_sesfs.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/f32test/fsstress/t_sesfs.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -258,7 +258,7 @@ r=iFs.Volume(w,EDriveO); test_KErrNone(r); test(w.iDrive.iType==v.iDrive.iType); - test(w.iDrive.iBattery==v.iDrive.iBattery); + test(w.iDrive.iConnectionBusType==v.iDrive.iConnectionBusType); test(w.iDrive.iDriveAtt==KDriveAttSubsted); test(w.iDrive.iMediaAtt==v.iDrive.iMediaAtt); test(w.iUniqueID==v.iUniqueID); @@ -287,7 +287,7 @@ test(d.iDriveAtt==KDriveAttSubsted); test(d.iMediaAtt==origDI.iMediaAtt); test(d.iType==origDI.iType); - test(d.iBattery==origDI.iBattery); + test(d.iConnectionBusType==origDI.iConnectionBusType); test.Next(_L("Test real name")); @@ -707,12 +707,11 @@ test.Printf(_L("Formattable ")); if (anInfo.iMediaAtt&KMediaAttWriteProtected) test.Printf(_L("WProtected ")); - test.Printf(_L("\n BATTERY=")); - switch(anInfo.iBattery) + test.Printf(_L("\n CONNECTION BUS=")); + switch(anInfo.iConnectionBusType) { - case EBatNotSupported: test.Printf(_L("Not supported\n")); break; - case EBatGood: test.Printf(_L("Good\n")); break; - case EBatLow: test.Printf(_L("Low\n")); break; + case EConnectionBusInternal: test.Printf(_L("Internal\n")); break; + case EConnectionBusUsb: test.Printf(_L("USB\n")); break; default: test.Printf(_L("Unknown value\n")); } @@ -739,7 +738,7 @@ // { - test(anInfo.iBattery==EBatLow || anInfo.iBattery==EBatGood || anInfo.iBattery==EBatNotSupported); + test(anInfo.iConnectionBusType==EConnectionBusInternal || anInfo.iConnectionBusType==EConnectionBusUsb); if (aDrive==EDriveZ) { diff -r 56f325a607ea -r 0173bcd7697c kerneltest/f32test/group/t_rename.mmp --- a/kerneltest/f32test/group/t_rename.mmp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/f32test/group/t_rename.mmp Thu Jan 07 13:38:45 2010 +0200 @@ -22,6 +22,7 @@ SOURCE t_main.cpp SOURCEPATH ../fileutils/src SOURCE t_chlffs.cpp +SOURCE f32_test_utils.cpp LIBRARY euser.lib efsrv.lib hal.lib OS_LAYER_SYSTEMINCLUDE_SYMBIAN diff -r 56f325a607ea -r 0173bcd7697c kerneltest/f32test/loader/security/t_fuzzldr.cpp --- a/kerneltest/f32test/loader/security/t_fuzzldr.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/f32test/loader/security/t_fuzzldr.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -17,6 +17,7 @@ #define __E32TEST_EXTENSION__ #include +#include #include #include #include diff -r 56f325a607ea -r 0173bcd7697c kerneltest/f32test/loader/t_ldrtst.h --- a/kerneltest/f32test/loader/t_ldrtst.h Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/f32test/loader/t_ldrtst.h Thu Jan 07 13:38:45 2010 +0200 @@ -22,6 +22,7 @@ #include #include +#include #include "dlltree.h" #include "dllt.h" #include "exetifc.h" diff -r 56f325a607ea -r 0173bcd7697c kerneltest/f32test/loader/tld_helper.cpp --- a/kerneltest/f32test/loader/tld_helper.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/f32test/loader/tld_helper.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -17,7 +17,8 @@ #include "t_loader_delete.h" #include - +#include +#include TInt E32Main() { diff -r 56f325a607ea -r 0173bcd7697c kerneltest/f32test/locl/localeutils/elocl32_japan/src/t_tlocl32_lat1.cpp --- a/kerneltest/f32test/locl/localeutils/elocl32_japan/src/t_tlocl32_lat1.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/f32test/locl/localeutils/elocl32_japan/src/t_tlocl32_lat1.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -2,7 +2,7 @@ * Copyright (c) 1995-1999 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0"" +* under the terms of the License "Eclipse Public License v1.0" * which accompanies this distribution, and is available * at the URL "http://www.eclipse.org/legal/epl-v10.html". * diff -r 56f325a607ea -r 0173bcd7697c kerneltest/f32test/locl/t_locChange.cpp --- a/kerneltest/f32test/locl/t_locChange.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/f32test/locl/t_locChange.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -15,6 +15,7 @@ #include #include +#include _LIT(KGerLocale, "T_LOCLGE.DLL"); _LIT(KEngLocale, "T_LOCLUS.DLL"); diff -r 56f325a607ea -r 0173bcd7697c kerneltest/f32test/server/t_blockmap.cpp --- a/kerneltest/f32test/server/t_blockmap.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/f32test/server/t_blockmap.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -34,6 +34,7 @@ #include +#include #include #include #include diff -r 56f325a607ea -r 0173bcd7697c kerneltest/f32test/server/t_cp_plugin.cpp --- a/kerneltest/f32test/server/t_cp_plugin.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/f32test/server/t_cp_plugin.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -17,6 +17,8 @@ #include +#include +#include #include #include #include "t_server.h" diff -r 56f325a607ea -r 0173bcd7697c kerneltest/f32test/server/t_dspace.cpp --- a/kerneltest/f32test/server/t_dspace.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/f32test/server/t_dspace.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -178,7 +178,6 @@ TheBuffer.SetLength(KMaxBufSize); Mem::Fill((void*)TheBuffer.Ptr(),KMaxBufSize,0xab); } - TheDiskSize=DiskSize(KDefaultDrive); #if defined(__WINS__) RemovableDrive=EDriveX; #else @@ -240,6 +239,7 @@ // test not run on c: drive but does use it Format(EDriveC); #endif + TheDiskSize=DiskSize(KDefaultDrive); // and set the default directory r=TheFs.MkDirAll(gSessionPath); test(r==KErrNone || r==KErrAlreadyExists); diff -r 56f325a607ea -r 0173bcd7697c kerneltest/f32test/server/t_falsespace.cpp --- a/kerneltest/f32test/server/t_falsespace.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/f32test/server/t_falsespace.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -15,6 +15,7 @@ #include #include +#include #include #include "fat_utils.h" diff -r 56f325a607ea -r 0173bcd7697c kerneltest/f32test/server/t_fatcharsetconv_SpecificCases.cpp --- a/kerneltest/f32test/server/t_fatcharsetconv_SpecificCases.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/f32test/server/t_fatcharsetconv_SpecificCases.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -19,6 +19,7 @@ #include "T_Fatcharsetconv_aux.h" #include #include +#include #include #include #include diff -r 56f325a607ea -r 0173bcd7697c kerneltest/f32test/server/t_fatcharsetconv_main.cpp --- a/kerneltest/f32test/server/t_fatcharsetconv_main.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/f32test/server/t_fatcharsetconv_main.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -18,6 +18,7 @@ #define __E32TEST_EXTENSION__ #include +#include //#include #include #include diff -r 56f325a607ea -r 0173bcd7697c kerneltest/f32test/server/t_file.cpp --- a/kerneltest/f32test/server/t_file.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/f32test/server/t_file.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -3032,13 +3032,13 @@ TInt nRes=TheFs.CharToDrive(gDriveToTest, gDriveNum); test(nRes==KErrNone); - + PrintDrvInfo(TheFs, gDriveNum); //-- FAT Supports short file names if(Is_Fat(TheFs, gDriveNum)) gShortFileNamesSupported = ETrue; - else + if(Is_Win32(TheFs, gDriveNum)) {//-- find out if this is NTFS and if it supports short names (this feature can be switched OFF) @@ -3052,15 +3052,17 @@ nRes = TheFs.Delete(KLongFN); test(nRes==KErrNone); + + DeleteTestDirectory(); } - - - - - DeleteTestDirectory(); + else + { + nRes = FormatDrive(TheFs, gDriveNum, ETrue); + test(nRes==KErrNone); + } + CreateTestDirectory(_L("\\F32-TST\\TFILE\\")); - testFileRename(); testSetSize(); CopyFileToTestDirectory(); diff -r 56f325a607ea -r 0173bcd7697c kerneltest/f32test/server/t_fsrv.cpp --- a/kerneltest/f32test/server/t_fsrv.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/f32test/server/t_fsrv.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -152,12 +152,11 @@ test.Printf(_L("Formattable ")); if (anInfo.iMediaAtt&KMediaAttWriteProtected) test.Printf(_L("WProtected ")); - test.Printf(_L("\n BATTERY=")); - switch(anInfo.iBattery) + test.Printf(_L("\n CONNECTION BUS=")); + switch(anInfo.iConnectionBusType) { - case EBatNotSupported: test.Printf(_L("Not supported\n")); break; - case EBatGood: test.Printf(_L("Good\n")); break; - case EBatLow: test.Printf(_L("Low\n")); break; + case EConnectionBusInternal: test.Printf(_L("Internal\n")); break; + case EConnectionBusUsb: test.Printf(_L("USB\n")); break; default: test.Printf(_L("Unknown value\n")); } @@ -285,7 +284,7 @@ // { - test(anInfo.iBattery==EBatLow || anInfo.iBattery==EBatGood || anInfo.iBattery==EBatNotSupported); + test(anInfo.iConnectionBusType==EConnectionBusInternal || anInfo.iConnectionBusType==EConnectionBusUsb); if (aDrive==EDriveZ) { @@ -1134,7 +1133,7 @@ r=TheFs.Volume(w,EDriveO); test(r==KErrNone); test(w.iDrive.iType==v.iDrive.iType); - test(w.iDrive.iBattery==v.iDrive.iBattery); + test(w.iDrive.iConnectionBusType==v.iDrive.iConnectionBusType); test(w.iDrive.iDriveAtt==KDriveAttSubsted); test(w.iDrive.iMediaAtt==v.iDrive.iMediaAtt); test(w.iUniqueID==v.iUniqueID); @@ -1151,7 +1150,7 @@ test(d.iDriveAtt==KDriveAttSubsted); test(d.iMediaAtt==origDI.iMediaAtt); test(d.iType==origDI.iType); - test(d.iBattery==origDI.iBattery); + test(d.iConnectionBusType==origDI.iConnectionBusType); test.Next(_L("Test real name")); diff -r 56f325a607ea -r 0173bcd7697c kerneltest/f32test/server/t_fsys.cpp --- a/kerneltest/f32test/server/t_fsys.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/f32test/server/t_fsys.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -29,329 +29,329 @@ RTest test(_L("T_FSYS")); static void TestFileSystemNames() - { - test.Next(_L("Read file system names for all drives")); - TFullName name; - TInt r; - for(TInt i=EDriveA;i b; - TDriveInfo di; - r=TheFs.Drive(di,aDrive); - test(r==KErrNone); - b.Format(_L("Test dismounting of test file system on %c: (DrvAtt:%x MedAtt:%x)"),(TUint)c,di.iDriveAtt,di.iMediaAtt); - test.Next(b); - - // Test cannot dismount on rom drive - test.Next(_L("Test cannot dismount on Rom drive")); - TFullName zName; - r=TheFs.FileSystemName(zName,EDriveZ); - test(r==KErrNone); - r=TheFs.DismountFileSystem(zName,EDriveZ); - test.Printf(_L("r=%d"),r); - // NB if paging is enabled on a ROFS partition which is part of the composite file system then the - // likelihood is that there will be a at least one file clamped: in this case there error will be KErrInUse - test(r==KErrAccessDenied || r==KErrInUse); + TBuf<128> b; + TDriveInfo di; + r=TheFs.Drive(di,aDrive); + test(r==KErrNone); + b.Format(_L("Test dismounting of test file system on %c: (DrvAtt:%x MedAtt:%x)"),(TUint)c,di.iDriveAtt,di.iMediaAtt); + test.Next(b); + + // Test cannot dismount on rom drive + test.Next(_L("Test cannot dismount on Rom drive")); + TFullName zName; + r=TheFs.FileSystemName(zName,EDriveZ); + test(r==KErrNone); + r=TheFs.DismountFileSystem(zName,EDriveZ); + test.Printf(_L("r=%d"),r); + // NB if paging is enabled on a ROFS partition which is part of the composite file system then the + // likelihood is that there will be a at least one file clamped: in this case there error will be KErrInUse + test(r==KErrAccessDenied || r==KErrInUse); - // Test cannot dismount on wrong drive - test.Next(_L("Test cannot dismount on wrong drive")); - r=TheFs.DismountFileSystem(aFs,EDriveA); - test(r==KErrNotReady); + // Test cannot dismount on wrong drive + test.Next(_L("Test cannot dismount on wrong drive")); + r=TheFs.DismountFileSystem(aFs,EDriveA); + test(r==KErrNotReady); - // Test cannot dismount with wrong name - test.Next(_L("Test cannot dismount with wrong file system name")); - r=TheFs.DismountFileSystem(_L("abc"),aDrive); - test(r==KErrNotFound); + // Test cannot dismount with wrong name + test.Next(_L("Test cannot dismount with wrong file system name")); + r=TheFs.DismountFileSystem(_L("abc"),aDrive); + test(r==KErrNotFound); - // Test cannot dismount with a file open - test.Next(_L("Test cannot dismount with a file open")); - r=TheFs.SetSessionPath(newSess); - RFile file; - r=file.Replace(TheFs,_L("abc"),EFileShareAny); - test(r==KErrNone); - r=TheFs.SessionPath(newSess); - TBool open; - r=TheFs.IsFileOpen(_L("abc"),open); - test(r==KErrNone); - test(open); - r=TheFs.DismountFileSystem(aFs,aDrive); - test(r==KErrInUse); - file.Close(); + // Test cannot dismount with a file open + test.Next(_L("Test cannot dismount with a file open")); + r=TheFs.SetSessionPath(newSess); + RFile file; + r=file.Replace(TheFs,_L("abc"),EFileShareAny); + test(r==KErrNone); + r=TheFs.SessionPath(newSess); + TBool open; + r=TheFs.IsFileOpen(_L("abc"),open); + test(r==KErrNone); + test(open); + r=TheFs.DismountFileSystem(aFs,aDrive); + test(r==KErrInUse); + file.Close(); - // Now test dismount works - test.Next(_L("Test dismounts OK")); - r=TheFs.DismountFileSystem(aFs,aDrive); - if(r!=KErrNone) - { - test.Printf(_L("Error = %d"),r); - test(EFalse); - } - TFullName n; - r=TheFs.FileSystemName(n,aDrive); - test(r==KErrNone || r==KErrNotFound); - test(!n.Length()); - r=file.Replace(TheFs,_L("abc"),EFileShareAny); - test(r==KErrNotReady); - file.Close(); + // Now test dismount works + test.Next(_L("Test dismounts OK")); + r=TheFs.DismountFileSystem(aFs,aDrive); + if(r!=KErrNone) + { + test.Printf(_L("Error = %d"),r); + test(EFalse); + } + TFullName n; + r=TheFs.FileSystemName(n,aDrive); + test(r==KErrNone || r==KErrNotFound); + test(!n.Length()); + r=file.Replace(TheFs,_L("abc"),EFileShareAny); + test(r==KErrNotReady); + file.Close(); - r=TheFs.MountFileSystem(aFs,aDrive); - if(r!=KErrNone) - { - test.Printf(_L("error = %d\n"),r); - test(EFalse); - } - r=TheFs.FileSystemName(n,aDrive); - test(r==KErrNone); - test(n.Compare(aFs)==0); - r=file.Replace(TheFs,_L("abc"),EFileShareAny); // ??? bang - test(r==KErrNone); - file.Close(); - r=TheFs.SetSessionPath(oldSess); - test(r==KErrNone); - } + r=TheFs.MountFileSystem(aFs,aDrive); + if(r!=KErrNone) + { + test.Printf(_L("error = %d\n"),r); + test(EFalse); + } + r=TheFs.FileSystemName(n,aDrive); + test(r==KErrNone); + test(n.Compare(aFs)==0); + r=file.Replace(TheFs,_L("abc"),EFileShareAny); // ??? bang + test(r==KErrNone); + file.Close(); + r=TheFs.SetSessionPath(oldSess); + test(r==KErrNone); + } static void TestDismountFileSystem(TInt aDrive) - { + { - TInt r; - TFullName name; - r=TheFs.FileSystemName(name,aDrive); - test(r==KErrNone || r==KErrNotFound); - if(name.Length()) - CheckDismount(name,aDrive); - } + TInt r; + TFullName name; + r=TheFs.FileSystemName(name,aDrive); + test(r==KErrNone || r==KErrNotFound); + if(name.Length()) + CheckDismount(name,aDrive); + } #if defined(__EPOC32__) static void TestFileSystem(TInt aDrive) // // Mount a new CTestFileSystem on the drive under test // - { - TBuf<64> b; - TChar c; - TInt r=TheFs.DriveToChar(aDrive,c); - test(r==KErrNone); - TDriveInfo di; - r=TheFs.Drive(di,aDrive); - test(r==KErrNone); - b.Format(_L("Test mounting of test file system on %c: (DrvAtt:%x MedAtt:%x)"),(TUint)c,di.iDriveAtt,di.iMediaAtt); - test.Next(b); + { + TBuf<64> b; + TChar c; + TInt r=TheFs.DriveToChar(aDrive,c); + test(r==KErrNone); + TDriveInfo di; + r=TheFs.Drive(di,aDrive); + test(r==KErrNone); + b.Format(_L("Test mounting of test file system on %c: (DrvAtt:%x MedAtt:%x)"),(TUint)c,di.iDriveAtt,di.iMediaAtt); + test.Next(b); - test.Next(_L("Test mounting of test file system")); - r=TheFs.AddFileSystem(_L("T_TFSYS")); - if(r!=KErrNone && r!=KErrAlreadyExists) - { - test.Printf(_L("error=%d"),r); - test(EFalse); - } + test.Next(_L("Test mounting of test file system")); + r=TheFs.AddFileSystem(_L("T_TFSYS")); + if(r!=KErrNone && r!=KErrAlreadyExists) + { + test.Printf(_L("error=%d"),r); + test(EFalse); + } - TFullName oldFs; - r=TheFs.FileSystemName(oldFs,aDrive); -// TFileName oldFs; -// r=TheFs.FileSystemName(oldFs,aDrive); - test(r==KErrNone); - r=TheFs.DismountFileSystem(oldFs,aDrive); - if(r!=KErrNone) - { - test.Printf(_L("Error = %d"),r); - test(EFalse); - } - r=TheFs.MountFileSystem(_L("Test"),aDrive); - test(r==KErrNone); + TFullName oldFs; + r=TheFs.FileSystemName(oldFs,aDrive); +// TFileName oldFs; +// r=TheFs.FileSystemName(oldFs,aDrive); + test(r==KErrNone); + r=TheFs.DismountFileSystem(oldFs,aDrive); + if(r!=KErrNone) + { + test.Printf(_L("Error = %d"),r); + test(EFalse); + } + r=TheFs.MountFileSystem(_L("Test"),aDrive); + test(r==KErrNone); - TFileName newFs; - r=TheFs.FileSystemName(newFs,aDrive); - test(r==KErrNone); - test(newFs.Compare(_L("Test"))==0); + TFileName newFs; + r=TheFs.FileSystemName(newFs,aDrive); + test(r==KErrNone); + test(newFs.Compare(_L("Test"))==0); - // Check attributes - TDriveInfo info; - r=TheFs.Drive(info,aDrive); - test(r==KErrNone); + // Check attributes + TDriveInfo info; + r=TheFs.Drive(info,aDrive); + test(r==KErrNone); - test.Printf(_L("iType=%d,iBattery=%d,iDriveAtt=%x,iMediaAtt=%x\n"),(TUint)info.iType,\ - (TUint)info.iBattery,info.iDriveAtt,info.iMediaAtt); + test.Printf(_L("iType=%d,iConnectionBusType=%d,iDriveAtt=%x,iMediaAtt=%x\n"),(TUint)info.iType,\ + (TUint)info.iConnectionBusType,info.iDriveAtt,info.iMediaAtt); - //Try to remove filesystem without dismounting. - r=TheFs.RemoveFileSystem(_L("Test")); - if(r!=KErrInUse) - { - test.Printf(_L("error=%d"),r); - test(EFalse); - } - r=TheFs.FileSystemName(newFs,aDrive); - test(r==KErrNone); - test(newFs.Compare(_L("Test"))==0); + //Try to remove filesystem without dismounting. + r=TheFs.RemoveFileSystem(_L("Test")); + if(r!=KErrInUse) + { + test.Printf(_L("error=%d"),r); + test(EFalse); + } + r=TheFs.FileSystemName(newFs,aDrive); + test(r==KErrNone); + test(newFs.Compare(_L("Test"))==0); - r=TheFs.DismountFileSystem(newFs,aDrive); - test(r==KErrNone); + r=TheFs.DismountFileSystem(newFs,aDrive); + test(r==KErrNone); - r=TheFs.MountFileSystem(oldFs,aDrive); - test(r==KErrNone); - } + r=TheFs.MountFileSystem(oldFs,aDrive); + test(r==KErrNone); + } #endif static void TestMountInvalidDrive() // // Attempt to mount FAT on non-local drive - { - test.Start(_L("TestMountInvalidDrive")); + { + test.Start(_L("TestMountInvalidDrive")); - TInt r; + TInt r; - test.Next(_L("Adding EFAT")); + test.Next(_L("Adding EFAT")); #ifdef __WINS__ - _LIT(KFsNm, "EFAT"); + _LIT(KFsNm, "EFAT32"); #else - _LIT(KFsNm, "ELOCAL"); + _LIT(KFsNm, "ELOCAL"); #endif - r = TheFs.AddFileSystem(KFsNm); - test.Printf(_L("afs: r = %d\n"), r); - test(r == KErrNone || r == KErrAlreadyExists); - test.Next(_L("mounting FAT on drive R")); - r = TheFs.MountFileSystem(KFileSystemName_FAT, EDriveR); - test(r == KErrArgument); - - test.End(); - } + r = TheFs.AddFileSystem(KFsNm); + test.Printf(_L("afs: r = %d\n"), r); + test(r == KErrNone || r == KErrAlreadyExists); + test.Next(_L("mounting FAT on drive R")); + r = TheFs.MountFileSystem(KFileSystemName_FAT, EDriveR); + test(r == KErrArgument); + + test.End(); + } // Additional step for INC083446: Corrupted miniSD not detected as corrupted by phone static void TestMountingBrokenMedia(TInt aDrive) // // Mount a new CTestFileSystem on the drive under test // - { - if (aDrive==EDriveC) // ??? Can't test on C: - return; + { + if (aDrive==EDriveC) // ??? Can't test on C: + return; - TBuf<64> b; - TChar c; - TInt r=TheFs.DriveToChar(aDrive,c); - test(r==KErrNone); - TDriveInfo di; - r=TheFs.Drive(di,aDrive); - test(r==KErrNone); - b.Format(_L("Test mounting of test file system on %c: (DrvAtt:%x MedAtt:%x)"),(TUint)c,di.iDriveAtt,di.iMediaAtt); - test.Next(b); + TBuf<64> b; + TChar c; + TInt r=TheFs.DriveToChar(aDrive,c); + test(r==KErrNone); + TDriveInfo di; + r=TheFs.Drive(di,aDrive); + test(r==KErrNone); + b.Format(_L("Test mounting of test file system on %c: (DrvAtt:%x MedAtt:%x)"),(TUint)c,di.iDriveAtt,di.iMediaAtt); + test.Next(b); - test.Next(_L("Test mounting of test file system")); - r=TheFs.AddFileSystem(_L("T_TFSYS2")); - if(r!=KErrNone && r!=KErrAlreadyExists) - { - test.Printf(_L("error=%d"),r); - test(EFalse); - } + test.Next(_L("Test mounting of test file system")); + r=TheFs.AddFileSystem(_L("T_TFSYS2")); + if(r!=KErrNone && r!=KErrAlreadyExists) + { + test.Printf(_L("error=%d"),r); + test(EFalse); + } - TFullName oldFs; - r=TheFs.FileSystemName(oldFs,aDrive); - test(r==KErrNone); - r=TheFs.DismountFileSystem(oldFs,aDrive); - if(r!=KErrNone) - { - test.Printf(_L("Error = %d"),r); - test(EFalse); - } - r=TheFs.MountFileSystem(_L("Test2"),aDrive); - test(r == KErrCorrupt); + TFullName oldFs; + r=TheFs.FileSystemName(oldFs,aDrive); + test(r==KErrNone); + r=TheFs.DismountFileSystem(oldFs,aDrive); + if(r!=KErrNone) + { + test.Printf(_L("Error = %d"),r); + test(EFalse); + } + r=TheFs.MountFileSystem(_L("Test2"),aDrive); + test(r == KErrCorrupt); - TFileName newFs; - r=TheFs.FileSystemName(newFs,aDrive); - test(r==KErrNone); - test(newFs.Compare(_L("Test2"))==0); + TFileName newFs; + r=TheFs.FileSystemName(newFs,aDrive); + test(r==KErrNone); + test(newFs.Compare(_L("Test2"))==0); - // Get the number of remounts by checking the volume attributes - - // T_TFSYS2 hijacks the iBattery member to report back the number of times MountL() has been called - TDriveInfo info; - TInt remounts; - r=TheFs.Drive(info,aDrive); - test(r==KErrNone); - test.Printf(_L("iType=%d,iBattery=%d,iDriveAtt=%x,iMediaAtt=%x\n"),(TUint)info.iType,\ - (TUint)info.iBattery,info.iDriveAtt,info.iMediaAtt); - remounts = (TInt) info.iBattery; - test.Printf(_L("Initial remounts = %d"), remounts); + // Get the number of remounts by checking the volume attributes - + // T_TFSYS2 hijacks the iBattery member to report back the number of times MountL() has been called + TDriveInfo info; + TInt remounts; + r=TheFs.Drive(info,aDrive); + test(r==KErrNone); + test.Printf(_L("iType=%d,iBattery=%d,iDriveAtt=%x,iMediaAtt=%x\n"),(TUint)info.iType,\ + (TUint)info.iBattery,info.iDriveAtt,info.iMediaAtt); + remounts = (TInt) info.iBattery; + test.Printf(_L("Initial remounts = %d"), remounts); - // Make the file server attempt to remount the drive by looking for a non-existant DLL - // The file server should setop trying to remount the driver after KMaxMountFailures attempts - const TInt KMaxMountFailures = 3; // copied from sf_drv.cpp - const TInt KEntryAttempts = 10; - TInt entryAttempts; - for (entryAttempts=0; entryAttempts < KEntryAttempts; entryAttempts++) - { - TEntry entry; - _LIT(KNonExistantFilename, "NONEXISTANT_FILENAME.DLL"); - r = TheFs.Entry(KNonExistantFilename, entry); - test(r == KErrCorrupt); - } - r=TheFs.Drive(info,aDrive); - test(r==KErrNone); - test.Printf(_L("iType=%d,iBattery=%d,iDriveAtt=%x,iMediaAtt=%x\n"),(TUint)info.iType,\ - (TUint)info.iBattery,info.iDriveAtt,info.iMediaAtt); - remounts = (TInt) info.iBattery; - test.Printf(_L("Remounts = %d"), remounts); - test(remounts == KMaxMountFailures); - - // simulate a media change to reset failure count - r = TheFs.RemountDrive(aDrive, NULL, 0); + // Make the file server attempt to remount the drive by looking for a non-existant DLL + // The file server should setop trying to remount the driver after KMaxMountFailures attempts + const TInt KMaxMountFailures = 3; // copied from sf_drv.cpp + const TInt KEntryAttempts = 10; + TInt entryAttempts; + for (entryAttempts=0; entryAttempts < KEntryAttempts; entryAttempts++) + { + TEntry entry; + _LIT(KNonExistantFilename, "NONEXISTANT_FILENAME.DLL"); + r = TheFs.Entry(KNonExistantFilename, entry); + test(r == KErrCorrupt); + } + r=TheFs.Drive(info,aDrive); + test(r==KErrNone); + test.Printf(_L("iType=%d,iBattery=%d,iDriveAtt=%x,iMediaAtt=%x\n"),(TUint)info.iType,\ + (TUint)info.iBattery,info.iDriveAtt,info.iMediaAtt); + remounts = (TInt) info.iBattery; + test.Printf(_L("Remounts = %d"), remounts); + test(remounts == KMaxMountFailures); + + // simulate a media change to reset failure count + r = TheFs.RemountDrive(aDrive, NULL, 0); - // now try mounting again & verify the the file server attempts to mount the drive again - for (entryAttempts=0; entryAttempts < KEntryAttempts; entryAttempts++) - { - TEntry entry; - _LIT(KNonExistantFilename, "NONEXISTANT_FILENAME.DLL"); - r = TheFs.Entry(KNonExistantFilename, entry); - test(r == KErrCorrupt); - } - r=TheFs.Drive(info,aDrive); - test(r==KErrNone); - test.Printf(_L("iType=%d,iBattery=%d,iDriveAtt=%x,iMediaAtt=%x\n"),(TUint)info.iType,\ - (TUint)info.iBattery,info.iDriveAtt,info.iMediaAtt); - remounts = (TInt) info.iBattery; - test.Printf(_L("Remounts = %d"), remounts); - test(remounts == KMaxMountFailures * 2); - + // now try mounting again & verify the the file server attempts to mount the drive again + for (entryAttempts=0; entryAttempts < KEntryAttempts; entryAttempts++) + { + TEntry entry; + _LIT(KNonExistantFilename, "NONEXISTANT_FILENAME.DLL"); + r = TheFs.Entry(KNonExistantFilename, entry); + test(r == KErrCorrupt); + } + r=TheFs.Drive(info,aDrive); + test(r==KErrNone); + test.Printf(_L("iType=%d,iBattery=%d,iDriveAtt=%x,iMediaAtt=%x\n"),(TUint)info.iType,\ + (TUint)info.iBattery,info.iDriveAtt,info.iMediaAtt); + remounts = (TInt) info.iBattery; + test.Printf(_L("Remounts = %d"), remounts); + test(remounts == KMaxMountFailures * 2); + - r=TheFs.DismountFileSystem(newFs,aDrive); - test(r==KErrNone); - r=TheFs.MountFileSystem(oldFs,aDrive); - test(r==KErrNone); - - r=TheFs.RemoveFileSystem(_L("Test2")); - if(r!=KErrNone) - { - test.Printf(_L("error=%d"),r); - test(EFalse); - } - } + r=TheFs.DismountFileSystem(newFs,aDrive); + test(r==KErrNone); + r=TheFs.MountFileSystem(oldFs,aDrive); + test(r==KErrNone); + + r=TheFs.RemoveFileSystem(_L("Test2")); + if(r!=KErrNone) + { + test.Printf(_L("error=%d"),r); + test(EFalse); + } + } /** @@ -363,10 +363,10 @@ TInt nRes; const TInt currDrvNum=CurrentDrive(); - + TDriveInfo drvInfo; - nRes=TheFs.Drive(drvInfo, currDrvNum); - test(nRes==KErrNone); + nRes=TheFs.Drive(drvInfo, currDrvNum); + test(nRes==KErrNone); if(drvInfo.iDriveAtt & (KDriveAttRom | KDriveAttRedirected | KDriveAttSubsted)) { @@ -377,19 +377,19 @@ TMediaSerialNumber serNum; //-- test Media Serial Number on unexisting drive - { - for(TInt drvNum=EDriveA; drvNum<=EDriveZ; ++drvNum) - { - TDriveInfo drvInfo; - if(KErrNone==TheFs.Drive(drvInfo, drvNum) && drvInfo.iType==EMediaNotPresent) - { - // found a non-extant drive, test it... - nRes = TheFs.GetMediaSerialNumber(serNum, drvNum); - test(nRes == KErrNotReady); - break; - } - } - } + { + for(TInt drvNum=EDriveA; drvNum<=EDriveZ; ++drvNum) + { + TDriveInfo drvInfo; + if(KErrNone==TheFs.Drive(drvInfo, drvNum) && drvInfo.iType==EMediaNotPresent) + { + // found a non-extant drive, test it... + nRes = TheFs.GetMediaSerialNumber(serNum, drvNum); + test(nRes == KErrNotReady); + break; + } + } + } nRes = TheFs.GetMediaSerialNumber(serNum, currDrvNum); if(nRes != KErrNone) @@ -423,413 +423,413 @@ //! @SYMTestType CIT //! @SYMPREQ CR0882 //! @SYMTestCaseDesc This test case is testing querying file system sub type name using -//! RFs::QueryVolumeInfoExt() API. -//! @SYMTestActions 1 querys sub type of file system on volumes mounted with 'Fat' file system -//! 2 querys sub type of file system on volumes mounted with 'Lffs' file system -//! 3 querys sub type of file system on volumes mounted with 'rofs' file system -//! 4 querys sub type of file system on volumes mounted with other file systems +//! RFs::QueryVolumeInfoExt() API. +//! @SYMTestActions 1 querys sub type of file system on volumes mounted with 'Fat' file system +//! 2 querys sub type of file system on volumes mounted with 'Lffs' file system +//! 3 querys sub type of file system on volumes mounted with 'rofs' file system +//! 4 querys sub type of file system on volumes mounted with other file systems //! @SYMTestExpectedResults -//! 1 returned error code should be KErrNone, descriptor should match 'FAT12' or 'FAT16' or 'FAT32' -//! 2 returned error code should be KErrNotSupported, descriptor should match 'Lffs' -//! 3 returned error code should be KErrNotSupported, descriptor should match 'rofs' -//! 4 returned error code should be KErrNotSupported, descriptor length should not be zero +//! 1 returned error code should be KErrNone, descriptor should match 'FAT12' or 'FAT16' or 'FAT32' +//! 2 returned error code should be KErrNotSupported, descriptor should match 'Lffs' +//! 3 returned error code should be KErrNotSupported, descriptor should match 'rofs' +//! 4 returned error code should be KErrNotSupported, descriptor length should not be zero //! @SYMTestPriority High //! @SYMTestStatus Implemented //---------------------------------------------------------------------------------------------- static void TestFileSystemSubTypeQuery() - { - test.Next(_L("Test querying sub type of the mounted file system")); - TFSName fsName; - TPckgBuf subName; - TInt i, r; - TDriveInfo driveInfo; - TPckgBuf fDrvSyncBuf; + { + test.Next(_L("Test querying sub type of the mounted file system")); + TFSName fsName; + TPckgBuf subName; + TInt i, r; + TDriveInfo driveInfo; + TPckgBuf fDrvSyncBuf; - for(i = EDriveA; i <= EDriveZ; ++i, subName.Zero()) - { - r = TheFs.FileSystemName(fsName, i); - if (r == KErrNone) - { - test.Printf(_L("Tested on drive: %c.\n"), (char)(i+'A')); - r=TheFs.Drive(driveInfo, i); - test(r==KErrNone); - + for(i = EDriveA; i <= EDriveZ; ++i, subName.Zero()) + { + r = TheFs.FileSystemName(fsName, i); + if (r == KErrNone) + { + test.Printf(_L("Tested on drive: %c.\n"), (char)(i+'A')); + r=TheFs.Drive(driveInfo, i); + test(r==KErrNone); + if (driveInfo.iType==EMediaNotPresent) - { - test.Printf(_L("The media is not present.\n")); + { + test.Printf(_L("The media is not present.\n")); r = TheFs.QueryVolumeInfoExt(i, EFileSystemSubType, subName); - test(r == KErrNone || r == KErrNotReady); + test(r == KErrNone || r == KErrNotReady); } - else if (driveInfo.iType==EMediaCdRom) - { - test.Printf(_L("CD ROM with no media will report not ready!\n")); + else if (driveInfo.iType==EMediaCdRom) + { + test.Printf(_L("CD ROM with no media will report not ready!\n")); r = TheFs.QueryVolumeInfoExt(i, EFileSystemSubType, subName); - test(r == KErrNotReady); - } - else - { - r = TheFs.QueryVolumeInfoExt(i, EFileSystemSubType, subName); - test_KErrNone(r); + test(r == KErrNotReady); + } + else + { + r = TheFs.QueryVolumeInfoExt(i, EFileSystemSubType, subName); + test_KErrNone(r); //-- test EIsDriveSync command r = TheFs.QueryVolumeInfoExt(i, EIsDriveSync, fDrvSyncBuf); - test(r == KErrNone); + test(r == KErrNone); if(fDrvSyncBuf()) test.Printf(_L("The drive is Synchronous.\n")); else test.Printf(_L("The drive is Asynchronous.\n")); //----------------- - + // if Fat, testing returning sub type name - if (fsName.CompareF(KFileSystemName_FAT)==0) - { - test(r == KErrNone); - test(subName().CompareF(KFSSubType_FAT12)==0 || - subName().CompareF(KFSSubType_FAT16)==0 || - subName().CompareF(KFSSubType_FAT32)==0); - continue; - } - - // if Lffs, testing returning file system name - if (fsName.CompareF(_L("Lffs"))==0) - { - test(r == KErrNone); - test(subName().CompareF(_L("Lffs"))==0); - continue; - } - // if rofs, testing returning file system name - if (fsName.CompareF(_L("rofs"))==0) - { - test(r == KErrNone); - test(subName().CompareF(_L("rofs"))==0); - continue; - } - // if Composite, testing returning file system name - if (fsName.CompareF(_L("Composite"))==0) - { - test(r == KErrNone); - test(subName().CompareF(_L("Composite"))==0); - continue; - } + if (fsName.CompareF(KFileSystemName_FAT)==0) + { + test(r == KErrNone); + test(subName().CompareF(KFSSubType_FAT12)==0 || + subName().CompareF(KFSSubType_FAT16)==0 || + subName().CompareF(KFSSubType_FAT32)==0); + continue; + } + + // if Lffs, testing returning file system name + if (fsName.CompareF(_L("Lffs"))==0) + { + test(r == KErrNone); + test(subName().CompareF(_L("Lffs"))==0); + continue; + } + // if rofs, testing returning file system name + if (fsName.CompareF(_L("rofs"))==0) + { + test(r == KErrNone); + test(subName().CompareF(_L("rofs"))==0); + continue; + } + // if Composite, testing returning file system name + if (fsName.CompareF(_L("Composite"))==0) + { + test(r == KErrNone); + test(subName().CompareF(_L("Composite"))==0); + continue; + } - // else - test(r == KErrNone); - test(subName().Length()!=0); - + // else + test(r == KErrNone); + test(subName().Length()!=0); + } - } - } - } + } + } + } //---------------------------------------------------------------------------------------------- //! @SYMTestCaseID PBASE-t_fsys-0318 //! @SYMTestType CIT //! @SYMPREQ CR0882 //! @SYMTestCaseDesc This test case is testing querying file system's cluster size using -//! RFs::QueryVolumeInfoExt() API. -//! @SYMTestActions 1 querys cluster size of file system on volumes mounted with 'Fat' file system -//! 2 querys cluster size of file system on volumes mounted with 'Lffs' file system -//! 3 querys cluster size of file system on volumes mounted with other file systems +//! RFs::QueryVolumeInfoExt() API. +//! @SYMTestActions 1 querys cluster size of file system on volumes mounted with 'Fat' file system +//! 2 querys cluster size of file system on volumes mounted with 'Lffs' file system +//! 3 querys cluster size of file system on volumes mounted with other file systems //! @SYMTestExpectedResults -//! 1 returned error code should be KErrNone, cluster size should be non-zero -//! 2 returned error code should be KErrNone, cluster size should be 512 -//! 3 returned error code should be KErrNone, cluster size should be KErrNotSupported +//! 1 returned error code should be KErrNone, cluster size should be non-zero +//! 2 returned error code should be KErrNone, cluster size should be 512 +//! 3 returned error code should be KErrNone, cluster size should be KErrNotSupported //! @SYMTestPriority High //! @SYMTestStatus Implemented //---------------------------------------------------------------------------------------------- static void TestFileSystemClusterSizeQuery() - { - test.Next(_L("Test querying cluster size information of the mounted file system")); - TFullName fsName; - TPckgBuf ioInfo; - TInt i, r; - TDriveInfo driveInfo; - for(i = EDriveA; i <= EDriveZ; ++i) - { - r = TheFs.FileSystemName(fsName, i); - if (r == KErrNone) - { - test.Printf(_L("Tested on drive: %c.\n"), (char)(i+'A')); + { + test.Next(_L("Test querying cluster size information of the mounted file system")); + TFullName fsName; + TPckgBuf ioInfo; + TInt i, r; + TDriveInfo driveInfo; + for(i = EDriveA; i <= EDriveZ; ++i) + { + r = TheFs.FileSystemName(fsName, i); + if (r == KErrNone) + { + test.Printf(_L("Tested on drive: %c.\n"), (char)(i+'A')); - r=TheFs.Drive(driveInfo, i); - test(r==KErrNone); - // if no media present - if (driveInfo.iType==EMediaNotPresent) - { - r = TheFs.QueryVolumeInfoExt(i, EIOParamInfo, ioInfo); - test(r == KErrNone || r == KErrNotReady); - } - else if (driveInfo.iType==EMediaCdRom) - { - test.Printf(_L("CD ROM with no media!\n")); + r=TheFs.Drive(driveInfo, i); + test(r==KErrNone); + // if no media present + if (driveInfo.iType==EMediaNotPresent) + { + r = TheFs.QueryVolumeInfoExt(i, EIOParamInfo, ioInfo); + test(r == KErrNone || r == KErrNotReady); + } + else if (driveInfo.iType==EMediaCdRom) + { + test.Printf(_L("CD ROM with no media!\n")); + r = TheFs.QueryVolumeInfoExt(i, EIOParamInfo, ioInfo); + test(r == KErrNone || r == KErrNotReady); + } + else + { r = TheFs.QueryVolumeInfoExt(i, EIOParamInfo, ioInfo); - test(r == KErrNone || r == KErrNotReady); - } - else - { - r = TheFs.QueryVolumeInfoExt(i, EIOParamInfo, ioInfo); - test(KErrNone == r); - // if Fat - if (fsName.CompareF(KFileSystemName_FAT)==0) - { - test(ioInfo().iClusterSize != 0); - continue; - } - // else if Lffs - if (fsName.CompareF(_L("Lffs"))==0) - { - TBusLocalDrive drive; - TBool changeFlag = EFalse; - TInt locDriveNumber; - TLocalDriveCaps DriveCaps; - TLocalDriveCapsV7 DriveCapsV7; - for(locDriveNumber = 0; locDriveNumber < KMaxLocalDrives; locDriveNumber++) - { - r = drive.Connect(locDriveNumber,changeFlag); - if(r==KErrNone) - { - - TPckg capsPckg(DriveCaps); - r=drive.Caps(capsPckg); - if((r==KErrNone) && (DriveCaps.iFileSystemId==KDriveFileSysLFFS)) - { - break; - } - drive.Disconnect(); - } - } - TPckg capsPckg(DriveCapsV7); - r=drive.Caps(capsPckg); - test(r==KErrNone); - drive.Disconnect(); - if(DriveCapsV7.iObjectModeSize == 0) - { - test(ioInfo().iClusterSize == 512); - continue; - } - else - { - test((TUint32)(ioInfo().iClusterSize) == DriveCapsV7.iObjectModeSize); - continue; - } - } - // else - //-- we can not suggest anything about unknown filesystem, thus do not check the result. + test(KErrNone == r); + // if Fat + if (fsName.CompareF(KFileSystemName_FAT)==0) + { + test(ioInfo().iClusterSize != 0); + continue; + } + // else if Lffs + if (fsName.CompareF(_L("Lffs"))==0) + { + TBusLocalDrive drive; + TBool changeFlag = EFalse; + TInt locDriveNumber; + TLocalDriveCaps DriveCaps; + TLocalDriveCapsV7 DriveCapsV7; + for(locDriveNumber = 0; locDriveNumber < KMaxLocalDrives; locDriveNumber++) + { + r = drive.Connect(locDriveNumber,changeFlag); + if(r==KErrNone) + { + + TPckg capsPckg(DriveCaps); + r=drive.Caps(capsPckg); + if((r==KErrNone) && (DriveCaps.iFileSystemId==KDriveFileSysLFFS)) + { + break; + } + drive.Disconnect(); + } + } + TPckg capsPckg(DriveCapsV7); + r=drive.Caps(capsPckg); + test(r==KErrNone); + drive.Disconnect(); + if(DriveCapsV7.iObjectModeSize == 0) + { + test(ioInfo().iClusterSize == 512); + continue; + } + else + { + test((TUint32)(ioInfo().iClusterSize) == DriveCapsV7.iObjectModeSize); + continue; + } + } + // else + //-- we can not suggest anything about unknown filesystem, thus do not check the result. //test(ioInfo().iClusterSize == KErrNotSupported); - + } - } - } - } + } + } + } //---------------------------------------------------------------------------------------------- //! @SYMTestCaseID PBASE-t_fsys-0319 //! @SYMTestType CIT //! @SYMPREQ CR0882 //! @SYMTestCaseDesc This test case is testing querying block size of underlying media using -//! RFs::QueryVolumeInfoExt() API. -//! @SYMTestActions 1 querys block size on volumes mounted with MMC card type of media -//! 2 querys block size on volumes mounted with RAM type of media -//! 3 querys block size on volumes mounted with NOR flash type of media -//! 4 querys block size on volumes mounted with Nand flash (code) type of media -//! 5 querys block size on volumes mounted with Nand flash (data) type of media +//! RFs::QueryVolumeInfoExt() API. +//! @SYMTestActions 1 querys block size on volumes mounted with MMC card type of media +//! 2 querys block size on volumes mounted with RAM type of media +//! 3 querys block size on volumes mounted with NOR flash type of media +//! 4 querys block size on volumes mounted with Nand flash (code) type of media +//! 5 querys block size on volumes mounted with Nand flash (data) type of media //! @SYMTestExpectedResults -//! 1 returned error code should be KErrNone, block size should be 512 -//! 2 returned error code should be KErrNone, block size should be KDefaultVolumeBlockSize -//! 3 returned error code should be KErrNone, block size should be KDefaultVolumeBlockSize -//! 4 returned error code should be KErrNone, block size should be 512 -//! 5 returned error code should be KErrNone, block size should be 512 +//! 1 returned error code should be KErrNone, block size should be 512 +//! 2 returned error code should be KErrNone, block size should be KDefaultVolumeBlockSize +//! 3 returned error code should be KErrNone, block size should be KDefaultVolumeBlockSize +//! 4 returned error code should be KErrNone, block size should be 512 +//! 5 returned error code should be KErrNone, block size should be 512 //! @SYMTestPriority High //! @SYMTestStatus Implemented //---------------------------------------------------------------------------------------------- static void TestMediaBlockSizeQuery() - { - test.Next(_L("Test querying block size information of the underlying media")); - #if defined(__WINS__) - test.Printf(_L("This test case runs on hardware only")); - return; - - #else // test runs on hardware only. - TFSName fsName; - TPckgBuf ioInfo; - TInt i, r; - TDriveInfo driveInfo; - for(i = EDriveA; i <= EDriveZ; ++i) - { - r = TheFs.FileSystemName(fsName, i); - if (r == KErrNone) - { - test.Printf(_L("Tested on drive: %c.\n"), (char)(i+'A')); - r=TheFs.Drive(driveInfo, i); - test(r==KErrNone); - // if no media present - if (driveInfo.iType==EMediaNotPresent) - { - r = TheFs.QueryVolumeInfoExt(i, EIOParamInfo, ioInfo); - test(r == KErrNone || r == KErrNotReady); - } - else if (driveInfo.iType==EMediaCdRom) - { - test.Printf(_L("CD ROM with no media will report not ready!\n")); + { + test.Next(_L("Test querying block size information of the underlying media")); + #if defined(__WINS__) + test.Printf(_L("This test case runs on hardware only")); + return; + + #else // test runs on hardware only. + TFSName fsName; + TPckgBuf ioInfo; + TInt i, r; + TDriveInfo driveInfo; + for(i = EDriveA; i <= EDriveZ; ++i) + { + r = TheFs.FileSystemName(fsName, i); + if (r == KErrNone) + { + test.Printf(_L("Tested on drive: %c.\n"), (char)(i+'A')); + r=TheFs.Drive(driveInfo, i); + test(r==KErrNone); + // if no media present + if (driveInfo.iType==EMediaNotPresent) + { + r = TheFs.QueryVolumeInfoExt(i, EIOParamInfo, ioInfo); + test(r == KErrNone || r == KErrNotReady); + } + else if (driveInfo.iType==EMediaCdRom) + { + test.Printf(_L("CD ROM with no media will report not ready!\n")); + r = TheFs.QueryVolumeInfoExt(i, EIOParamInfo, ioInfo); + test(r == KErrNotReady); + } + else + { r = TheFs.QueryVolumeInfoExt(i, EIOParamInfo, ioInfo); - test(r == KErrNotReady); - } - else - { - r = TheFs.QueryVolumeInfoExt(i, EIOParamInfo, ioInfo); - test(KErrNone == r); - // if MMC, test block size >= 512; - // (Version 4.3 MMC cards introduce the concept of a "Super Page" which should be used as - // guide when calculating the cluster size. For these cards the reported block size may be - // any multiple of 512). - if ((driveInfo.iType == EMediaHardDisk) && - (driveInfo.iDriveAtt & KDriveAttRemovable) && - (driveInfo.iDriveAtt & KDriveAttLocal)) - { - test(ioInfo().iBlockSize >= 512); - continue; - } - // if RAM, test block size == 1; - if ((driveInfo.iType == EMediaRam) && - (driveInfo.iDriveAtt & KDriveAttLocal) && - (driveInfo.iDriveAtt & KDriveAttInternal)) - { - test(ioInfo().iBlockSize == 1); - continue; - } - // if NOR flash, test block size == 512 (default block size); - if ((driveInfo.iType == EMediaFlash) && - (driveInfo.iDriveAtt & KDriveAttLocal) && - (driveInfo.iDriveAtt & KDriveAttInternal)) - { - TBusLocalDrive drive; - TBool changeFlag = EFalse; - TInt locDriveNumber; - TLocalDriveCaps DriveCaps; - TLocalDriveCapsV7 DriveCapsV7; - for(locDriveNumber = 0; locDriveNumber < KMaxLocalDrives; locDriveNumber++) - { - r = drive.Connect(locDriveNumber,changeFlag); - if(r==KErrNone) - { - TPckg capsPckg(DriveCaps); - r=drive.Caps(capsPckg); - if((r==KErrNone) && (DriveCaps.iFileSystemId==KDriveFileSysLFFS)) - { - break; - } - drive.Disconnect(); - } - } - TPckg capsPckg(DriveCapsV7); - r=drive.Caps(capsPckg); - test(r==KErrNone); - if ((fsName.CompareF(_L("Lffs"))==0) && (DriveCapsV7.iObjectModeSize != 0)) - { - test(ioInfo().iBlockSize == (TInt) DriveCapsV7.iObjectModeSize); - continue; - } - else - { - test(ioInfo().iBlockSize == (TInt) KDefaultVolumeBlockSize); - continue; - } - } - // if Nand flash (with Fat file system), test block size == 512 (small-block) or 2048 (large-block) - if ((driveInfo.iType == EMediaNANDFlash) && - (driveInfo.iDriveAtt & KDriveAttLocal) && - (driveInfo.iDriveAtt & KDriveAttInternal)) - { - test(ioInfo().iBlockSize == 512 || ioInfo().iBlockSize == 2048); - continue; - } - } - } - } - #endif // __WINS__ - } + test(KErrNone == r); + // if MMC, test block size >= 512; + // (Version 4.3 MMC cards introduce the concept of a "Super Page" which should be used as + // guide when calculating the cluster size. For these cards the reported block size may be + // any multiple of 512). + if ((driveInfo.iType == EMediaHardDisk) && + (driveInfo.iDriveAtt & KDriveAttRemovable) && + (driveInfo.iDriveAtt & KDriveAttLocal)) + { + test(ioInfo().iBlockSize >= 512); + continue; + } + // if RAM, test block size == 1; + if ((driveInfo.iType == EMediaRam) && + (driveInfo.iDriveAtt & KDriveAttLocal) && + (driveInfo.iDriveAtt & KDriveAttInternal)) + { + test(ioInfo().iBlockSize == 1); + continue; + } + // if NOR flash, test block size == 512 (default block size); + if ((driveInfo.iType == EMediaFlash) && + (driveInfo.iDriveAtt & KDriveAttLocal) && + (driveInfo.iDriveAtt & KDriveAttInternal)) + { + TBusLocalDrive drive; + TBool changeFlag = EFalse; + TInt locDriveNumber; + TLocalDriveCaps DriveCaps; + TLocalDriveCapsV7 DriveCapsV7; + for(locDriveNumber = 0; locDriveNumber < KMaxLocalDrives; locDriveNumber++) + { + r = drive.Connect(locDriveNumber,changeFlag); + if(r==KErrNone) + { + TPckg capsPckg(DriveCaps); + r=drive.Caps(capsPckg); + if((r==KErrNone) && (DriveCaps.iFileSystemId==KDriveFileSysLFFS)) + { + break; + } + drive.Disconnect(); + } + } + TPckg capsPckg(DriveCapsV7); + r=drive.Caps(capsPckg); + test(r==KErrNone); + if ((fsName.CompareF(_L("Lffs"))==0) && (DriveCapsV7.iObjectModeSize != 0)) + { + test(ioInfo().iBlockSize == (TInt) DriveCapsV7.iObjectModeSize); + continue; + } + else + { + test(ioInfo().iBlockSize == (TInt) KDefaultVolumeBlockSize); + continue; + } + } + // if Nand flash (with Fat file system), test block size == 512 (small-block) or 2048 (large-block) + if ((driveInfo.iType == EMediaNANDFlash) && + (driveInfo.iDriveAtt & KDriveAttLocal) && + (driveInfo.iDriveAtt & KDriveAttInternal)) + { + test(ioInfo().iBlockSize == 512 || ioInfo().iBlockSize == 2048); + continue; + } + } + } + } + #endif // __WINS__ + } //---------------------------------------------------------------------------------------------- //! @SYMTestCaseID PBASE-t_fsys-0320 //! @SYMTestType CIT //! @SYMPREQ CR0882 //! @SYMTestCaseDesc This test case is testing wrapper API RFs::FileSystemSubType() has the same -//! behaviours as RFs::QueryVolumeInfoExt() -//! @SYMTestActions 1 querys file system sub type name by both APIs +//! behaviours as RFs::QueryVolumeInfoExt() +//! @SYMTestActions 1 querys file system sub type name by both APIs //! @SYMTestExpectedResults -//! 1 returned error codes and descriptors of both API should be identical +//! 1 returned error codes and descriptors of both API should be identical //! @SYMTestPriority High //! @SYMTestStatus Implemented //---------------------------------------------------------------------------------------------- static void TestFileSystemSubType() - { - test.Next(_L("Test wrapper API RFs::FileSystemSubType()'s behaviour")); - TFSName fsName; - TPckgBuf subName; - TInt r; - TFSName subName1; - TInt r1; - - for(TInt i = EDriveA; i <= EDriveZ; ++i) - { - r = TheFs.FileSystemName(fsName, i); - if (r == KErrNone) - { - test.Printf(_L("Tested on drive: %c.\n"), (char)(i+'A')); - r = TheFs.QueryVolumeInfoExt(i, EFileSystemSubType, subName); - r1 = TheFs.FileSystemSubType(i, subName1); - test(r==r1); - if (subName().Length()) - { - test(subName().CompareF(subName1)==0); - } - else - { - test(subName1.Length()==0); - } - } - } - } + { + test.Next(_L("Test wrapper API RFs::FileSystemSubType()'s behaviour")); + TFSName fsName; + TPckgBuf subName; + TInt r; + TFSName subName1; + TInt r1; + + for(TInt i = EDriveA; i <= EDriveZ; ++i) + { + r = TheFs.FileSystemName(fsName, i); + if (r == KErrNone) + { + test.Printf(_L("Tested on drive: %c.\n"), (char)(i+'A')); + r = TheFs.QueryVolumeInfoExt(i, EFileSystemSubType, subName); + r1 = TheFs.FileSystemSubType(i, subName1); + test(r==r1); + if (subName().Length()) + { + test(subName().CompareF(subName1)==0); + } + else + { + test(subName1.Length()==0); + } + } + } + } //---------------------------------------------------------------------------------------------- //! @SYMTestCaseID PBASE-t_fsys-0321 //! @SYMTestType CIT //! @SYMPREQ CR0882 //! @SYMTestCaseDesc This test case is testing wrapper API RFs::VolumeIOParam() has the same -//! behaviours as RFs::QueryVolumeInfoExt() -//! @SYMTestActions 1 querys volume IO params by both APIs +//! behaviours as RFs::QueryVolumeInfoExt() +//! @SYMTestActions 1 querys volume IO params by both APIs //! @SYMTestExpectedResults -//! 1 returned error codes and IO param values of both API should be identical +//! 1 returned error codes and IO param values of both API should be identical //! @SYMTestPriority High //! @SYMTestStatus Implemented //---------------------------------------------------------------------------------------------- static void TestVolumeIOParam() - { - test.Next(_L("Test wrapper API RFs::VolumeIOParam()'s behaviour")); - TFSName fsName; - TPckgBuf ioInfo; - TInt r; - TVolumeIOParamInfo ioInfo1; - TInt r1; - - for(TInt i = EDriveA; i <= EDriveZ; ++i) - { - r = TheFs.FileSystemName(fsName, i); - if (r == KErrNone) - { - test.Printf(_L("Tested on drive: %c.\n"), (char)(i+'A')); - r = TheFs.QueryVolumeInfoExt(i, EIOParamInfo, ioInfo); - r1 = TheFs.VolumeIOParam(i, ioInfo1); - test(r==r1); - test(ioInfo().iBlockSize == ioInfo1.iBlockSize); - test(ioInfo().iClusterSize == ioInfo1.iClusterSize); - test(ioInfo().iRecReadBufSize == ioInfo1.iRecReadBufSize); - test(ioInfo().iRecWriteBufSize == ioInfo1.iRecWriteBufSize); - } - } - } + { + test.Next(_L("Test wrapper API RFs::VolumeIOParam()'s behaviour")); + TFSName fsName; + TPckgBuf ioInfo; + TInt r; + TVolumeIOParamInfo ioInfo1; + TInt r1; + + for(TInt i = EDriveA; i <= EDriveZ; ++i) + { + r = TheFs.FileSystemName(fsName, i); + if (r == KErrNone) + { + test.Printf(_L("Tested on drive: %c.\n"), (char)(i+'A')); + r = TheFs.QueryVolumeInfoExt(i, EIOParamInfo, ioInfo); + r1 = TheFs.VolumeIOParam(i, ioInfo1); + test(r==r1); + test(ioInfo().iBlockSize == ioInfo1.iBlockSize); + test(ioInfo().iClusterSize == ioInfo1.iClusterSize); + test(ioInfo().iRecReadBufSize == ioInfo1.iRecReadBufSize); + test(ioInfo().iRecWriteBufSize == ioInfo1.iRecWriteBufSize); + } + } + } //---------------------------------------------------------------------------------------------- @@ -837,73 +837,73 @@ //! @SYMTestType CIT //! @SYMPREQ CR0882 //! @SYMTestCaseDesc This test case is testing RFs::QueryVolumeInfoExt() API on a testing file system -//! @SYMTestActions 0 mounts testing file system on a certain drive -//! 1 querys file system's sub type name on the drive under testing -//! 2 querys file system's cluster size on the drive under testing +//! @SYMTestActions 0 mounts testing file system on a certain drive +//! 1 querys file system's sub type name on the drive under testing +//! 2 querys file system's cluster size on the drive under testing //! @SYMTestExpectedResults -//! 1 returned error code should be KErrNone, sub type name should match 'Test3SubType' -//! 2 returned error code should be KErrNone, cluster size should equal 1024 +//! 1 returned error code should be KErrNone, sub type name should match 'Test3SubType' +//! 2 returned error code should be KErrNone, cluster size should equal 1024 //! @SYMTestPriority High //! @SYMTestStatus Implemented //---------------------------------------------------------------------------------------------- static void TestQueryVolumeInfoExtOnTestFS(TInt aDrive) - { - if (aDrive==EDriveC) // Can't test on C: - return; + { + if (aDrive==EDriveC) // Can't test on C: + return; - TInt r; + TInt r; - test.Printf(_L("Tested on drive: %c.\n"), (char)(aDrive+'A')); + test.Printf(_L("Tested on drive: %c.\n"), (char)(aDrive+'A')); - // Mount a new CTestFileSystem on the drive under test - test.Next(_L("Test RFs::QueryVolumeInfoExt() on Testing File System")); - r = TheFs.AddFileSystem(_L("T_TFSYS3")); - if (r != KErrNone && r != KErrAlreadyExists) - { - test.Printf(_L("error=%d"),r); - test(EFalse); - } - TFSName oldFs; - r = TheFs.FileSystemName(oldFs,aDrive); - test(r==KErrNone); - r = TheFs.DismountFileSystem(oldFs,aDrive); - if (r != KErrNone) - { - test.Printf(_L("Error = %d"),r); - test(EFalse); - } - r = TheFs.MountFileSystem(_L("Test3"),aDrive); - test(r==KErrNone); - TFSName newFs; - r = TheFs.FileSystemName(newFs,aDrive); - test(r==KErrNone); - test(newFs.Compare(_L("Test3"))==0); + // Mount a new CTestFileSystem on the drive under test + test.Next(_L("Test RFs::QueryVolumeInfoExt() on Testing File System")); + r = TheFs.AddFileSystem(_L("T_TFSYS3")); + if (r != KErrNone && r != KErrAlreadyExists) + { + test.Printf(_L("error=%d"),r); + test(EFalse); + } + TFSName oldFs; + r = TheFs.FileSystemName(oldFs,aDrive); + test(r==KErrNone); + r = TheFs.DismountFileSystem(oldFs,aDrive); + if (r != KErrNone) + { + test.Printf(_L("Error = %d"),r); + test(EFalse); + } + r = TheFs.MountFileSystem(_L("Test3"),aDrive); + test(r==KErrNone); + TFSName newFs; + r = TheFs.FileSystemName(newFs,aDrive); + test(r==KErrNone); + test(newFs.Compare(_L("Test3"))==0); - // Sub type name query: - TPckgBuf subNameP; - r = TheFs.QueryVolumeInfoExt(aDrive, EFileSystemSubType, subNameP); - test(r==KErrNone); - test(subNameP() == _L("Test3SubType")); + // Sub type name query: + TPckgBuf subNameP; + r = TheFs.QueryVolumeInfoExt(aDrive, EFileSystemSubType, subNameP); + test(r==KErrNone); + test(subNameP() == _L("Test3SubType")); - // Cluster size querys: - TPckgBuf ioInfoP; - r = TheFs.QueryVolumeInfoExt(aDrive, EIOParamInfo, ioInfoP); - test(r==KErrNone); - test(ioInfoP().iClusterSize==1024); + // Cluster size querys: + TPckgBuf ioInfoP; + r = TheFs.QueryVolumeInfoExt(aDrive, EIOParamInfo, ioInfoP); + test(r==KErrNone); + test(ioInfoP().iClusterSize==1024); - // Mount the original file system back - r=TheFs.DismountFileSystem(newFs,aDrive); - test(r==KErrNone); - r=TheFs.MountFileSystem(oldFs,aDrive); - test(r==KErrNone); - - r=TheFs.RemoveFileSystem(_L("Test3")); - if(r!=KErrNone) - { - test.Printf(_L("error=%d"),r); - test(EFalse); - } - } + // Mount the original file system back + r=TheFs.DismountFileSystem(newFs,aDrive); + test(r==KErrNone); + r=TheFs.MountFileSystem(oldFs,aDrive); + test(r==KErrNone); + + r=TheFs.RemoveFileSystem(_L("Test3")); + if(r!=KErrNone) + { + test.Printf(_L("error=%d"),r); + test(EFalse); + } + } //---------------------------------------------------------------------------------------------- @@ -984,9 +984,9 @@ //---------------------------------------------------------------------------------------------- static void TestFileSystem_MaxSupportedFileSizeQuery() { - test.Next(_L("Test querying max. supported file size on this file system")); - TFullName fsName; - TPckgBuf ioInfo; + test.Next(_L("Test querying max. supported file size on this file system")); + TFullName fsName; + TPckgBuf ioInfo; TVolumeIOParamInfo& volInfo = ioInfo(); const TInt drvNo=CurrentDrive(); @@ -1019,51 +1019,51 @@ // // Do all tests // - { + { //-- set up console output Fat_Test_Utils::SetConsole(test.Console()); - TInt drive=CurrentDrive(); + TInt drive=CurrentDrive(); PrintDrvInfo(TheFs, drive); - //Do not run this test on the NAND drive, as - //this has the FTL mounted as a primary extension - //which causes the test to fail - #if defined(__WINS__) - if (drive==EDriveU) - return; - #else - TDriveInfo driveInfo; - TheFs.Drive(driveInfo,drive); - if (driveInfo.iType == EMediaNANDFlash) - { - return; - } - #endif + //Do not run this test on the NAND drive, as + //this has the FTL mounted as a primary extension + //which causes the test to fail + #if defined(__WINS__) + if (drive==EDriveU) + return; + #else + TDriveInfo driveInfo; + TheFs.Drive(driveInfo,drive); + if (driveInfo.iType == EMediaNANDFlash) + { + return; + } + #endif //--------------------------------------- - TestFileSystemNames(); - TestDismountFileSystem(CurrentDrive()); + TestFileSystemNames(); + TestDismountFileSystem(CurrentDrive()); #if defined(__EPOC32__) - TestFileSystem(CurrentDrive()); + TestFileSystem(CurrentDrive()); #endif - TestMountInvalidDrive(); - - TestMountingBrokenMedia(CurrentDrive()); + TestMountInvalidDrive(); + + TestMountingBrokenMedia(CurrentDrive()); TestSubstDriveMediaSerialNumber(); - TestFileSystemSubTypeQuery(); - TestFileSystemClusterSizeQuery(); - TestMediaBlockSizeQuery(); - TestFileSystemSubType(); - TestVolumeIOParam(); - TestQueryVolumeInfoExtOnTestFS(CurrentDrive()); + TestFileSystemSubTypeQuery(); + TestFileSystemClusterSizeQuery(); + TestMediaBlockSizeQuery(); + TestFileSystemSubType(); + TestVolumeIOParam(); + TestQueryVolumeInfoExtOnTestFS(CurrentDrive()); - TestFileSystem_MaxSupportedFileSizeQuery(); + TestFileSystem_MaxSupportedFileSizeQuery(); TestRemountFSWithOpenedObjects(); diff -r 56f325a607ea -r 0173bcd7697c kerneltest/f32test/server/t_localeutils_cp932.cpp --- a/kerneltest/f32test/server/t_localeutils_cp932.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/f32test/server/t_localeutils_cp932.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -22,6 +22,7 @@ #include #include #include +#include #include "..\server\t_server.h" #include "fat_utils.h" diff -r 56f325a607ea -r 0173bcd7697c kerneltest/f32test/server/t_pwstr.cpp --- a/kerneltest/f32test/server/t_pwstr.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/f32test/server/t_pwstr.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -22,6 +22,7 @@ #include #include #include +#include // define this macro to autodetect card re-insertion #define __AUTO_DETECT_MEDIA_CHANGE__ diff -r 56f325a607ea -r 0173bcd7697c kerneltest/f32test/server/t_rename.cpp --- a/kerneltest/f32test/server/t_rename.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/f32test/server/t_rename.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -18,20 +18,12 @@ #include #include #include "t_server.h" - -#if defined(__WINS__) -#define WIN32_LEAN_AND_MEAN -#pragma warning (disable:4201) // warning C4201: nonstandard extension used : nameless struct/union -#pragma warning (default:4201) // warning C4201: nonstandard extension used : nameless struct/union -#endif +#include "f32_test_utils.h" -#if defined(_UNICODE) -#if !defined(UNICODE) -#define UNICODE -#endif -#endif +using namespace F32_Test_Utils; +TInt gDriveNum = -1; -GLDEF_D RTest test(_L("T_RENAME")); +RTest test(_L("T_RENAME")); TBuf8<26> alphaBuffer=_L8("ABCDEFGHIJKLMNOPQRSTUVWXYZ"); TPtr8 alphaPtr((TText8*)alphaBuffer.Ptr(),alphaBuffer.Size(),alphaBuffer.Size()); @@ -39,17 +31,8 @@ TBuf8<17> BeckBuffer=_L8("A Devil's Haircut"); TPtr8 BeckPtr((TText8*)BeckBuffer.Ptr(),BeckBuffer.Size(),BeckBuffer.Size()); -/* - What this test is for: - Tests bug fix for the bug which created two files of the same name - -*/ - -LOCAL_C void CreateTestFiles() -// -// -// +static void CreateTestFiles() { test.Next(_L("Create test files")); TInt r=TheFs.MkDir(_L("\\F32-TST\\")); @@ -79,31 +62,14 @@ file.Close(); } -/* -LOCAL_C void CleanUp() -// -// Delete any files created by the tests -// - { - TInt r=TheFs.Delete(_L("\\F32-TST\\TESTFILE")); - test(r==KErrNone); - r=TheFs.Delete(_L("\\F32-TST\\RFSFILE")); - test(r==KErrNone); - r=TheFs.Delete(_L("\\F32-TST\\EIKFILE")); - test(r==KErrNone); - r=TheFs.Delete(_L("\\F32-TST\\TEST")); - test(r==KErrNone); - r=TheFs.RmDir(_L("\\F32-TST\\SYSTEM\\")); - test(r==KErrNone); - } -*/ -LOCAL_C TInt CountFiles(TPtrC aDirectory, TPtrC aFileName) +static TInt CountFiles(TPtrC aDirectory, TPtrC aFileName) // // Return the number of files of aFileName found in aDirectory // { - RDir dir; + + RDir dir; TFileName sessionPath; TInt r=TheFs.SessionPath(sessionPath); test(r==KErrNone); @@ -140,7 +106,7 @@ return(fileCount); } -LOCAL_C void TestRFileRename() +static void TestRFileRename() // // Test RFile::Rename() function // @@ -168,7 +134,7 @@ } -LOCAL_C void TestRFsRename() +static void TestRFsRename() // // Test RFs::Rename() function // @@ -190,7 +156,7 @@ file.Close(); } -LOCAL_C void TestEikonRename() +static void TestEikonRename() // // Test EIKON style rename by creating a new file, and copying old data into new file // @@ -219,7 +185,7 @@ } -LOCAL_C void TestReplaceAndRename() +static void TestReplaceAndRename() // // Tests the bug which allows 2 files of the same name to be created has been fixed // @@ -428,37 +394,43 @@ test(fileCount==0); test(r==KErrNone); -// Clean up - RFormat format; - TInt count; - TFileName sessionPath; - r=TheFs.SessionPath(sessionPath); - r=format.Open(TheFs,sessionPath,EQuickFormat,count); - if (r == KErrAccessDenied) - return; - test(r==KErrNone); - while(count && r==KErrNone) - r=format.Next(count); - format.Close(); } -GLDEF_C void CallTestsL(void) -// -// Do all tests -// +void CallTestsL(void) { test.Title(); test.Start(_L("Testing rename")); - TheFs.MkDir(_L("\\F32-TST\\SYSTEM\\")); + //-- set up console output + F32_Test_Utils::SetConsole(test.Console()); + + TInt nRes=TheFs.CharToDrive(gDriveToTest, gDriveNum); + test(nRes==KErrNone); + + PrintDrvInfo(TheFs, gDriveNum); + + if(!Is_Win32(TheFs, gDriveNum)) + { + nRes = FormatDrive(TheFs, gDriveNum, ETrue); + test(nRes==KErrNone); + } + + + MakeDir(_L("\\F32-TST\\SYSTEM\\")); CreateTestFiles(); TestRFsRename(); TestRFileRename(); TestEikonRename(); TestReplaceAndRename(); + if(!Is_Win32(TheFs, gDriveNum)) + { + nRes = FormatDrive(TheFs, gDriveNum, ETrue); + test(nRes==KErrNone); + } + test.End(); test.Close(); } diff -r 56f325a607ea -r 0173bcd7697c kerneltest/f32test/server/t_sysbin.cpp --- a/kerneltest/f32test/server/t_sysbin.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/f32test/server/t_sysbin.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -18,6 +18,8 @@ #define __E32TEST_EXTENSION__ #include #include +#include +#include _LIT(KCheckFailed,"Check failed %d != %d\n"); diff -r 56f325a607ea -r 0173bcd7697c kerneltest/f32test/shostmassstorage/msman/app/cdisplay.cpp --- a/kerneltest/f32test/shostmassstorage/msman/app/cdisplay.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/f32test/shostmassstorage/msman/app/cdisplay.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -410,11 +410,11 @@ { // Append battery, media and drive information to aBuffer // Define descriptor constants using the _LIT macro - _LIT(KDriveInfo1, "iType=%02x iDriveAtt=%02x"); - _LIT(KDriveInfo2, "iBattery=%02x iMediaAtt=%02x"); - _LIT(KBatLow,"Battery low"); - _LIT(KBatGood,"Battery good"); - _LIT(KBatNotSupported,"Battery not supported"); + _LIT(KDriveInfo1, "iType=%02x %02x iDriveAtt=%04x"); + _LIT(KDriveInfo2, "iMediaAtt=%02x"); + _LIT(KConnectionBusInternal,"Connection Bus Internal"); + _LIT(KConnectionBusUsb,"Connection Bus USB"); + _LIT(KConnectionBusUnknown,"Connection Bus Unknown"); _LIT(KNotPresent,"No media present"); _LIT(KFloppy,"Media is floppy disk"); _LIT(KHard,"Media is hard disk"); @@ -423,8 +423,9 @@ _LIT(KFlash,"Media is flash"); _LIT(KRom,"Media is ROM"); _LIT(KRemote,"Media is remote"); + _LIT(KExternal,"Media is external"); _LIT(KNANDFlash,"Media is NAND flash"); - _LIT(KUnknown,"Media unknownl"); + _LIT(KUnknown,"Media unknown"); _LIT(KDriveAtts,"Drive attributes:"); _LIT(KLocal," local"); _LIT(KROMDrive," ROM"); @@ -443,22 +444,22 @@ TLine* line; line = iScrollWindow->NewLineL(); - line->Format(KDriveInfo1, TInt(aDriveInfo.iType), TInt(aDriveInfo.iDriveAtt)); + line->Format(KDriveInfo1, TInt(aDriveInfo.iType), TInt(aDriveInfo.iConnectionBusType), TInt(aDriveInfo.iDriveAtt)); line = iScrollWindow->NewLineL(); - line->Format(KDriveInfo2, TInt(aDriveInfo.iBattery), TInt(aDriveInfo.iMediaAtt)); + line->Format(KDriveInfo2, TInt(aDriveInfo.iMediaAtt)); line = iScrollWindow->NewLineL(); - switch (aDriveInfo.iBattery) + switch (aDriveInfo.iConnectionBusType) { - case EBatLow: - line->Append(KBatLow); + case EConnectionBusInternal: + line->Append(KConnectionBusInternal); break; - case EBatGood: - line->Append(KBatGood); + case EConnectionBusUsb: + line->Append(KConnectionBusUsb); break; default: - line->Append(KBatNotSupported); + line->Append(KConnectionBusUnknown); } line = iScrollWindow->NewLineL(); @@ -493,7 +494,6 @@ break; default: line->Append(KUnknown); - } // Drive Attributes @@ -529,6 +529,11 @@ line = iScrollWindow->NewLineL(); line->Append(KRemovable); } + if (aDriveInfo.iDriveAtt & KDriveAttExternal) + { + line = iScrollWindow->NewLineL(); + line->Append(KExternal); + } // Media Attributes line = iScrollWindow->NewLineL(); diff -r 56f325a607ea -r 0173bcd7697c kerneltest/f32test/shostmassstorage/msman/test/t_msman.cpp --- a/kerneltest/f32test/shostmassstorage/msman/test/t_msman.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/f32test/shostmassstorage/msman/test/t_msman.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -20,6 +20,7 @@ #include #include #include +#define __E32TEST_EXTENSION__ #include #include "tmsprintdrive.h" @@ -30,10 +31,20 @@ RTest test(_L("T_MSMAN")); RFs fsSession; - +extern CMsDrive msDrive; void DriveTestL() { + test.Start(_L("Check USB drive attributes\n")); + TInt driveNumber = msDrive.DriveNumber(); + + // Check drive Info is USB Mass Storage + TDriveInfo driveInfo; + fsSession.Drive(driveInfo, driveNumber); + + test_Equal(driveInfo.iConnectionBusType, EConnectionBusUsb); + test_Value(driveInfo.iDriveAtt & KDriveAttExternal, KDriveAttExternal); + test.End(); } diff -r 56f325a607ea -r 0173bcd7697c kerneltest/f32test/shostmassstorage/msman/test/tmsprintdrive.cpp --- a/kerneltest/f32test/shostmassstorage/msman/test/tmsprintdrive.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/f32test/shostmassstorage/msman/test/tmsprintdrive.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -28,10 +28,10 @@ { // Append battery, media and drive information to aBuffer // Define descriptor constants using the _LIT macro - _LIT(KFormatString,"Type=0x%02x,Battery=0x%02x,DriveAtt=0x%02x,MediaAtt=0x%02x\r\n"); - _LIT(KBatLow,"Battery low\r\n"); - _LIT(KBatGood,"Battery good\r\n"); - _LIT(KBatNotSupported,"Battery not supported\r\n"); + _LIT(KFormatString,"Type=0x%02x,Connection Bus=0x%02x,DriveAtt=0x%02x,MediaAtt=0x%02x\r\n"); + _LIT(KConnectionBusInternal,"Connection Bus is Internal\r\n"); + _LIT(KConnectionBusUsb,"Connection Bus is USB\r\n"); + _LIT(KConnectionBusUnknown,"Connection Bus is Unknown\r\n"); _LIT(KNotPresent,"No media present\r\n"); _LIT(KFloppy,"Media is floppy disk\r\n"); _LIT(KHard,"Media is hard disk\r\n"); @@ -49,6 +49,7 @@ _LIT(KSubstituted," substituted"); _LIT(KInternal," internal"); _LIT(KRemovable," removable"); + _LIT(KExternal," external"); _LIT(KMediaAtts,"\r\nMedia attributes:"); _LIT(KDynamic," dynamic"); _LIT(KDual," dual-density"); @@ -60,20 +61,20 @@ _LIT(KNewLine,"\r\n"); aBuffer.AppendFormat(KFormatString, TInt(aDriveInfo.iType), - TInt(aDriveInfo.iBattery), + TInt(aDriveInfo.iConnectionBusType), TInt(aDriveInfo.iDriveAtt), TInt(aDriveInfo.iMediaAtt)); - switch (aDriveInfo.iBattery) + switch (aDriveInfo.iConnectionBusType) { - case EBatLow: - aBuffer.Append(KBatLow); + case EConnectionBusInternal: + aBuffer.Append(KConnectionBusInternal); break; - case EBatGood: - aBuffer.Append(KBatGood); + case EConnectionBusUsb: + aBuffer.Append(KConnectionBusUsb); break; default: - aBuffer.Append(KBatNotSupported); + aBuffer.Append(KConnectionBusUnknown); } switch (aDriveInfo.iType) @@ -122,6 +123,8 @@ aBuffer.Append(KInternal); if (aDriveInfo.iDriveAtt & KDriveAttRemovable) aBuffer.Append(KRemovable); + if (aDriveInfo.iDriveAtt & KDriveAttExternal) + aBuffer.Append(KExternal); aBuffer.Append(KMediaAtts); if (aDriveInfo.iMediaAtt & KMediaAttVariableSize) aBuffer.Append(KDynamic); diff -r 56f325a607ea -r 0173bcd7697c kerneltest/f32test/smassstorage/scripts/usbinterop1.pl --- a/kerneltest/f32test/smassstorage/scripts/usbinterop1.pl Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/f32test/smassstorage/scripts/usbinterop1.pl Thu Jan 07 13:38:45 2010 +0200 @@ -2,7 +2,7 @@ # Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). # All rights reserved. # This component and the accompanying materials are made available -# under the terms of "Eclipse Public License v1.0"" +# under the terms of the License "Eclipse Public License v1.0" # which accompanies this distribution, and is available # at the URL "http://www.eclipse.org/legal/epl-v10.html". # diff -r 56f325a607ea -r 0173bcd7697c kerneltest/f32test/smassstorage/scripts/usbinterop2.pl --- a/kerneltest/f32test/smassstorage/scripts/usbinterop2.pl Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/f32test/smassstorage/scripts/usbinterop2.pl Thu Jan 07 13:38:45 2010 +0200 @@ -2,7 +2,7 @@ # Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). # All rights reserved. # This component and the accompanying materials are made available -# under the terms of "Eclipse Public License v1.0"" +# under the terms of the License "Eclipse Public License v1.0" # which accompanies this distribution, and is available # at the URL "http://www.eclipse.org/legal/epl-v10.html". # diff -r 56f325a607ea -r 0173bcd7697c kerneltest/f32test/smassstorage/scripts/usbperformance.pl --- a/kerneltest/f32test/smassstorage/scripts/usbperformance.pl Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/f32test/smassstorage/scripts/usbperformance.pl Thu Jan 07 13:38:45 2010 +0200 @@ -2,7 +2,7 @@ # Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). # All rights reserved. # This component and the accompanying materials are made available -# under the terms of "Eclipse Public License v1.0"" +# under the terms of the License "Eclipse Public License v1.0" # which accompanies this distribution, and is available # at the URL "http://www.eclipse.org/legal/epl-v10.html". # diff -r 56f325a607ea -r 0173bcd7697c kerneltest/f32test/smassstorage/scripts/usbperformance_multifile.pl --- a/kerneltest/f32test/smassstorage/scripts/usbperformance_multifile.pl Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/f32test/smassstorage/scripts/usbperformance_multifile.pl Thu Jan 07 13:38:45 2010 +0200 @@ -2,7 +2,7 @@ # Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). # All rights reserved. # This component and the accompanying materials are made available -# under the terms of "Eclipse Public License v1.0"" +# under the terms of the License "Eclipse Public License v1.0" # which accompanies this distribution, and is available # at the URL "http://www.eclipse.org/legal/epl-v10.html". # diff -r 56f325a607ea -r 0173bcd7697c kerneltest/f32test/smassstorage/src/t_ms_fsunit.cpp --- a/kerneltest/f32test/smassstorage/src/t_ms_fsunit.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/f32test/smassstorage/src/t_ms_fsunit.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -211,6 +211,9 @@ return KErrNone; } +EXPORT_C void CFileSystem::DriveInfo(TDriveInfo& aInfo, TInt aDriveNumber) const + { + } EXPORT_C TBool CFileSystem::IsExtensionSupported() const { diff -r 56f325a607ea -r 0173bcd7697c kerneltest/f32test/testfsys/t_tfsys.cpp --- a/kerneltest/f32test/testfsys/t_tfsys.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/f32test/testfsys/t_tfsys.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -86,37 +86,6 @@ return (KErrNone); } -void CTestFileSystem::DriveInfo(TDriveInfo& anInfo,TInt aDriveNumber) const -// -// Return drive info - iDriveAtt and iBatteryState are already set -// - { - if(!IsValidLocalDriveMapping(aDriveNumber)) - return; - - TLocalDriveCapsV2Buf localDriveCaps; - - // is the drive local? - if (!IsProxyDrive(aDriveNumber)) - { - // if not valid local drive, use default values in localDriveCaps - // if valid local drive and not locked, use TBusLocalDrive::Caps() values - // if valid drive and locked, hard-code attributes - (void)GetLocalDrive(aDriveNumber).Caps(localDriveCaps); - } - else // this need to be made a bit nicer - { - CExtProxyDrive* pD = GetProxyDrive(aDriveNumber); - if(pD) - { - (void)pD->Caps(localDriveCaps); - } - } - - anInfo.iMediaAtt=localDriveCaps().iMediaAtt; - anInfo.iType=localDriveCaps().iType; - anInfo.iDriveAtt=localDriveCaps().iDriveAtt; - } /** Reports whether the specified interface is supported - if it is, diff -r 56f325a607ea -r 0173bcd7697c kerneltest/f32test/testfsys/t_tfsys.h --- a/kerneltest/f32test/testfsys/t_tfsys.h Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/f32test/testfsys/t_tfsys.h Thu Jan 07 13:38:45 2010 +0200 @@ -91,7 +91,6 @@ ~CTestFileSystem(); TInt Install(); TInt DefaultPath(TDes& aPath) const; - void DriveInfo(TDriveInfo& anInfo, TInt aDriveNumber) const; TBusLocalDrive& DriveNumberToLocalDrive(TInt aDriveNumber); TInt GetInterface(TInt aInterfaceId, TAny*& aInterface,TAny* aInput); private: diff -r 56f325a607ea -r 0173bcd7697c kerneltest/f32test/testfsys/t_tfsys2.cpp --- a/kerneltest/f32test/testfsys/t_tfsys2.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/f32test/testfsys/t_tfsys2.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -92,34 +92,10 @@ void CTestFileSystem::DriveInfo(TDriveInfo& anInfo,TInt aDriveNumber) const // -// Return drive info - iDriveAtt and iBatteryState are already set +// Return drive info // { - if(!IsValidLocalDriveMapping(aDriveNumber)) - return; - - TLocalDriveCapsV2Buf localDriveCaps; - - // is the drive local? - if (!IsProxyDrive(aDriveNumber)) - { - // if not valid local drive, use default values in localDriveCaps - // if valid local drive and not locked, use TBusLocalDrive::Caps() values - // if valid drive and locked, hard-code attributes - (void)GetLocalDrive(aDriveNumber).Caps(localDriveCaps); - } - else // this need to be made a bit nicer - { - CExtProxyDrive* pD = GetProxyDrive(aDriveNumber); - if(pD) - { - (void)pD->Caps(localDriveCaps); - } - } - - anInfo.iMediaAtt=localDriveCaps().iMediaAtt; - anInfo.iType=localDriveCaps().iType; - anInfo.iDriveAtt=localDriveCaps().iDriveAtt; + CFileSystem::DriveInfo(anInfo, aDriveNumber); // hijack the iBattery member to report back the number of times MountL() has been called anInfo.iBattery = (TBatteryState) iMountAttempts; diff -r 56f325a607ea -r 0173bcd7697c kerneltest/f32test/testfsys/t_tfsys3.cpp --- a/kerneltest/f32test/testfsys/t_tfsys3.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/f32test/testfsys/t_tfsys3.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -86,37 +86,6 @@ return (KErrNone); } -void CTestFileSystem::DriveInfo(TDriveInfo& anInfo,TInt aDriveNumber) const -// -// Return drive info - iDriveAtt and iBatteryState are already set -// - { - if(!IsValidLocalDriveMapping(aDriveNumber)) - return; - - TLocalDriveCapsV2Buf localDriveCaps; - - // is the drive local? - if (!IsProxyDrive(aDriveNumber)) - { - // if not valid local drive, use default values in localDriveCaps - // if valid local drive and not locked, use TBusLocalDrive::Caps() values - // if valid drive and locked, hard-code attributes - (void)GetLocalDrive(aDriveNumber).Caps(localDriveCaps); - } - else // this need to be made a bit nicer - { - CExtProxyDrive* pD = GetProxyDrive(aDriveNumber); - if(pD) - { - (void)pD->Caps(localDriveCaps); - } - } - - anInfo.iMediaAtt=localDriveCaps().iMediaAtt; - anInfo.iType=localDriveCaps().iType; - anInfo.iDriveAtt=localDriveCaps().iDriveAtt; - } /** Reports whether the specified interface is supported - if it is, diff -r 56f325a607ea -r 0173bcd7697c kerneltest/f32test/testfsys/t_tfsys3.h --- a/kerneltest/f32test/testfsys/t_tfsys3.h Wed Dec 23 11:43:31 2009 +0000 +++ b/kerneltest/f32test/testfsys/t_tfsys3.h Thu Jan 07 13:38:45 2010 +0200 @@ -101,7 +101,6 @@ ~CTestFileSystem(); TInt Install(); TInt DefaultPath(TDes& aPath) const; - void DriveInfo(TDriveInfo& anInfo, TInt aDriveNumber) const; TBusLocalDrive& DriveNumberToLocalDrive(TInt aDriveNumber); TInt GetInterface(TInt aInterfaceId, TAny*& aInterface,TAny* aInput); private: diff -r 56f325a607ea -r 0173bcd7697c userlibandfileserver/fileserver/automounter/automounter.cpp --- a/userlibandfileserver/fileserver/automounter/automounter.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/userlibandfileserver/fileserver/automounter/automounter.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -150,55 +150,6 @@ return NULL; } -//----------------------------------------------------------------------------- -/** - Return the drive info -*/ -void CAutoMounterFileSystem::DriveInfo(TDriveInfo& anInfo,TInt aDriveNumber) const - { - //!!!!!!!!!!!! This method shall be made the same as FAT, exFAT etc. - //!! General idea: make all this code common for all filesystems and put it into the file server - //!! The problem: need to have another exported method. Actually, the generic code can be placed to CFileSystem::DriveInfo() - //!! despite it a pure virtual. - - __PRINT1(_L("#<<- CAutoMounterFileSystem::DriveInfo() [0x%x]"), this); - - if(!IsValidLocalDriveMapping(aDriveNumber)) - return; - - TLocalDriveCapsV2Buf localDriveCaps; - - TInt r = KErrNone; - - // is the drive local? - if (!IsProxyDrive(aDriveNumber)) - { - // if not valid local drive, use default values in localDriveCaps - // if valid local drive and not locked, use TBusLocalDrive::Caps() values - // if valid drive and locked, hard-code attributes - r = GetLocalDrive(aDriveNumber).Caps(localDriveCaps); - } - else // this need to be made a bit nicer - { - CExtProxyDrive* pD = GetProxyDrive(aDriveNumber); - if(pD) - r = pD->Caps(localDriveCaps); - else - r = KErrNotReady; // What should the behaviour really be here? - } - - if (r != KErrLocked ) - { - anInfo.iMediaAtt=localDriveCaps().iMediaAtt; - } - else - { - anInfo.iMediaAtt = KMediaAttLocked | KMediaAttLockable | KMediaAttHasPassword; - } - - anInfo.iType=localDriveCaps().iType; - anInfo.iDriveAtt=localDriveCaps().iDriveAtt; - } //----------------------------------------------------------------------------- @@ -303,19 +254,6 @@ } } -//----------------------------------------------------------------------------- -/** - @return Boolean exclusive OR between a1 and a2 -*/ -TBool BoolXOR(TBool a1, TBool a2) - { - if(!a1 && !a2) - return EFalse; - else if(a1 && a2) - return EFalse; - else - return ETrue; - } //----------------------------------------------------------------------------- diff -r 56f325a607ea -r 0173bcd7697c userlibandfileserver/fileserver/automounter/automounter.h --- a/userlibandfileserver/fileserver/automounter/automounter.h Wed Dec 23 11:43:31 2009 +0000 +++ b/userlibandfileserver/fileserver/automounter/automounter.h Thu Jan 07 13:38:45 2010 +0200 @@ -23,6 +23,7 @@ #ifndef AUTOMOUNTER_FILESYSTEM_H #define AUTOMOUNTER_FILESYSTEM_H +#include "filesystem_utils.h" #include #include @@ -72,20 +73,6 @@ //####################################################################################################################################### -//----------------------------------------------------------------------------- - -const TUint32 K1KiloByte = 1<<10; -const TUint32 K1MegaByte = 1<<20; - -const TUint32 K1uSec = 1; ///< 1 microsecond in TTimeIntervalMicroSeconds32 -const TUint32 K1mSec = 1000; ///< 1 millisecond in TTimeIntervalMicroSeconds32 -const TUint32 K1Sec = 1000*K1mSec; ///< 1 second in TTimeIntervalMicroSeconds32 - - -const TUint KBitsInByteLog2 = 3; -const TUint KBitsInByte = 1< #include "filesystem_fat.h" - TPtrC ptrFormatHelp=_L("Drive:[\\] [fat12|fat16|fat32] [spc:X] [rs:Y] [ft:Z] [/Q] [/S] [/E]\nfat12 or fat16 or fat32 specifies explicit FAT type\nspc:X specifies \"X\" sectors per cluster\nrs:Y specifies \"Y\" reserved sectors\nft:Z specifies \"Z\" FAT tables (1 or 2)\n\n/q - QuickFormat, /s - SpecialFormat, /e - ForcedErase "); - TPtrC ptrMountHelp=_L("Drive:[\\] [pext:Z] [/S][/U][/F]\n'X' *.fsy module name, like elocal.fsy\n'Y' file system name, like 'FAT'\n'Z' optional primary extension module name\n/U - dismount FS from the drive e.g 'mount d: /u' \n/F - force mounting with dismounting existing FS \n/S - mout drive as synchronous "); + TPtrC ptrFormatHelp=_L("Drive:[\\] [fat12|fat16|fat32] [spc:X] [rs:Y] [ft:Z] [/Q][/S][/E][/F]\nfat12 or fat16 or fat32 specifies explicit FAT type\nspc:X specifies \"X\" sectors per cluster\nrs:Y specifies \"Y\" reserved sectors\nft:Z specifies \"Z\" FAT tables (1 or 2)\n\n/q - QuickFormat, /s - SpecialFormat, /e - ForcedErase\n/f - force formatting (ignore volume being in use)"); + TPtrC ptrMountHelp=_L("Drive:[\\] [pext:Z] [/S][/U][/F][/R]\n'X' *.fsy module name, like elocal.fsy\n'Y' file system name, like 'FAT'\n'Z' optional primary extension module name\n/U - dismount FS from the drive e.g 'mount d: /u' \n/F - force mounting with dismounting existing FS \n/S - mount drive as synchronous\n/R - remount the file system "); // lint -e40,e30 @@ -47,7 +47,7 @@ TShellCommand(_L("DEL"),_L("Delete one file"),_L("[drive:][path][filename]"),TShellCommand::ESSwitch,ShellFunction::Del), TShellCommand(_L("DIR"),_L("Show directory contents"),_L("[drive:][path][filename] [/p][/w]\n\n /p - Pause after each screen of information\n /w - Wide format"),TShellCommand::EPSwitch|TShellCommand::EWSwitch|TShellCommand::EASwitch,ShellFunction::Dir), // TShellCommand(_L("EDLIN"),_L("Edit a text file"),_L("[drive:][path][filename] [/p]\n\n /p - Pause after each screen of information"),TShellCommand::EPSwitch,ShellFunction::Edit), - TShellCommand(_L("FORMAT"),_L("Format a disk"),ptrFormatHelp,TShellCommand::EQSwitch|TShellCommand::ESSwitch|TShellCommand::EESwitch,ShellFunction::Format), + TShellCommand(_L("FORMAT"),_L("Format a disk"),ptrFormatHelp,TShellCommand::EQSwitch|TShellCommand::ESSwitch|TShellCommand::EESwitch|TShellCommand::EFSwitch,ShellFunction::Format), TShellCommand(_L("GOBBLE"),_L("Create a file"),_L("[filename] size [/e]\n\n /e - create an empty file, without writing any data"),TShellCommand::EESwitch,ShellFunction::Gobble), TShellCommand(_L("HEXDUMP"),_L("Display the contents of a file in hexadecimal"),_L("[drive:][path][filename] [/p]\n\n /p - Pause after each screen of information\n\n Hit escape to exit from hexdump "),TShellCommand::EPSwitch,ShellFunction::Hexdump), TShellCommand(_L("LABEL"),_L("Set or return the volume label"),_L("[newlabel]"),0,ShellFunction::VolumeLabel), @@ -70,7 +70,7 @@ TShellCommand(_L("PLUGIN"),_L("Manage Plugins"),_L("[name][/A][/R][/M][/D]"),TShellCommand::EASwitch|TShellCommand::ERSwitch|TShellCommand::EMSwitch|TShellCommand::EDSwitch,ShellFunction::Plugin), TShellCommand(_L("DRVINFO"),_L("Print information about present drive(s) in the system"),_L("[DriveLetter:[\\]] [/p]\n/p - pause after each drive"),TShellCommand::EPSwitch,ShellFunction::DrvInfo), TShellCommand(_L("SYSINFO"),_L("Print information about system features and status"),_L(""),0,ShellFunction::SysInfo), - TShellCommand(_L("MOUNT"),_L("Mount / dismount file system on specified drive"),ptrMountHelp,TShellCommand::EUSwitch|TShellCommand::ESSwitch|TShellCommand::EFSwitch,ShellFunction::MountFileSystem), + TShellCommand(_L("MOUNT"),_L("Mount / dismount file system on specified drive"),ptrMountHelp,TShellCommand::EUSwitch|TShellCommand::ESSwitch|TShellCommand::EFSwitch|TShellCommand::ERSwitch,ShellFunction::MountFileSystem), TShellCommand(_L("ECHO"),_L("Print out the command line to the console and standard debug port."),_L("[line to print out]"),0,ShellFunction::ConsoleEcho), TShellCommand(_L("RUNEXEC"),_L("Run a program in a loop"),_L("count filename[.exe] [/E/S/R]\n /E - exit early on error\n /S - count in seconds\n zero - run forever\n /R - reset debug regs after each run"),TShellCommand::EESwitch|TShellCommand::ESSwitch|TShellCommand::ERSwitch,ShellFunction::RunExec), @@ -1174,7 +1174,6 @@ FormatDrvMediaTypeInfo(driveInfo, Buf); apConsole->Printf(Buf); - //apConsole->Printf(_L("BatteryState:%d\n"),driveInfo.iBattery); } //-- print drive attributes @@ -1384,6 +1383,75 @@ } } +//----------------------------------------------------------------------------------------------------------------------- +TInt DoRemountFS(RFs& aFs, TInt aDrvNum) +{ + TInt nRes; + TBuf<40> fsName; + TBuf<40> pextName; + + //-- 1. get file system name + nRes = aFs.FileSystemName(fsName, aDrvNum); + if(nRes != KErrNone) + return KErrNotFound; + + //-- 2. find out if the drive sync/async + TPckgBuf drvSyncBuf; + TBool& drvSynch = drvSyncBuf(); + + nRes = aFs.QueryVolumeInfoExt(aDrvNum, EIsDriveSync, drvSyncBuf); + if(nRes != KErrNone) + {//-- pretend that the drive is asynch. in the case of file system being corrupted. this is 99.9% true + drvSynch = EFalse; + } + + //-- 3. find out primary extension name if it is present; we will need to add it again when mounting the FS + //-- other extensions (non-primary) are not supported yet + nRes = aFs.ExtensionName(pextName, aDrvNum, 0); + if(nRes != KErrNone) + { + pextName.SetLength(0); + } + + //-- 3.1 check if the drive has non-primary extensions, fail in this case + { + TBuf<40> extName; + nRes = aFs.ExtensionName(extName, aDrvNum, 1); + if(nRes == KErrNone) + { + CShell::TheConsole->Printf(_L("Non-primary extensions are not supported!\n")); + return KErrNotSupported; + } + } + + //-- 4. dismount the file system + nRes = DoDismountFS(aFs, aDrvNum); + if(nRes != KErrNone) + return nRes; + + //-- 5. mount the FS back + if(pextName.Length() > 0) + {//-- we need to mount FS with the primary extension + nRes = aFs.AddExtension(pextName); + if(nRes != KErrNone && nRes != KErrAlreadyExists) + { + return nRes; + } + + nRes = aFs.MountFileSystem(fsName, pextName, aDrvNum, drvSynch); + } + else + {//-- the FS did not have primary extension + nRes = aFs.MountFileSystem(fsName, aDrvNum, drvSynch); + } + + if(nRes == KErrNone) + { + CShell::TheConsole->Printf(_L("mounted filesystem:%S\n"), &fsName); + } + + return nRes; +} //----------------------------------------------------------------------------------------------------------------------- /** @@ -1398,6 +1466,7 @@ /u dismounts a filesystem on the specified drive; e.g. "mount d: /u" /s for mounting FS specifies that the drive will be mounted as synchronous one. /f for forcing mounting the FS; the previous one will be automatically dismounted + /r remount existing FS (dismount and mount it back) */ TInt ShellFunction::MountFileSystem(TDes& aArgs, TUint aSwitches) { @@ -1424,6 +1493,14 @@ const TInt drvNum = nRes; //-- this is the drive number; + + //-- remounting the existing FS (/R switch) + if(aSwitches & TShellCommand::ERSwitch) + { + nRes = DoRemountFS(fs, drvNum); + return nRes; + } + //-- check if we dismounting the FS (/U switch) if(aSwitches & TShellCommand::EUSwitch) { @@ -1547,7 +1624,7 @@ /Q : Quick Format /S : Special Format /E : Remove Password and Format - + /F : force formatting, even if there are files opened on the drive */ TInt ShellFunction::Format(TDes& aPath, TUint aSwitches) @@ -1573,6 +1650,11 @@ if (aSwitches & TShellCommand::EESwitch) fmtMode|=EForceErase; + //-- Format /F - force format. The volume will be formatted even if there are files or directories opened on this drive + if (aSwitches & TShellCommand::EFSwitch) + fmtMode|=EForceFormat; + + TInt fmtCnt = 0; RFormat format; TInt nRes; diff -r 56f325a607ea -r 0173bcd7697c userlibandfileserver/fileserver/etshell/ts_edshl.cpp --- a/userlibandfileserver/fileserver/etshell/ts_edshl.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/userlibandfileserver/fileserver/etshell/ts_edshl.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -1228,7 +1228,7 @@ VA_LIST list; VA_START(list,aFmt); - TBuf<0x140> aBuf; + TBuf<0x200> aBuf; //format output string using argument list //coverity[uninit_use_in_call] @@ -1252,7 +1252,7 @@ VA_LIST list; VA_START(list,aFmt); - TBuf<0x140> aBuf; + TBuf<0x200> aBuf; //format output string using argumen list //coverity[uninit_use_in_call] diff -r 56f325a607ea -r 0173bcd7697c userlibandfileserver/fileserver/etshell/ts_std.h --- a/userlibandfileserver/fileserver/etshell/ts_std.h Wed Dec 23 11:43:31 2009 +0000 +++ b/userlibandfileserver/fileserver/etshell/ts_std.h Thu Jan 07 13:38:45 2010 +0200 @@ -15,6 +15,8 @@ // // +#include +#include #include #include #include diff -r 56f325a607ea -r 0173bcd7697c userlibandfileserver/fileserver/group/release.txt --- a/userlibandfileserver/fileserver/group/release.txt Wed Dec 23 11:43:31 2009 +0000 +++ b/userlibandfileserver/fileserver/group/release.txt Thu Jan 07 13:38:45 2010 +0200 @@ -1,3 +1,35 @@ +Version 2.00.2020 +================= +(Made by VincentF 27/11/2009) + +1. NicholasC + 1. DEFECT FIX: DEF143079: E32USER-CBASE 46 with Host Ms Thread3 in mass storage file system + +2. DmitryL + 1. DEFECT FIX: DEF143009 T_scn32rd2 test fails on 1MB FAT volume and no call to DoRummageDirCacheL() + +3. ChrisNotton + 1. DEFECT FIX: DEF142863: Public header files must not include platform or internal headers + + +Version 2.00.2019 +================= +(Made by Vino Jose 25/11/2009) + +1. NicholasC + 1. DEFECT FIX: DEF142837: Enable File Server client to determine if logical drive is attached to USB bus + 2. DEFECT FIX: DEF142899: t_ext1 fails on NaviEngine UREL with USB MS drive + 3. DEFECT FIX: DEF142900: t_dspace failing with USB Mass Storage drive + +2. DmitryL + 1. DEFECT FIX: DEF142322 FAT: CFatMountCB::IsEndOfClusterCh() implementation is not optimal + 2. DEFECT FIX: DEF142991 Automounter FS shall comply with changes introduced in DEF142837 + 3. DEFECT FIX: DEF143023 FAT, exFAT: CDynamicDirCache::ReadL() can't handle bulk reads + +3. MichaelCox + 1. DEFECT FIX: DEF142995: F32 Plugins cannot get the filename when intercepting EFsSetEntry + + Version 2.00.2018 ================= (Made by Vino Jose 05/11/2009) @@ -15,6 +47,7 @@ 2. NicholasC 1. DEFECT FIX: DEF142538: b_fat32 hangs when using large Mass Storage devices 2. DEFECT FIX: DEF141812: F32TEST T_NOTIFY_MFS on Unicore SMP (Naviengine) Image + 3. DEFECT FIX: DEF142590: Test hanging in usb host mass storage file system 3. SophieY 1. DEFECT FIX: DEF141402: File server trace LDD causes zombie thread to remain in existence forever diff -r 56f325a607ea -r 0173bcd7697c userlibandfileserver/fileserver/inc/common.h --- a/userlibandfileserver/fileserver/inc/common.h Wed Dec 23 11:43:31 2009 +0000 +++ b/userlibandfileserver/fileserver/inc/common.h Thu Jan 07 13:38:45 2010 +0200 @@ -26,6 +26,7 @@ #if !defined(__F32FILE_H__) #include #endif +#include #include "u32std.h" // diff -r 56f325a607ea -r 0173bcd7697c userlibandfileserver/fileserver/inc/f32file.h --- a/userlibandfileserver/fileserver/inc/f32file.h Wed Dec 23 11:43:31 2009 +0000 +++ b/userlibandfileserver/fileserver/inc/f32file.h Thu Jan 07 13:38:45 2010 +0200 @@ -1448,14 +1448,14 @@ The type of media mounted on the drive. */ TMediaType iType; - - + + /** Indicates whether the drive supports a battery, and if so, its state. */ TBatteryState iBattery; - - + + /** The drive attributes. @@ -1464,7 +1464,8 @@ @see KDriveAttRedirected @see KDriveAttSubsted @see KDriveAttInternal - @see KDriveAttRemovable + @see KDriveAttRemovable + @see KDriveAttExternal */ TUint iDriveAtt; @@ -1480,11 +1481,12 @@ @see KMediaAttLocked */ TUint iMediaAtt; -private: + + /** - Reserved for future expansion + The type of interface used to connect to the media. */ - TUint32 iReserved; + TConnectionBusType iConnectionBusType; }; diff -r 56f325a607ea -r 0173bcd7697c userlibandfileserver/fileserver/inc/f32file_private.h --- a/userlibandfileserver/fileserver/inc/f32file_private.h Wed Dec 23 11:43:31 2009 +0000 +++ b/userlibandfileserver/fileserver/inc/f32file_private.h Thu Jan 07 13:38:45 2010 +0200 @@ -29,6 +29,7 @@ #include #include #include +#include /** diff -r 56f325a607ea -r 0173bcd7697c userlibandfileserver/fileserver/inc/f32fsys.h --- a/userlibandfileserver/fileserver/inc/f32fsys.h Wed Dec 23 11:43:31 2009 +0000 +++ b/userlibandfileserver/fileserver/inc/f32fsys.h Thu Jan 07 13:38:45 2010 +0200 @@ -30,6 +30,8 @@ #include #endif #include +#include + // #if defined(_UNICODE) #define KFileSystemUidValue KFileSystemUidValue16 @@ -559,6 +561,7 @@ class CFileCB; class CDirCB; +__ASSERT_COMPILE(sizeof(TVolFormatParam) != sizeof(TLDFormatInfo)); @@ -2413,8 +2416,8 @@ The function should set anInfo.iMediaAtt and anInfo.iType according to the specified drive number. - Note that anInfo.iDriveAtt and anInfo.iBatteryState will already have been - set by the calling function. + Note that anInfo.iDriveAtt will already have been set by the calling + function. The function can obtain the necessary information by calling the appropriate TBusLocalDrive::Caps() function using the argument aDriveNumber. @@ -2422,7 +2425,7 @@ @param anInfo On return, contains the drive information. @param aDriveNumber The drive number. */ - virtual void DriveInfo(TDriveInfo& anInfo,TInt aDriveNumber) const =0; + IMPORT_C virtual void DriveInfo(TDriveInfo& anInfo,TInt aDriveNumber) const; virtual TInt DefaultPath(TDes& aPath) const; @@ -3055,8 +3058,16 @@ */ IMPORT_C TBool IsValidLocalDriveMapping(TInt aDrive); - - +/** +@internalTechnology + +Sets the media attributes and type in the anInfo parameter to those of the +specified drive. + +@param anInfo TDriveInfo object to store the drive information. +@param aDriveNumber The number of the drive to get the information from. +*/ +IMPORT_C void GetDriveInfo(TDriveInfo& anInfo,TInt aDriveNumber); /** @publishedPartner diff -r 56f325a607ea -r 0173bcd7697c userlibandfileserver/fileserver/inc/f32image.h --- a/userlibandfileserver/fileserver/inc/f32image.h Wed Dec 23 11:43:31 2009 +0000 +++ b/userlibandfileserver/fileserver/inc/f32image.h Thu Jan 07 13:38:45 2010 +0200 @@ -26,6 +26,8 @@ #ifndef __F32IMAGE_H__ #define __F32IMAGE_H__ #include +#include +#include /** Value used for E32ImageHeader::iCpuIdentifier. @@ -89,6 +91,8 @@ const TInt KImageHWFloatShift = 20; ///< Bit shift count for Floating Point type. const TUint KImageHWFloat_None = EFpTypeNone << KImageHWFloatShift; ///< No hardware floating point used. const TUint KImageHWFloat_VFPv2 = EFpTypeVFPv2 << KImageHWFloatShift; ///< ARM VFPv2 floating point used. +const TUint KImageHWFloat_VFPv3 = EFpTypeVFPv3 << KImageHWFloatShift; ///< ARM VFPv3 floating point used. This includes Advanced SIMD (NEON). +const TUint KImageHWFloat_VFPv3D16 = EFpTypeVFPv3D16 << KImageHWFloatShift; ///< ARM VFPv3-D16 floating point used. This does not include Advanced SIMD (NEON). const TUint KImageHdrFmtMask = 0x0f000000u; ///< Bitmask for header format type. const TInt KImageHdrFmtShift = 24; ///< Bit shift count for header format type. diff -r 56f325a607ea -r 0173bcd7697c userlibandfileserver/fileserver/inc/f32ver.h --- a/userlibandfileserver/fileserver/inc/f32ver.h Wed Dec 23 11:43:31 2009 +0000 +++ b/userlibandfileserver/fileserver/inc/f32ver.h Thu Jan 07 13:38:45 2010 +0200 @@ -58,6 +58,6 @@ @see TVersion */ -const TInt KF32BuildVersionNumber=2018; +const TInt KF32BuildVersionNumber=2020; // #endif diff -r 56f325a607ea -r 0173bcd7697c userlibandfileserver/fileserver/inc/filesystem_utils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/userlibandfileserver/fileserver/inc/filesystem_utils.h Thu Jan 07 13:38:45 2010 +0200 @@ -0,0 +1,90 @@ +// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// +// Collection of common constants, utility functions, etc. for the file server and file systems. +// Definitions here must be filesystem-agnostic, i.e. generic enougs to be used by every file system +// +// This is the internal file and must not be exported. + +/** + @file + @internalTechnology +*/ + +#if !defined(__FILESYSTEM_UTILS_H__) +#define __FILESYSTEM_UTILS_H__ + +#if !defined(__E32BASE_H__) +#include +#endif + +//####################################################################################################################################### +//# constants definitions +//####################################################################################################################################### + +const TUint KBitsInByteLog2 = 3; +const TUint KBitsInByte = 1<> aGranularityLog2) << aGranularityLog2; +} + +//----------------------------------------------------------------------------- +/** + Rounds up aVal to the 2^aGranularityLog2 + For example: RoundUp(0x08, 2) == 0x08; RoundUp(0x08, 3) == 0x08; RoundUp(0x08, 4) == 0x10; RoundUp(0x19, 4) == 0x20 + + @return rounded-up value +*/ +inline TUint32 RoundUp(TUint32 aVal, TUint32 aGranularityLog2) + { + ASSERT(aGranularityLog2 < 32); + + if( (aVal & ((1<>= aGranularityLog2; + aVal++; + aVal <<= aGranularityLog2; + + return aVal; + } + +//----------------------------------------------------------------------------- + +/** + @return Boolean exclusive OR between a1 and a2 + This function should be used on C-style TBool, which is, actually TInt type; Its '0' value means "False" and _any_ non-zero means "True" + E.g: BoolXor(0x17, 0x4a) == EFalse; +*/ +TBool BoolXOR(TBool a1, TBool a2) + { + if(!a1 && !a2) + return EFalse; + else if(a1 && a2) + return EFalse; + else + return ETrue; + } + +//----------------------------------------------------------------------------- + +/** + Calculates the log2 of a number + This is the explicitly inlined version. Extensive using it may result in a code bloat. + + @param aNum Number to calulate the log two of + @return The log two of the number passed in +*/ +inline TUint32 Log2_inline(TUint32 aVal) + { + __ASSERT_COMPILE(sizeof(TUint32) == 4); + ASSERT(aVal); + + TUint32 bitPos=31; + + if(!(aVal >> 16)) {bitPos-=16; aVal<<=16;} + if(!(aVal >> 24)) {bitPos-=8; aVal<<=8 ;} + if(!(aVal >> 28)) {bitPos-=4; aVal<<=4 ;} + if(!(aVal >> 30)) {bitPos-=2; aVal<<=2 ;} + if(!(aVal >> 31)) {bitPos-=1;} + + return bitPos; + } + + +//----------------------------------------------------------------------------- +/** + Calculates number of '1' bits in the aVal + This is the explicitly inlined version. Extensive using it may result in a code bloat. + + @param aVal some value + @return number of '1' bits in the aVal +*/ +inline TUint32 Count1Bits_inline(TUint32 aVal) + { + if(!aVal) + return 0; + + if(aVal == 0xFFFFFFFF) + return 32; + + aVal = aVal - ((aVal >> 1) & 0x55555555); + aVal = (aVal & 0x33333333) + ((aVal >> 2) & 0x33333333); + aVal = (aVal + (aVal >> 4)) & 0x0f0f0f0f; + aVal = aVal + (aVal >> 8); + aVal = aVal + (aVal >> 16); + + return aVal & 0x3f; + } + + + + + + +#endif //__FILESYSTEM_UTILS_INL__ + + + + + + + + + + + + + + + + + diff -r 56f325a607ea -r 0173bcd7697c userlibandfileserver/fileserver/sfat/bld.inf --- a/userlibandfileserver/fileserver/sfat/bld.inf Wed Dec 23 11:43:31 2009 +0000 +++ b/userlibandfileserver/fileserver/sfat/bld.inf Thu Jan 07 13:38:45 2010 +0200 @@ -46,8 +46,10 @@ PRJ_MMPFILES + #ifdef WINS efat #endif elocal + diff -r 56f325a607ea -r 0173bcd7697c userlibandfileserver/fileserver/sfat/elocal.mmp --- a/userlibandfileserver/fileserver/sfat/elocal.mmp Wed Dec 23 11:43:31 2009 +0000 +++ b/userlibandfileserver/fileserver/sfat/elocal.mmp Thu Jan 07 13:38:45 2010 +0200 @@ -52,6 +52,7 @@ #else + USERINCLUDE ../sfat USERINCLUDE ../sfat/inc USERINCLUDE ../sfile @@ -70,8 +71,8 @@ OS_LAYER_SYSTEMINCLUDE_SYMBIAN LIBRARY hal.lib +#endif -#endif SOURCEPATH . DOCUMENT ../group/release.txt diff -r 56f325a607ea -r 0173bcd7697c userlibandfileserver/fileserver/sfat32/common_constants.h --- a/userlibandfileserver/fileserver/sfat32/common_constants.h Wed Dec 23 11:43:31 2009 +0000 +++ b/userlibandfileserver/fileserver/sfat32/common_constants.h Thu Jan 07 13:38:45 2010 +0200 @@ -25,7 +25,7 @@ #define COMMON_CONSTANTS_H - +#include "filesystem_utils.h" #include #include @@ -93,14 +93,6 @@ typedef TUint32 TFat32Entry; typedef TUint16 TFat16Entry; -const TUint16 K1KiloByteLog2 = 10; -const TUint32 K1KiloByte = 1<<10; -const TUint32 K1MegaByte = 1<<20; - -const TUint32 K1uSec = 1; ///< 1 misrosecond in TTimeIntervalMicroSeconds32 -const TUint32 K1mSec = 1000; ///< 1 millisecond in TTimeIntervalMicroSeconds32 -const TUint32 K1Sec = 1000*K1mSec; ///< 1 second in TTimeIntervalMicroSeconds32 - _LIT8(KLit8ReplacementForUnconvertibleUnicodeCharacters, "_"); _LIT8(KFileSystemName12,"FAT12 "); ///< Name in BPB given to a Fat12 volume _LIT8(KFileSystemName16,"FAT16 "); ///< Name in BPB given to a Fat16 volume @@ -119,9 +111,6 @@ const TUint8 KBootSectorMediaDescriptor=0xF8; ///< Media descriptor for a Fat volume, Generic disk const TUint8 KEntryErasedMarker=0xE5; ///< Erased entry marker for a directory entry -const TUint KDefSectorSzLog2=9; ///< Log2 of the default sector size for FAT -const TUint KDefaultSectorSize = 1 << KDefSectorSzLog2; ///< Default sector size for FAT, 512 bytes - const TInt EOF_32Bit =0x0fffffff; ///< End of cluster chain value for Fat32 const TInt EOF_16Bit =0xffff; ///< End of cluster chain value for Fat16 diff -r 56f325a607ea -r 0173bcd7697c userlibandfileserver/fileserver/sfat32/fat_table32.cpp --- a/userlibandfileserver/fileserver/sfat32/fat_table32.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/userlibandfileserver/fileserver/sfat32/fat_table32.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -33,14 +33,14 @@ //--------------------------------------------------------------------------------------------------------------------------------------- /** Implements automatic locking object. - Calls TFatDriveInterface::AcquireLock() on construction and TFatDriveInterface::ReleaseLock() on destruction. + Calls TDriveInterface::AcquireLock() on construction and TDriveInterface::ReleaseLock() on destruction. Can be constructed on the stack only. */ class XAutoLock { public: inline XAutoLock(CFatMountCB* apOwner) : iDrv(apOwner->DriveInterface()) {iDrv.AcquireLock();} - inline XAutoLock(TFatDriveInterface& aDrv) : iDrv(aDrv) {iDrv.AcquireLock();} + inline XAutoLock(TDriveInterface& aDrv) : iDrv(aDrv) {iDrv.AcquireLock();} inline ~XAutoLock() {iDrv.ReleaseLock();} private: @@ -48,7 +48,7 @@ void* operator new(TUint, void*); private: - TFatDriveInterface &iDrv; ///< reference to the drive interface + TDriveInterface &iDrv; ///< reference to the drive interface }; @@ -126,6 +126,12 @@ iFatType = iOwner->FatType(); ASSERT(IsFat12() || IsFat16() || IsFat32()); + //-- set the EOC code + iFatEocCode = EocCodeByFatType(iFatType); + + + + iFreeClusterHint = KFatFirstSearchCluster; //-- cache the media attributes @@ -1732,42 +1738,21 @@ Get the next cluster in the chain from the FAT @param aCluster number to read, contains next cluster upon return - @leave @return False if end of cluster chain */ TBool CFatTable::GetNextClusterL(TInt& aCluster) const { __PRINT1(_L("CAtaFatTable::GetNextClusterL(%d)"), aCluster); - const TInt nextCluster = ReadL(aCluster); - TBool ret = EFalse; + const TUint32 nextCluster = ReadL(aCluster); + const TBool bEOC = IsEndOfClusterCh(nextCluster); + + if(bEOC) + return EFalse; //-- the end of cluster chain + + aCluster = nextCluster; - switch(FatType()) - { - case EFat12: - ret=!IsEof12Bit(nextCluster); - break; - - case EFat16: - ret=!IsEof16Bit(nextCluster); - break; - - case EFat32: - ret=!IsEof32Bit(nextCluster); - break; - - default: - ASSERT(0); - return EFalse;//-- get rid of warning - }; - - if (ret) - { - aCluster=nextCluster; - } - - return ret; - + return ETrue; } /** diff -r 56f325a607ea -r 0173bcd7697c userlibandfileserver/fileserver/sfat32/inc/fat_table32.h --- a/userlibandfileserver/fileserver/sfat32/inc/fat_table32.h Wed Dec 23 11:43:31 2009 +0000 +++ b/userlibandfileserver/fileserver/sfat32/inc/fat_table32.h Thu Jan 07 13:38:45 2010 +0200 @@ -67,7 +67,7 @@ inline void AcquireLock() const {iDriveInteface.AcquireLock();} inline void ReleaseLock() const {iDriveInteface.ReleaseLock();} - inline TFatDriveInterface& DriveInterface() const; + inline TDriveInterface& DriveInterface() const; inline CFatMountCB* OwnerMount() const; @@ -128,10 +128,10 @@ private: - CFatCacheBase* iCache; ///< FAT cache, fixed or LRU depending on the FAT type - TFatDriveInterface& iDriveInteface; ///< reference to the drive interface - CFatHelperThreadBase* ipHelperThread; ///< helper thread object pointer. NULL if it is not present - TState iState; ///< state of this object + CFatCacheBase* iCache; ///< FAT cache, fixed or LRU depending on the FAT type + TDriveInterface& iDriveInteface; ///< reference to the drive interface + CFatHelperThreadBase* ipHelperThread; ///< helper thread object pointer. NULL if it is not present + TState iState; ///< state of this object //-- friends friend TInt FAT32_ScanThread(TAny* apHostObject); diff -r 56f325a607ea -r 0173bcd7697c userlibandfileserver/fileserver/sfat32/inc/fat_table32.inl --- a/userlibandfileserver/fileserver/sfat32/inc/fat_table32.inl Wed Dec 23 11:43:31 2009 +0000 +++ b/userlibandfileserver/fileserver/sfat32/inc/fat_table32.inl Thu Jan 07 13:38:45 2010 +0200 @@ -23,10 +23,11 @@ #define FAT_TABLE_32_INL + //--------------------------------------------------------------------------------------------------------------------------------------- /** @return interface to the FAT drive */ -TFatDriveInterface& CAtaFatTable::DriveInterface() const +TDriveInterface& CAtaFatTable::DriveInterface() const { return iDriveInteface; } diff -r 56f325a607ea -r 0173bcd7697c userlibandfileserver/fileserver/sfat32/inc/sl_std.h --- a/userlibandfileserver/fileserver/sfat32/inc/sl_std.h Wed Dec 23 11:43:31 2009 +0000 +++ b/userlibandfileserver/fileserver/sfat32/inc/sl_std.h Thu Jan 07 13:38:45 2010 +0200 @@ -79,7 +79,7 @@ This class can't be instantinated by user; only CFatMountCB can do this; see CFatMountCB::DriveInterface() */ -class TFatDriveInterface +class TDriveInterface { public: enum TAction {ERetry=1}; @@ -106,9 +106,9 @@ protected: - TFatDriveInterface(); - TFatDriveInterface(const TFatDriveInterface&); - TFatDriveInterface& operator=(const TFatDriveInterface&); + TDriveInterface(); + TDriveInterface(const TDriveInterface&); + TDriveInterface& operator=(const TDriveInterface&); TBool Init(CFatMountCB* aMount); void Close(); @@ -138,7 +138,7 @@ inline void EnterCriticalSection() const {iLock.Wait();} inline void LeaveCriticalSection() const {iLock.Signal();} - //-- methods' wrappers that are used by TFatDriveInterface + //-- methods' wrappers that are used by TDriveInterface TInt Read(TInt64 aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2 &aMessage,TInt anOffset) const; TInt Read(TInt64 aPos,TInt aLength,TDes8& aTrg) const; TInt Write(TInt64 aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2 &aMessage,TInt anOffset); @@ -243,15 +243,14 @@ inline TInt SectorSizeLog2() const; inline TUint32 FreeClusters() const; - inline TBool IsEof32Bit(TInt aCluster) const; - inline TBool IsEof16Bit(TInt aCluster) const; - inline TBool IsEof12Bit(TInt aCluster) const; - + inline TBool IsEndOfClusterCh(TUint32 aCluster) const; + inline TFatType FatType() const; inline TBool IsFat12() const; inline TBool IsFat16() const; inline TBool IsFat32() const; + inline TBool ClusterNumberValid(TUint32 aClusterNo) const; @@ -269,6 +268,7 @@ TUint32 iFreeClusters; ///< Number of free cluster in the fat table TUint32 iFreeClusterHint; ///< this is just a hint to the free cluster number, not required to contain exact information. TFatType iFatType; ///< FAT type 12/16/32, cached from the iOwner + TUint32 iFatEocCode; ///< End Of Cluster Chain code, 0xff8 for FAT12, 0xfff8 for FAT16, and 0xffffff8 for FAT32 TUint32 iMaxEntries; ///< maximal number of FAT entries in the table. This value is taken from the CFatMount that calculates it }; @@ -487,15 +487,15 @@ TInt IsFinalised(TBool& aFinalised); /** - A wrapper around TFatDriveInterface providing its instantination and destruction. + A wrapper around TDriveInterface providing its instantination and destruction. You must not create objects of this class, use DriveInterface() instead. */ - class XDriveInterface: public TFatDriveInterface + class XDriveInterface: public TDriveInterface { public: - XDriveInterface() : TFatDriveInterface() {} + XDriveInterface() : TDriveInterface() {} ~XDriveInterface() {Close();} - TBool Init(CFatMountCB* aMount) {return TFatDriveInterface::Init(aMount);} + TBool Init(CFatMountCB* aMount) {return TDriveInterface::Init(aMount);} }; @@ -543,7 +543,11 @@ inline TBool IsRootDir(const TEntryPos &aEntry) const; inline CAsyncNotifier* Notifier() const; - inline TFatDriveInterface& DriveInterface() const; + inline TDriveInterface& DriveInterface() const; + + inline TBool IsEndOfClusterCh(TInt aCluster) const; + inline void SetEndOfClusterCh(TInt &aCluster) const; + void ReadUidL(TInt aCluster,TEntry& anEntry) const; @@ -567,9 +571,8 @@ void FindDosNameL(const TDesC& aName,TUint anAtt,TEntryPos& aDosEntryPos,TFatDirEntry& aDosEntry,TDes& aFileName,TInt anError) const; void Dismount(); - TBool IsEndOfClusterCh(TInt aCluster) const; - void SetEndOfClusterCh(TInt &aCluster) const; - void InitializeRootEntry(TFatDirEntry & anEntry) const; + + void InitializeRootEntry(TFatDirEntry & anEntry) const; TInt64 MakeLinAddrL(const TEntryPos& aPos) const; @@ -711,6 +714,8 @@ void DoUpdateFSInfoSectorsL(TBool aInvalidateFSInfo); void UnFinaliseMountL(); void DoReMountL(); + void SetFatType(TFatType aFatType); + private: @@ -734,7 +739,9 @@ TBool iMainBootSecValid : 1;///< true if the main boot sector is valid, if false, a backup boot sector may be in use. TFatMntState iState; ///< this mounnt internal state + TFatType iFatType; ///< FAT type, FAT12,16 or 32 + TUint32 iFatEocCode; ///< End Of Cluster Chain code, 0xff8 for FAT12, 0xfff8 for FAT16, and 0xffffff8 for FAT32 CLeafDirCache* iLeafDirCache; ///< A cache for most recently visited directories, only valid when limit is set bigger than 1 HBufC* iLastLeafDir; ///< The last visited directory, only valid when limit of iLeafDirCache is less than 1 @@ -779,7 +786,7 @@ friend class CFatFormatCB; friend class CScanDrive; -friend class TFatDriveInterface; +friend class TDriveInterface; }; @@ -841,13 +848,12 @@ TUint32* iSeekIndex; ///< Seek index into file TInt iSeekIndexSize; ///< size of seek index - TBool iAttPending; TInt iStartCluster; ///< Start cluster number of file TEntryPos iCurrentPos; ///< Current position in file data TEntryPos iFileDirPos; ///< File directory entry position TBool iFileSizeModified; }; -// + /** Fat file system directory subsession implmentation, provides all that is required of a plug in @@ -963,7 +969,6 @@ CFileCB* NewFileL() const; CDirCB* NewDirL() const; CFormatCB* NewFormatL() const; - void DriveInfo(TDriveInfo& anInfo,TInt aDriveNumber) const; TInt DefaultPath(TDes& aPath) const; TBool IsExtensionSupported() const; TBool GetUseLocalTime() const; @@ -999,12 +1004,6 @@ TPtrC RemoveTrailingDots(const TDesC& aName); /** -Indicates if a number passed in is a power of two -@return ETrue if aVal is a power of 2 -*/ -inline TBool IsPowerOf2(TUint32 aVal); - -/** Calculates the log2 of a number @param aNum Number to calulate the log two of @@ -1012,9 +1011,6 @@ */ TUint32 Log2(TUint32 aVal); -/** @return 2^aVal*/ -inline TUint32 Pow2(TUint32 aVal); - /** Converts Dos time (from a directory entry) to TTime format @@ -1073,6 +1069,7 @@ */ TUint8 CalculateShortNameCheckSum(const TDesC8& aShortName); +TUint32 EocCodeByFatType(TFatType aFatType); diff -r 56f325a607ea -r 0173bcd7697c userlibandfileserver/fileserver/sfat32/inc/sl_std.inl --- a/userlibandfileserver/fileserver/sfat32/inc/sl_std.inl Wed Dec 23 11:43:31 2009 +0000 +++ b/userlibandfileserver/fileserver/sfat32/inc/sl_std.inl Thu Jan 07 13:38:45 2010 +0200 @@ -20,21 +20,6 @@ -TBool IsPowerOf2(TUint32 aVal) - { - if (aVal==0) - return EFalse; - - return !(aVal & (aVal-1)); - } - -TUint32 Pow2(TUint32 aVal) - { - //ASSERT(aVal<32); - return 1 << aVal; - } - - //--------------------------------------------------------------------------------------------------------------------------------- // class TEntryPos TUint32 TEntryPos::Cluster() const @@ -253,9 +238,9 @@ } -TFatDriveInterface& CFatMountCB::DriveInterface() const +TDriveInterface& CFatMountCB::DriveInterface() const { - return (TFatDriveInterface&)iDriverInterface; + return (TDriveInterface&)iDriverInterface; } const TFatConfig& CFatMountCB::FatConfig() const @@ -325,6 +310,34 @@ } +/** + Checks for "EOC" for all Fat types + @param aCluster FAT table entry (cluster number) to check + @return ETrue if aCluster is a EOC for the FAT type being used by CFatMountCB +*/ +TBool CFatMountCB::IsEndOfClusterCh(TInt aCluster) const + { + ASSERT(iFatEocCode); + + if((TUint32)aCluster >= iFatEocCode) + return ETrue; + + ASSERT((TUint32)aCluster <= iFatEocCode+7); + + return EFalse; + } + +/** + Sets "End of Cluster Chain" value in aCluster depending on the FAT type. + @param aCluster cluster to set to end of chain marker +*/ +void CFatMountCB::SetEndOfClusterCh(TInt &aCluster) const + { + ASSERT(iFatEocCode); + aCluster = iFatEocCode+7; + } + + //------- debug methods #ifdef _DEBUG /** @@ -369,6 +382,9 @@ #endif + + + //--------------------------------------------------------------------------------------------------------------------------------- // class CFatFormatCB @@ -447,17 +463,6 @@ return iFreeClusters; } -TBool CFatTable::IsEof32Bit(TInt aCluster) const - {return(aCluster>=(TInt)0x0FFFFFF8 && aCluster<=(TInt)0x0FFFFFFF);} - -TBool CFatTable::IsEof16Bit(TInt aCluster) const - {return(aCluster>=0xFFF8 && aCluster<=0xFFFF);} - -TBool CFatTable::IsEof12Bit(TInt aCluster) const - {return(aCluster>=0xFF8 && aCluster<=0xFFF);} - -TInt CFatTable::SectorSizeLog2() const - {return(iOwner->SectorSizeLog2());} //--------------------------------------------------------------------------------------------------------------------------------- @@ -483,6 +488,23 @@ /** + Checks for "EOC" for all Fat types + @param aCluster FAT table entry (cluster number) to check + @return ETrue if aCluster is a EOC for the FAT type being used by CFatMountCB that owns the CFatTable +*/ +inline TBool CFatTable::IsEndOfClusterCh(TUint32 aCluster) const + { + ASSERT(iFatEocCode); + + if(aCluster >= iFatEocCode) + return ETrue; + + ASSERT((TUint32)aCluster <= iFatEocCode+7); + return EFalse; + } + + +/** @return Maximal number of addresable FAT entries. This value is taken from the owning mount */ inline TUint32 CFatTable::MaxEntries() const @@ -492,8 +514,8 @@ } -// class TFatDriveInterface -TBool TFatDriveInterface::NotifyUser() const +// class TDriveInterface +TBool TDriveInterface::NotifyUser() const {return(iMount->GetNotifyUser());} diff -r 56f325a607ea -r 0173bcd7697c userlibandfileserver/fileserver/sfat32/sl_cache.cpp --- a/userlibandfileserver/fileserver/sfat32/sl_cache.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/userlibandfileserver/fileserver/sfat32/sl_cache.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -57,7 +57,7 @@ //--------------------------------------------------------------------------------------------------------------------------------- -CMediaWTCache::CMediaWTCache(TFatDriveInterface& aDrive) +CMediaWTCache::CMediaWTCache(TDriveInterface& aDrive) :iDrive(aDrive), iPageSizeLog2(0), iAllPagesValid(EFalse) { iCacheDisabled = EFalse; @@ -86,7 +86,7 @@ @return a pointer to the created object. */ -CMediaWTCache* CMediaWTCache::NewL(TFatDriveInterface& aDrive, TUint32 aNumPages, TUint32 aPageSizeLog2) +CMediaWTCache* CMediaWTCache::NewL(TDriveInterface& aDrive, TUint32 aNumPages, TUint32 aPageSizeLog2) { #ifndef ENABLE_DEDICATED_DIR_CACHE //-- dedicated directory cache isn't enabled diff -r 56f325a607ea -r 0173bcd7697c userlibandfileserver/fileserver/sfat32/sl_cache.h --- a/userlibandfileserver/fileserver/sfat32/sl_cache.h Wed Dec 23 11:43:31 2009 +0000 +++ b/userlibandfileserver/fileserver/sfat32/sl_cache.h Thu Jan 07 13:38:45 2010 +0200 @@ -148,7 +148,7 @@ public: ~CMediaWTCache(); - static CMediaWTCache* NewL(TFatDriveInterface& aDrive, TUint32 aNumPages, TUint32 aPageSizeLog2); + static CMediaWTCache* NewL(TDriveInterface& aDrive, TUint32 aNumPages, TUint32 aPageSizeLog2); void ConstructL(TUint32 aNumPages, TUint32 aPageSizeLog2); @@ -169,7 +169,7 @@ protected: CMediaWTCache(); - CMediaWTCache(TFatDriveInterface& aDrive); + CMediaWTCache(TDriveInterface& aDrive); inline TInt64 CalcPageStartPos(TInt64 aPos) const; inline TUint32 PageSize() const; @@ -182,12 +182,12 @@ TUint32 FindOrGrabReadPageL(TInt64 aPos); protected: - TFatDriveInterface& iDrive; ///< reference to the driver for media access + TDriveInterface& iDrive; ///< reference to the driver for media access TUint32 iPageSizeLog2; ///< Log2 (cache page size) mutable TBool iAllPagesValid;///< ETrue if all cache pages have valid data TInt64 iCacheBasePos; ///< Cache pages base position, used to align them at cluster size RPointerArray iPages; ///< array of pointers to the cache pages. Used for organising LRU list - TUint32 iCacheDisabled :1; ///< if not 0 the cache is disabled totally and all reads and writes go via TFatDriveInterface directly + TUint32 iCacheDisabled :1; ///< if not 0 the cache is disabled totally and all reads and writes go via TDriveInterface directly }; diff -r 56f325a607ea -r 0173bcd7697c userlibandfileserver/fileserver/sfat32/sl_dir_cache.cpp --- a/userlibandfileserver/fileserver/sfat32/sl_dir_cache.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/userlibandfileserver/fileserver/sfat32/sl_dir_cache.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -45,7 +45,7 @@ iValid(EFalse), iLocked(EFalse) { -// __PRINT3(_L("TDynamicDirCachePage::TDynamicDirCachePage(aStartMedPos=%lx, aStartRamAddr=0x%X, aPageSize=%u)"), aStartMedPos, aStartRamAddr, PageSizeInBytes()); + //__PRINT3(_L("TDynamicDirCachePage::TDynamicDirCachePage(aStartMedPos=%lx, aStartRamAddr=0x%X, aPageSize=%u)"), aStartMedPos, aStartRamAddr, PageSizeInBytes()); iType = EUnknown; } @@ -71,7 +71,7 @@ /////////////////////////////// class CDynamicDirCache /////////////////////////// CDynamicDirCache::~CDynamicDirCache() { -// __PRINT(_L("CDynamicDirCache::~CDynamicDirCache()")); + __PRINT(_L("CDynamicDirCache::~CDynamicDirCache()")); // we should never decommit locked pages while (!iLockedQ.IsEmpty()) @@ -93,8 +93,6 @@ } ASSERT(iUnlockedQCount == 0); - delete iActivePage; - ASSERT(iLookupTable.Count() == 0); iLookupTable.Close(); if (iCacheMemoryClient) @@ -108,7 +106,7 @@ @param aMaxPageNum the maximum page number for the cache, includes iActive page, locked pages and unlocked pages. @param aPageSizeInBytesLog2 the log2 value of page size in bytes, assumes page size is always a power of two */ -CDynamicDirCache::CDynamicDirCache(TFatDriveInterface& aDrive, TUint32 aMinPageNum, TUint32 aMaxPageNum, TUint32 aPageSizeInBytesLog2) +CDynamicDirCache::CDynamicDirCache(TDriveInterface& aDrive, TUint32 aMinPageNum, TUint32 aMaxPageNum, TUint32 aPageSizeInBytesLog2) :iPageSizeLog2(aPageSizeInBytesLog2), iMinSizeInPages(aMinPageNum), iMaxSizeInPages(aMaxPageNum), @@ -155,22 +153,30 @@ User::Leave(KErrNoMemory); } - // reserve active page - iActivePage = AllocateAndLockNewPageL(0); - ASSERT(iActivePage); - if (!iActivePage) + + // allocate as many permanently locked pages as there are threads - plus one + // otherwise DoMakePageMRU() won't work properly with only one thread + //-- At present moment the size of TDrive thread pool is 1 (1 drive thread in a pool) + iPermanentlyAllocatedPageCount = 1; + + if (iPermanentlyAllocatedPageCount > iMinSizeInPages) + iMinSizeInPages = iPermanentlyAllocatedPageCount; + + for (TUint n=0; nSetPageType(TDynamicDirCachePage::EActivePage); + } /** Static factory function of CDynamicDirCache */ -CDynamicDirCache* CDynamicDirCache::NewL(TFatDriveInterface& aDrive, TUint32 aMinPageNum, TUint32 aMaxPageNum, TUint32 aPageSizeLog2, const TDesC& aClientName) +CDynamicDirCache* CDynamicDirCache::NewL(TDriveInterface& aDrive, TUint32 aMinPageNum, TUint32 aMaxPageNum, TUint32 aPageSizeLog2, const TDesC& aClientName) { -// __PRINT3(_L("CDynamicDirCache::NewL(MinPageNum=%u, MaxPageNum=%u, page=%u)"), aMinPageNum, aMaxPageNum, 1<ConstructL(aClientName); @@ -215,12 +221,13 @@ } /** -Read data from a single page. If the page is not found or not valid anymore, read media onto iActive page -first. -@param aPos the starting position of the media address to be read. -@param aLength the length of the content to be read. -@param aDes the descriptor to contain the content. -@pre aLength should be no more than page size. + Read data from a single page. If the page is not found or not valid anymore, read media onto iActive page first. + The data will be _Appended_ the the descriptor aDes. The caller is responsible for maintaining this descriptor. + + @param aPos the starting position of the media address to be read. + @param aLength the length of the content to be read. + @param aDes the descriptor to contain the content. + @pre aLength should be no more than page size. */ void CDynamicDirCache::ReadDataFromSinglePageL(TInt64 aPos, TInt aLength, TDes8& aDes) { @@ -231,8 +238,9 @@ // lock page before reading, if (LockPage(pPage) != NULL) { - // read data - aDes.Copy(pPage->PtrInPage(aPos), aLength); + // read data and append them to the descriptor + aDes.Append(pPage->PtrInPage(aPos), aLength); + // if page is from unlocked queue, insert it onto the last page of the locked // queue. this is to avoid excessive locking and unlocking operations that is @@ -258,8 +266,8 @@ { // if page not found or page data not valid anymore, use active page to read data in pPage = UpdateActivePageL(aPos); - // read data - aDes.Copy(pPage->PtrInPage(aPos), aLength); + // read data and append them to the descriptor + aDes.Append(pPage->PtrInPage(aPos), aLength); } } @@ -305,22 +313,19 @@ dataLen -= bytesToPageEnd; currMediaPos += bytesToPageEnd; - TPtr8 dataNext = aDes.MidTPtr(aDes.Length()); - //-- 2. read whole pages of data while (dataLen >= PageSz) { //-- find out if currMediaPos is in cache. If not, find a spare page and read data there - ReadDataFromSinglePageL(currMediaPos, PageSz, dataNext); + ReadDataFromSinglePageL(currMediaPos, PageSz, aDes); currMediaPos += PageSz; dataLen -= PageSz; - dataNext = dataNext.MidTPtr(dataNext.Length()); } //-- 3. read the rest of the data if(dataLen > 0) { - ReadDataFromSinglePageL(currMediaPos, dataLen, dataNext); + ReadDataFromSinglePageL(currMediaPos, dataLen, aDes); } } //else((TUint32)aLength <= bytesToPageEnd) } @@ -372,7 +377,7 @@ } // always make writting events MRU - MakePageMRU(aPos); + DoMakePageMRU(aPos); return; } @@ -447,22 +452,35 @@ } /** -Implementation of pure virtual function. -@see MWTCacheInterface::InvalidateCache() + Invalidate the cache + @see MWTCacheInterface::InvalidateCache() */ -void CDynamicDirCache::InvalidateCache(void) +void CDynamicDirCache::DoInvalidateCache(void) { __PRINT2(_L("CDynamicDirCache::InvalidateCache(locked=%d, unlocked=%d)"), iLockedQCount, iUnlockedQCount); // we should never decommit locked pages as they needs to be reserved anyway // the overhead of unnecessary page committing operations - while(!iLockedQ.IsEmpty()) + + TInt pagesToRemoveFromLockedQueue = iLockedQCount - iPermanentlyAllocatedPageCount; + TInt n; + for (n=0; nStartPos()); // remove from lookuptable + DecommitPage(page); // inform cache client to decommit page memory delete page; } - ASSERT(iLockedQCount == 0); + ASSERT(iLockedQCount == iPermanentlyAllocatedPageCount); + + TDblQueIter q(iLockedQ); + q.SetToFirst(); + while((TDynamicDirCachePage*) q) + { + TDynamicDirCachePage* page = q++; + LookupTblRemove(page->StartPos());// remove from lookuptable + ResetPagePos(page); // reset start media position (0), invalidate page content + } // however we should decommit unlocked pages here while (!iUnlockedQ.IsEmpty()) @@ -475,26 +493,19 @@ } ASSERT(iUnlockedQCount == 0); - ASSERT(iLookupTable.Count() == 0); - iLookupTable.Close(); + ASSERT(iLockedQCount == iPermanentlyAllocatedPageCount); ASSERT(iCacheMemoryClient); - - // initialize cache state. - // Note that once the client is reset, all pages lose connection with the client - // including the active page. So we will need to reset and re-allocate active page - // properly. - if (iCacheMemoryClient) - iCacheMemoryClient->Reset(); - - // reset and re-allocate active page - ResetPagePos(iActivePage); // reset start media position (0), invalidate page content - TUint8* startRamAddr = iCacheMemoryClient->AllocateAndLockSegments(PageSizeInSegs()); - // this should always succeed as the client has just been reset and there are always reserved pages - ASSERT(startRamAddr); - iActivePage->SetStartPtr(startRamAddr); // set RAM address } +/** +Implementation of pure virtual function. +@see MWTCacheInterface::InvalidateCache() +*/ +void CDynamicDirCache::InvalidateCache(void) + { + DoInvalidateCache(); + } /** this method isn't implemented*/ void CDynamicDirCache::InvalidateCachePage(TUint64 /*aPos*/) @@ -633,13 +644,10 @@ return iPageSizeLog2; } -/** -Implementation of pure virtual function. -@see MWTCacheInterface::MakePageMRU() -*/ -void CDynamicDirCache::MakePageMRU(TInt64 aPos) + +void CDynamicDirCache::DoMakePageMRU(TInt64 aPos) { - __PRINT1(_L("MakePageMRU (%lx)"), aPos); +// __PRINT1(_L("MakePageMRU (%lx)"), aPos); // __PRINT4(_L("Current Cache State: iLockedQCount=%d, iUnlockedQCount=%d, iLookupTbl=%d, iMaxSizeInPages=%d"), iLockedQCount, iUnlockedQCount, iLookupTable.Count(), iMaxSizeInPages); // check the MRU page first, if it is already the MRU page, we can return immediately TInt64 pageStartMedPos = CalcPageStartPos(aPos); @@ -689,94 +697,13 @@ // by now, the page is either locked or active page ASSERT(pPage && pPage->IsValid() && pPage->IsLocked()); + + + TBool allocateNewPage = pPage == iLockedQ.Last() && !CacheIsFull(); + + switch (pPage->PageType()) { - // if the page is the active page, we will need to find a new active page for replacement - case TDynamicDirCachePage::EActivePage: - { - TDynamicDirCachePage* newAP = NULL; - // if there is more cache room available, try to create a new page first - if (!CacheIsFull()) - { - // allocate and lock a new page - TRAPD(err, newAP = AllocateAndLockNewPageL(0)); - // if any error ocurrs, return immediately - if (err != KErrNone) - { - // unlock the page that was originally unlocked before leave - if (pPage->PageType() == TDynamicDirCachePage::EUnlocked) - { - UnlockPage(pPage); - } - return; - } - - if (newAP) - { - // replace the active page with the new page - newAP->SetPageType(TDynamicDirCachePage::EActivePage); - iActivePage = newAP; - } - } - - // if cache has grown to its max size, or new page allocation failed - if (!newAP) - { - // try to lock the LRU page on the unlocked page queque first - if (!iUnlockedQ.IsEmpty()) - { - newAP = iUnlockedQ.Last(); - ASSERT(newAP->IsValid()); - if (LockPage(newAP) != NULL) - { - // deque, reset pos, set new type - DeQueue(newAP); - LookupTblRemove(newAP->StartPos()); - ResetPagePos(newAP); - newAP->SetPageType(TDynamicDirCachePage::EActivePage); - // replace active page - iActivePage = newAP; - } - // if falied locking the LRU page from unclocked queque, - // delete it - else - { - DeQueue(newAP); - LookupTblRemove(newAP->StartPos()); - DecommitPage(newAP); - delete newAP; - newAP = NULL; - } - } - } - - // if still have not found new active page - // grab the LRU page from Locked Page Queue for active page - if (!newAP) - { - ASSERT(!iLockedQ.IsEmpty()); - newAP = iLockedQ.Last(); - // deque, reset pos, set new type - DeQueue(newAP); - LookupTblRemove(newAP->StartPos()); - ResetPagePos(newAP); - newAP->SetPageType(TDynamicDirCachePage::EActivePage); - // replace active page - iActivePage = newAP; - } - - // we should always be able to find a locked page for active page - ASSERT(newAP != NULL); - - // make original page (i.e. former active page) MRU - // add onto locked queue - AddFirstOntoQueue(pPage, TDynamicDirCachePage::ELocked); - // add onto lookuptbl, as active page is not on lookup tbl originally - LookupTblAdd(pPage); - // check cache limit - CheckThresholds(); - return; - } case TDynamicDirCachePage::EUnlocked: { // if page was originally on Unlocked Page Queque, remove it from Unlocked Page Queue, add it @@ -785,7 +712,6 @@ AddFirstOntoQueue(pPage, TDynamicDirCachePage::ELocked); // check cache limit CheckThresholds(); - return; } case TDynamicDirCachePage::ELocked: { @@ -795,13 +721,40 @@ { DeQueue(pPage); AddFirstOntoQueue(pPage, TDynamicDirCachePage::ELocked); - return; } break; } default: ASSERT(0); } + + if (allocateNewPage) + { + TDynamicDirCachePage* nPage = NULL; + TRAPD(err, nPage = AllocateAndLockNewPageL(0)); + if (err == KErrNone) + { + + // about to add a page to end of locked queue, so lie about iLockedQCount + iLockedQCount++; + CheckThresholds(); + iLockedQCount--; + + iLockedQ.AddLast(*nPage); + nPage->SetPageType(TDynamicDirCachePage::ELocked); + ++iLockedQCount; + LookupTblAdd(nPage); + } + } + } + +/** + Implementation of pure virtual function. + @see MDiskSpecialAccessor::MakePageMRU() +*/ +void CDynamicDirCache::MakePageMRU(TInt64 aPos) + { + DoMakePageMRU(aPos); } //==================================================================== @@ -810,16 +763,10 @@ */ TDynamicDirCachePage* CDynamicDirCache::FindPageByPos(TInt64 aPos) { - __PRINT1(_L("CDynamicDirCache::FindPageByPos(aPos=%lx)"), aPos); +// __PRINT1(_L("CDynamicDirCache::FindPageByPos(aPos=%lx)"), aPos); // align the page position TInt64 pageStartMedPos = CalcPageStartPos(aPos); - if ((iActivePage->StartPos() == pageStartMedPos)) - { - ASSERT(iActivePage->IsValid()); - return iActivePage; - } - // search in lookup table return LookupTblFind(pageStartMedPos); } @@ -832,29 +779,40 @@ // align the page position TInt64 pageStartMedPos = CalcPageStartPos(aPos); - if (iActivePage->StartPos() == pageStartMedPos && iActivePage->IsValid()) + ASSERT(!iLockedQ.IsEmpty()); + TDynamicDirCachePage* activePage = iLockedQ.Last(); + + if (activePage->StartPos() == pageStartMedPos && activePage->IsValid()) { - return iActivePage; + return activePage; } - __PRINT2(_L("CDynamicDirCache::UpdateActivePageL(aPos=%lx, active=%lx)"), aPos, iActivePage->StartPos()); + __PRINT2(_L("CDynamicDirCache::UpdateActivePageL(aPos=%lx, active=%lx)"), aPos, activePage->StartPos()); + + activePage->Deque(); + LookupTblRemove(activePage->StartPos()); // set start med pos value, no other effects, only available to active page - iActivePage->SetPos(pageStartMedPos); + activePage->SetPos(pageStartMedPos); // read data, make active page valid - TUint8* data = iActivePage->PtrInPage(iActivePage->iStartMedPos); + TUint8* data = activePage->PtrInPage(activePage->iStartMedPos); TPtr8 dataPtr(data, iPageSizeInBytes); - const TInt nErr = iDrive.ReadNonCritical(iActivePage->iStartMedPos, iPageSizeInBytes, dataPtr); + + const TInt nErr = iDrive.ReadNonCritical(activePage->iStartMedPos, iPageSizeInBytes, dataPtr); + + iLockedQ.AddLast(*activePage); + LookupTblAdd(activePage); + if(nErr !=KErrNone) { // some serious problem occured during reading, invalidate cache. - InvalidateCache(); + DoInvalidateCache(); User::Leave(nErr); } - iActivePage->SetValid(ETrue); + activePage->SetValid(ETrue); - return iActivePage; + return activePage; } /** @@ -971,7 +929,7 @@ while((TDynamicDirCachePage*)q) { TDynamicDirCachePage* pP = q++; - __PRINT3(_L("=== CDynamicDirCache::iLockedQ\t[%4d](pos=%lx, size=%d)"), i++, pP->StartPos(), pP->PageSizeInBytes()); + __PRINT5(_L("=== CDynamicDirCache::iLockedQ\t[%4d](pos=%lx, locked=%d, valid=%d, size=%u)"), i++, pP->StartPos(), pP->IsLocked(), pP->IsValid(), pP->PageSizeInBytes()); } } if (!iUnlockedQ.IsEmpty()) @@ -982,10 +940,9 @@ while((TDynamicDirCachePage*)q) { TDynamicDirCachePage* pP = q++; - __PRINT3(_L("=== CDynamicDirCache::iUnlockedQ\t[%4d](pos=%lx, size=%u)"), i++, pP->StartPos(), pP->PageSizeInBytes()); + __PRINT5(_L("=== CDynamicDirCache::iUnlockedQ\t[%4d](pos=%lx, locked=%d, valid=%d, size=%u)"), i++, pP->StartPos(), pP->IsLocked(), pP->IsValid(), pP->PageSizeInBytes()); } } - __PRINT2(_L("=== CDynamicDirCache::iActivePage\t[*](pos=%lx, size=%u)"), iActivePage->StartPos(), iActivePage->PageSizeInBytes()); if (iLookupTable.Count()) { @@ -996,7 +953,7 @@ while(pEntry) { TDynamicDirCachePage* pP = pEntry->iPage; - __PRINT3(_L("=== CDynamicDirCache::iLookupTable\t[%4d](pos=%lx, size=%u)"), i++, pP->StartPos(), pP->PageSizeInBytes()); + __PRINT5(_L("=== CDynamicDirCache::iLookupTable\t[%4d](pos=%lx, locked=%d, valid=%d, size=%u)"), i++, pP->StartPos(), pP->IsLocked(), pP->IsValid(), pP->PageSizeInBytes()); pEntry = (TLookupEntry*) iter.Next(); }; } @@ -1128,13 +1085,6 @@ if (!aPage) return KErrArgument; - // page must be dequed first or it is active page - if (aPage->iType != TDynamicDirCachePage::EActivePage && aPage->iType != TDynamicDirCachePage::EUnknown) - { - ASSERT(0); - return KErrArgument; - } - if (aType == TDynamicDirCachePage::ELocked) { iLockedQ.AddFirst(*aPage); @@ -1219,7 +1169,10 @@ TLookupEntry* entry = iLookupTable.Find(TLookupEntry(aPos, 0, NULL)); if(entry) { - ASSERT(entry->iPage->IsValid()); + // last entry on used queue is used as the 'active' page & may not be valid + if (!entry->iPage->IsValid()) + return NULL; + return entry->iPage; } diff -r 56f325a607ea -r 0173bcd7697c userlibandfileserver/fileserver/sfat32/sl_dir_cache.h --- a/userlibandfileserver/fileserver/sfat32/sl_dir_cache.h Wed Dec 23 11:43:31 2009 +0000 +++ b/userlibandfileserver/fileserver/sfat32/sl_dir_cache.h Thu Jan 07 13:38:45 2010 +0200 @@ -43,7 +43,6 @@ EUnknown, ELocked, EUnlocked, - EActivePage, }; public: @@ -115,7 +114,7 @@ { public: ~CDynamicDirCache(); - static CDynamicDirCache* NewL(TFatDriveInterface& aDrive, TUint32 aMinPageNum, TUint32 aMaxPageNum, TUint32 aPageSizeLog2, const TDesC& aClientName); + static CDynamicDirCache* NewL(TDriveInterface& aDrive, TUint32 aMinPageNum, TUint32 aMaxPageNum, TUint32 aPageSizeLog2, const TDesC& aClientName); //-- overloads from the base class void ReadL (TInt64 aPos, TInt aLength, TDes8& aDes); @@ -137,7 +136,7 @@ void Info() const; protected: - CDynamicDirCache(TFatDriveInterface& aDrive, TUint32 aMinSizeInBytes, TUint32 aMaxSizeInBytes, TUint32 aPageSizeInBytesLog2); + CDynamicDirCache(TDriveInterface& aDrive, TUint32 aMinSizeInBytes, TUint32 aMaxSizeInBytes, TUint32 aPageSizeInBytesLog2); void ConstructL(const TDesC& aClientName); void ReadDataFromSinglePageL(TInt64 aPos, TInt aLength, TDes8& aDes); @@ -159,6 +158,8 @@ TDynamicDirCachePage* LookupTblFind(TInt64 aPos); TInt ResetPagePos(TDynamicDirCachePage* aPage); void MakePageLastLocked(TDynamicDirCachePage* aPage); + void DoMakePageMRU(TInt64 aPos); + void DoInvalidateCache(void); private: TUint32 iPageSizeLog2; ///< log2 value of cache pages size in bytes @@ -169,10 +170,9 @@ TUint32 iPageSizeInBytes; ///< cache page size in bytes TInt64 iCacheBasePos; ///< cache pages base position, used to align them at cluster size - TFatDriveInterface& iDrive; ///< reference to the driver for media access - TUint32 iCacheDisabled : 1; ///< if not 0 the cache is disabled totally and all reads and writes go via TFatDriveInterface directly + TDriveInterface& iDrive; ///< reference to the driver for media access + TUint32 iCacheDisabled : 1; ///< if not 0 the cache is disabled totally and all reads and writes go via TDriveInterface directly - TDynamicDirCachePage* iActivePage; ///< a unique page in cache, used to read new page before make it MRU or have it replaced // data structures for LRU page list TCachePageList iLockedQ; ///< the locked queue that manages all locked pages, limited by minimum page number @@ -186,6 +186,8 @@ RHashSet iLookupTable; ///< a lookup table that used to speed up page look up CCacheMemoryClient* iCacheMemoryClient; ///< interface to cache memory manager + TUint32 iPermanentlyAllocatedPageCount; ///< count of pages in locked queue that are never unlocked + }; #include"sl_dir_cache.inl" diff -r 56f325a607ea -r 0173bcd7697c userlibandfileserver/fileserver/sfat32/sl_disk.cpp --- a/userlibandfileserver/fileserver/sfat32/sl_disk.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/userlibandfileserver/fileserver/sfat32/sl_disk.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -187,11 +187,11 @@ TRAPD(err, ipDirCache = CDynamicDirCache::NewL(iDrive, CacheSizeMinInPages, CacheSizeMaxInPages, PageDataSizeLog2, clientName)); if (err == KErrNone) - { - __PRINT4(_L("CDynamicDirCache::NewL(drv:%C, minPageNum:%u, maxPageNum:%u, pageDataSize:%u)\n"), 'A'+iFatMount->DriveNumber(), CacheSizeMinInPages, CacheSizeMaxInPages, 1<LocalDrive()->SetMount(NULL); @@ -68,7 +68,7 @@ @return KErrBadPower - failure due to low power */ -TInt TFatDriveInterface::ReadNonCritical(TInt64 aPos, TInt aLength, TDes8& aTrg) const +TInt TDriveInterface::ReadNonCritical(TInt64 aPos, TInt aLength, TDes8& aTrg) const { TInt nRes = KErrNone; TInt cntRetry = KMaxRecoverableRetries; @@ -81,7 +81,7 @@ if (nRes==KErrNone) break; - __PRINT4(_L("TFatDriveInterface::ReadNonCritical() failure! drv:%d Posl=%LU len=%d retval=%d"), iMount->DriveNumber(), aPos, aLength, nRes); + __PRINT4(_L("TDriveInterface::ReadNonCritical() failure! drv:%d Posl=%LU len=%d retval=%d"), iMount->DriveNumber(), aPos, aLength, nRes); if(--cntRetry <= 0) { @@ -115,7 +115,7 @@ @return KErrBadPower - failure due to low power */ -TInt TFatDriveInterface::ReadNonCritical(TInt64 aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2 &aMessage,TInt anOffset) const +TInt TDriveInterface::ReadNonCritical(TInt64 aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2 &aMessage,TInt anOffset) const { //__PRINT2(_L("#=+++ Read_nc2: pos:%LU, len:%u"), aPos, aLength); @@ -128,7 +128,7 @@ if (nRes==KErrNone) break; - __PRINT4(_L("TFatDriveInterface::ReadNonCritical() Failure! drv:%d aPosl=%d len=%d anOffset=%d"), iMount->DriveNumber(), aPos,aLength, anOffset); + __PRINT4(_L("TDriveInterface::ReadNonCritical() Failure! drv:%d aPosl=%d len=%d anOffset=%d"), iMount->DriveNumber(), aPos,aLength, anOffset); if(--cntRetry <= 0) { @@ -159,7 +159,7 @@ @return KErrCorrupt - an illegal write is detected @return KErrAbort - user aborted read */ -TInt TFatDriveInterface::ReadCritical(TInt64 aPos,TInt aLength,TDes8& aTrg) const +TInt TDriveInterface::ReadCritical(TInt64 aPos,TInt aLength,TDes8& aTrg) const { //__PRINT2(_L("#=+++ Read_C: pos:%LU, len:%u"), aPos, aLength); @@ -171,7 +171,7 @@ if(nRes == KErrNone) break; - __PRINT4(_L("TFatDriveInterface::ReadCritical() Error! drv:%d Posl=%LU len=%d retval=%d"), iMount->DriveNumber(), aPos, aLength, nRes); + __PRINT4(_L("TDriveInterface::ReadCritical() Error! drv:%d Posl=%LU len=%d retval=%d"), iMount->DriveNumber(), aPos, aLength, nRes); nRes=HandleCriticalError(nRes); if (nRes != ERetry) @@ -198,7 +198,7 @@ @return KErrCorrupt - an illegal write is detected @return KErrAccessDenied - write to protected media */ -TInt TFatDriveInterface::WriteNonCritical(TInt64 aPos, TInt aLength, const TAny* aSrc, const RMessagePtr2 &aMessage, TInt anOffset) +TInt TDriveInterface::WriteNonCritical(TInt64 aPos, TInt aLength, const TAny* aSrc, const RMessagePtr2 &aMessage, TInt anOffset) { //__PRINT2(_L("#=+++ Write_NC: pos:%LU, len:%u"), aPos, aLength); @@ -213,7 +213,7 @@ if (nRes==KErrNone) break; - __PRINT4(_L("TFatDriveInterface::WriteNonCritical() failure! drv:%d, Pos=%LU len=%d anOffset=%d"), iMount->DriveNumber(), aPos, aLength, anOffset); + __PRINT4(_L("TDriveInterface::WriteNonCritical() failure! drv:%d, Pos=%LU len=%d anOffset=%d"), iMount->DriveNumber(), aPos, aLength, anOffset); if(--cntRetry <= 0) { @@ -246,7 +246,7 @@ @return KErrCorrupt - an illegal write is detected @return KErrAccessDenied - write to protected media */ -TInt TFatDriveInterface::WriteCritical(TInt64 aPos, const TDesC8& aSrc) +TInt TDriveInterface::WriteCritical(TInt64 aPos, const TDesC8& aSrc) { //__PRINT2(_L("#=+++ Write_C: pos:%LU, len:%u"), aPos, aSrc.Length()); @@ -282,7 +282,7 @@ nRes = iMount->WriteFailError(); simulatedWriteFailure = ETrue; //-- won't perform actual write later - __PRINT4(_L("TFatDriveInterface::WriteCritical() Simulating write failure. drv:%d, aPos=%LU len=%d Code=%d"), iMount->DriveNumber(), aPos,aSrc.Length(),nRes); + __PRINT4(_L("TDriveInterface::WriteCritical() Simulating write failure. drv:%d, aPos=%LU len=%d Code=%d"), iMount->DriveNumber(), aPos,aSrc.Length(),nRes); } } @@ -303,7 +303,7 @@ } //-- write error occured - __PRINT4(_L("TFatDriveInterface::WriteCritical() failure! drv:%d, aPos=%LU len=%d retval=%d"), iMount->DriveNumber(), aPos,aSrc.Length(),nRes); + __PRINT4(_L("TDriveInterface::WriteCritical() failure! drv:%d, aPos=%LU len=%d retval=%d"), iMount->DriveNumber(), aPos,aSrc.Length(),nRes); nRes=HandleCriticalError(nRes); if (nRes!=ERetry) @@ -324,7 +324,7 @@ @return KErrNone - success, interrogate aErrorInfo for further info @return KErrNotSupported - media driver does not support */ -TInt TFatDriveInterface::GetLastErrorInfo(TDes8& aErrorInfo) const +TInt TDriveInterface::GetLastErrorInfo(TDes8& aErrorInfo) const { return iProxyDrive.GetLastErrorInfo(aErrorInfo); } @@ -342,9 +342,9 @@ @return KErrAccessDenied - media is read only @return KErrCorrupt - cf-card is corrupt */ -TInt TFatDriveInterface::HandleCriticalError(TInt aResult) const +TInt TDriveInterface::HandleCriticalError(TInt aResult) const { - __PRINT2(_L("TFatDriveInterface::HandleCriticalError drv:%d, code:%d"), iMount->DriveNumber(),aResult); + __PRINT2(_L("TDriveInterface::HandleCriticalError drv:%d, code:%d"), iMount->DriveNumber(),aResult); TLocaleMessage line1; TLocaleMessage line2; @@ -456,9 +456,9 @@ @return KErrBadPower - low power failure @return KErrNotReady - non-critical error */ -TInt TFatDriveInterface::HandleRecoverableError(TInt aResult) const +TInt TDriveInterface::HandleRecoverableError(TInt aResult) const { - __PRINT2(_L("TFatDriveInterface::HandleRecoverableError drv:%d, code:%d"), iMount->DriveNumber(),aResult); + __PRINT2(_L("TDriveInterface::HandleRecoverableError drv:%d, code:%d"), iMount->DriveNumber(),aResult); if (aResult==KErrAccessDenied) return(KErrAccessDenied); @@ -486,7 +486,7 @@ } /** @return true if the mount can be remounted for a recoverable error */ -TBool TFatDriveInterface::IsRecoverableRemount() const +TBool TDriveInterface::IsRecoverableRemount() const { if(IsDriveWriteProtected()&&(iMount->Drive().IsWriteableResource()||iMount->Drive().IsCurrentWriteFunction())) return(EFalse); @@ -494,7 +494,7 @@ } /** return true if the media is write protected */ -TBool TFatDriveInterface::IsDriveWriteProtected() const +TBool TDriveInterface::IsDriveWriteProtected() const { TLocalDriveCapsV2Buf localDriveCaps; TInt r=iProxyDrive.Caps(localDriveCaps); @@ -509,7 +509,7 @@ //--------------------------------------------------------------------------------------------------------------------------------------- -TFatDriveInterface::XProxyDriveWrapper::XProxyDriveWrapper() +TDriveInterface::XProxyDriveWrapper::XProxyDriveWrapper() :iLocalDrive(0) { TInt nRes = iLock.CreateLocal(); @@ -518,7 +518,7 @@ } -TFatDriveInterface::XProxyDriveWrapper::~XProxyDriveWrapper() +TDriveInterface::XProxyDriveWrapper::~XProxyDriveWrapper() { iLock.Close(); } @@ -528,7 +528,7 @@ @param aProxyDrive pointer to the raw drive access interface @return true on success */ -TBool TFatDriveInterface::XProxyDriveWrapper::Init(CProxyDrive* aProxyDrive) +TBool TDriveInterface::XProxyDriveWrapper::Init(CProxyDrive* aProxyDrive) { ASSERT(aProxyDrive); if(!iLock.Handle()) //-- the mutex must have been created by constructor @@ -538,9 +538,9 @@ return ETrue; } -//-- see original TFatDriveInterface methods +//-- see original TDriveInterface methods -TInt TFatDriveInterface::XProxyDriveWrapper::Read(TInt64 aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2 &aMessage,TInt anOffset) const +TInt TDriveInterface::XProxyDriveWrapper::Read(TInt64 aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2 &aMessage,TInt anOffset) const { EnterCriticalSection(); TInt nRes = iLocalDrive->Read(aPos, aLength, aTrg, aMessage.Handle(), anOffset); @@ -548,7 +548,7 @@ return nRes; } -TInt TFatDriveInterface::XProxyDriveWrapper::Read(TInt64 aPos,TInt aLength,TDes8& aTrg) const +TInt TDriveInterface::XProxyDriveWrapper::Read(TInt64 aPos,TInt aLength,TDes8& aTrg) const { EnterCriticalSection(); TInt nRes = iLocalDrive->Read(aPos, aLength, aTrg); @@ -556,7 +556,7 @@ return nRes; } -TInt TFatDriveInterface::XProxyDriveWrapper::Write(TInt64 aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2 &aMessage,TInt anOffset) +TInt TDriveInterface::XProxyDriveWrapper::Write(TInt64 aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2 &aMessage,TInt anOffset) { EnterCriticalSection(); TInt nRes = iLocalDrive->Write(aPos, aLength, aSrc, aMessage.Handle(), anOffset); @@ -564,7 +564,7 @@ return nRes; } -TInt TFatDriveInterface::XProxyDriveWrapper::Write(TInt64 aPos, const TDesC8& aSrc) +TInt TDriveInterface::XProxyDriveWrapper::Write(TInt64 aPos, const TDesC8& aSrc) { EnterCriticalSection(); TInt nRes = iLocalDrive->Write(aPos, aSrc); @@ -572,7 +572,7 @@ return nRes; } -TInt TFatDriveInterface::XProxyDriveWrapper::GetLastErrorInfo(TDes8& aErrorInfo) const +TInt TDriveInterface::XProxyDriveWrapper::GetLastErrorInfo(TDes8& aErrorInfo) const { EnterCriticalSection(); TInt nRes = iLocalDrive->GetLastErrorInfo(aErrorInfo); @@ -580,7 +580,7 @@ return nRes; } -TInt TFatDriveInterface::XProxyDriveWrapper::Caps(TDes8& anInfo) const +TInt TDriveInterface::XProxyDriveWrapper::Caps(TDes8& anInfo) const { EnterCriticalSection(); TInt nRes = iLocalDrive->Caps(anInfo); diff -r 56f325a607ea -r 0173bcd7697c userlibandfileserver/fileserver/sfat32/sl_fatcache.h --- a/userlibandfileserver/fileserver/sfat32/sl_fatcache.h Wed Dec 23 11:43:31 2009 +0000 +++ b/userlibandfileserver/fileserver/sfat32/sl_fatcache.h Thu Jan 07 13:38:45 2010 +0200 @@ -110,7 +110,7 @@ TUint16 iFatSecSzLog2; ///< Log2(FAT Sector size) TUint16 iFatClustSzLog2;///< Log2(FAT cluster size) TFatType iFatType; ///< FAT type - TFatDriveInterface* ipDrive;///< interface to the media driver + TDriveInterface* ipDrive;///< interface to the media driver //--- TBool iDirty; ///< ETrue if the cache is dirty diff -r 56f325a607ea -r 0173bcd7697c userlibandfileserver/fileserver/sfat32/sl_fsy.cpp --- a/userlibandfileserver/fileserver/sfat32/sl_fsy.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/userlibandfileserver/fileserver/sfat32/sl_fsy.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -109,50 +109,6 @@ } -void CFatFileSystem::DriveInfo(TDriveInfo& anInfo,TInt aDriveNumber) const -// -// Return the drive info. iBatteryState are already set. -// - { - - if(!IsValidLocalDriveMapping(aDriveNumber)) - return; - - TLocalDriveCapsV2Buf localDriveCaps; - - TInt r = KErrNone; - - // is the drive local? - if (!IsProxyDrive(aDriveNumber)) - { - // if not valid local drive, use default values in localDriveCaps - // if valid local drive and not locked, use TBusLocalDrive::Caps() values - // if valid drive and locked, hard-code attributes - r = GetLocalDrive(aDriveNumber).Caps(localDriveCaps); - } - else // this need to be made a bit nicer - { - CExtProxyDrive* pD = GetProxyDrive(aDriveNumber); - if(pD) - r = pD->Caps(localDriveCaps); - else - r = KErrNotReady; // What should the behaviour really be here? - } - - if (r != KErrLocked ) - { - anInfo.iMediaAtt=localDriveCaps().iMediaAtt; - } - else - { - anInfo.iMediaAtt = KMediaAttLocked | KMediaAttLockable | KMediaAttHasPassword; - } - - anInfo.iType=localDriveCaps().iType; - anInfo.iDriveAtt=localDriveCaps().iDriveAtt; - } - - TBool CFatFileSystem::IsExtensionSupported() const // // diff -r 56f325a607ea -r 0173bcd7697c userlibandfileserver/fileserver/sfat32/sl_mnt.cpp --- a/userlibandfileserver/fileserver/sfat32/sl_mnt.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/userlibandfileserver/fileserver/sfat32/sl_mnt.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -81,8 +81,10 @@ CFatMountCB::CFatMountCB() { __PRINT2(_L("CFatMountCB::CFatMountCB() 0x%x, %S"), this, &KThisFsyName); - iFatType = EInvalid; + + SetFatType(EInvalid); iState = ENotMounted; + DBG_STATEMENT(iCBRecFlag = 0); //-- debug flag only } @@ -232,7 +234,7 @@ /** Try remount this Fat volume. Checks if the volume parameters remained the same as on original MountL() call, and if they are, re-initialises the mount. This includes resetting all caches. - ! Do not call this method from TFatDriveInterface methods, like citical and non-critical notifiers ! This can lead to the + ! Do not call this method from TDriveInterface methods, like citical and non-critical notifiers ! This can lead to the recursive loops and undefined behaviour. @return KErrNone if the remount was OK @@ -437,7 +439,7 @@ /** Open CFatMountCB for write. I.e. perform some actions on the first write attempt. - This is a callback from TFatDriveInterface. + This is a callback from TDriveInterface. @return System wide error code. */ TInt CFatMountCB::OpenMountForWrite() @@ -450,12 +452,12 @@ ASSERT(State() == EInit_R || State() == EFinalised); //-- Check possible recursion. This method must not be called recursively. SetVolumeCleanL() works through direct disc access and - //-- can not call TFatDriveInterface methods that call this method etc. + //-- can not call TDriveInterface methods that call this method etc. ASSERT(iCBRecFlag == 0); DBG_STATEMENT(iCBRecFlag = 1); //-- set recursion check flag //-- do here some "opening" work, like marking volme as dirty - //-- be careful here, as soon as this is a callback from TFatDriveInterface, writing via TFatDriveInterface may cause some unwanted recursion. + //-- be careful here, as soon as this is a callback from TDriveInterface, writing via TDriveInterface may cause some unwanted recursion. //-- mark the volume as dirty TInt nRes=KErrNone; @@ -2251,7 +2253,9 @@ pDirCache->MakePageMRU(mruPos); - // only update the leaf dir cache when the original cache index is provided + //-- if the corresponding leaf directory name is cached, associate the last search positionin this directory. + //-- the next search in this dir. will start from this position (and will wrap around over the dir. beginning). + //-- the "last search position" will is the position of current VFAT entryset start. if (aLeafDir.iClusterNum) { iLeafDirCache->UpdateMRUPos(TLeafDirData(aLeafDir.iClusterNum, aStartEntryPos)); @@ -2277,7 +2281,7 @@ TInt count = 1; iTargetName.Set(aTargetName); - isLegalDosName = IsLegalDosName(aTargetName, ETrue, EFalse, EFalse, ETrue, EFalse); + isLegalDosName = IsLegalDosName(aTargetName, ETrue, EFalse, EFalse, ETrue, EFalse); if(isLegalDosName) {//-- iShortName will contain generated short DOS name by long filename @@ -2501,6 +2505,9 @@ //-- locate the name in the cache first to avoid reading from media //-- if the entry belongs to the root directory (for FAT12,16) skip the lookup, because root directory isn't aligned by cluster size boundary, //-- while directory cache pages are. For FAT32 it doesn't matter, because root dir is a usual file. + + //-- the "rummage dir. cache" can be swithed off. This is not affecting the functionality, only the performance. + #if 1 if(iRawDisk->DirCacheInterface() && trgNameFullySpecified && !IsRootDir(aDosEntryPos) && !aFileCreationHelper) {//-- aName is fully specified, i.e doesn't contain wildcards @@ -2512,6 +2519,8 @@ return(aStartEntry.IsVFatEntry()); } } + #endif + //--------------------------------------------------- // we need to scan ahead from the mru pos then come back to beginning, if startcluster is provided @@ -2655,10 +2664,11 @@ found = ETrue; break; //-- DOS entries match, success. } + } else if (!trgNameFullySpecified) {//-- target name contains wildcards, we need to use MatchF with dos name - TBuf8<0x20> dosName8(DosNameFromStdFormat(aDosEntry.Name())); + TBuf8<0x20> dosName8(DosNameFromStdFormat(aDosEntry.Name())); TBuf<0x20> dosName; LocaleUtils::ConvertToUnicodeL(dosName, dosName8); //-- convert DOS name to unicode (implies locale settings) if (dosName.MatchF(trgtNameNoDot)!=KErrNotFound) @@ -2666,7 +2676,7 @@ found = ETrue; break; } - } + } } @@ -2763,10 +2773,12 @@ TInt64 mruPos = MakeLinAddrL(aDosEntryPos); iRawDisk->DirCacheInterface()->MakePageMRU(mruPos); - // only update the leaf dir cache when the original cache index is provided - if (aLeafDirData.iClusterNum) + //-- if the corresponding leaf directory name is cached, associate the last search positionin this directory. + //-- the next search in this dir. will start from this position (and will wrap around over the dir. beginning). + //-- the "last search position" will is the position of current VFAT entryset start. + if(aLeafDirData.iClusterNum) { - iLeafDirCache->UpdateMRUPos(TLeafDirData(aLeafDirData.iClusterNum, aDosEntryPos)); + iLeafDirCache->UpdateMRUPos(TLeafDirData(aLeafDirData.iClusterNum, aStartEntryPos)); } } @@ -4302,6 +4314,12 @@ if (MaxClusters == 0) return KErrCorrupt; + //-- used for measuring time + TTime timeStart; + TTime timeEnd; + timeStart.UniversalTime(); //-- take start time + + RBitVector bitVec; //-- each bit in this vector represents a FAT cluster TInt nRes = bitVec.Create(MaxClusters); @@ -4321,6 +4339,13 @@ bitVec.Close(); + timeEnd.UniversalTime(); //-- take end time + const TInt msScanTime = (TInt)( (timeEnd.MicroSecondsFrom(timeStart)).Int64() / K1mSec); + (void)msScanTime; + + __PRINT1(_L("#@@@ CheckDisk() time taken:%d ms"), msScanTime); + + switch(r) { @@ -4562,5 +4587,57 @@ return nRes; } - - +//----------------------------------------------------------------------------------------- +/** + Internal helper method. + @param aFatType FAT type + @return End Of Cluster Chain code that depend on FAT type, 0xff8 for FAT12, 0xfff8 for FAT16, and 0xffffff8 for FAT32 +*/ +TUint32 EocCodeByFatType(TFatType aFatType) + { + switch(aFatType) + { + case EFat32: + return EOF_32Bit-7; //-- 0xffffff8 + + case EFat16: + return EOF_16Bit-7; //-- 0xfff8 + + case EFat12: + return EOF_12Bit-7; //-- 0xff8 + + default: + ASSERT(aFatType == EInvalid); + return 0; + } + + } + +//----------------------------------------------------------------------------------------- +/** + Set FAT type that this object of CFatMountCB will be dealing with. +*/ +void CFatMountCB::SetFatType(TFatType aFatType) + { + ASSERT(State() == ENotMounted || State() == EDismounted || State() == EMounting) ; + + iFatType = aFatType; + iFatEocCode = EocCodeByFatType(aFatType); + } + + + + + + + + + + + + + + + + + diff -r 56f325a607ea -r 0173bcd7697c userlibandfileserver/fileserver/sfat32/sl_mnt32.cpp --- a/userlibandfileserver/fileserver/sfat32/sl_mnt32.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/userlibandfileserver/fileserver/sfat32/sl_mnt32.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -235,7 +235,7 @@ //-- further read and write will be directly from the CProxyDrive, bypassing FAT cache. //-- this is because CFatTable doesn't allow access to FAT[0] & FAT[1] - //-- We also need to write data through CProxyDrive, because TFatDriveInterface has a call back that can call this method + //-- We also need to write data through CProxyDrive, because TDriveInterface has a call back that can call this method if(Is32BitFat()) {//-- Fat32 @@ -323,8 +323,8 @@ TBool CFatMountCB::VolumeCleanL() { - //-- read access to the FAT is through TFatDriveInterface, because CFatTable doesn't allow access to FAT[1] - TFatDriveInterface& drive =DriveInterface(); + //-- read access to the FAT is through TDriveInterface, because CFatTable doesn't allow access to FAT[1] + TDriveInterface& drive =DriveInterface(); if(Is32BitFat()) {//-- Fat32 @@ -412,7 +412,7 @@ bootSector.PrintDebugInfo(); //-- determine FAT type by data from boot sector. This is done by counting number of clusters, not by BPB_RootEntCnt - iFatType = bootSector.FatType(); + SetFatType(bootSector.FatType()); ASSERT(iFatType != EInvalid); //-- this shall be checked in ReadBootSector() @@ -421,7 +421,7 @@ //-- than required for FAT32. Probably this is incorrectly FAT32 formatted media. Put the drive into ReadOnly mode, assuming //-- that is FAT32. __PRINT(_L("FAT type mismatch! Setting drive to ReadOnly mode for FAT32. \n")); - iFatType = EFat32; //-- force FAT type to be FAT32 + SetFatType(EFat32); //-- force FAT type to be FAT32 SetReadOnly(ETrue); } @@ -629,43 +629,13 @@ return KErrNone; } -/** -Checks for end of file for all Fat types - -@param aCluster Cluster to check -@return Result of test -*/ -TBool CFatMountCB::IsEndOfClusterCh(TInt aCluster) const - { - if(Is32BitFat()) - return(aCluster>=(TInt)0x0FFFFFF8 && aCluster<=(TInt)0x0FFFFFFF); - else if(Is16BitFat()) - return(aCluster>=0xFFF8 && aCluster<=0xFFFF); - else - return(aCluster>=0xFF8 && aCluster<=0xFFF); - } /** -Set a cluster to the end of cluster chain marker + Initialize data to represent the root directory -@param aCluster cluster to set to end of chain marker + @param anEntry Entry to initialise */ -void CFatMountCB::SetEndOfClusterCh(TInt &aCluster) const - { - if(Is32BitFat()) - aCluster=EOF_32Bit; - else if(Is16BitFat()) - aCluster=EOF_16Bit; - else - aCluster=EOF_12Bit; - } - -/** -Initialize data to represent the root directory - -@param anEntry Entry to initialise -*/ -void CFatMountCB::InitializeRootEntry(TFatDirEntry & anEntry) const +void CFatMountCB::InitializeRootEntry(TFatDirEntry& anEntry) const { anEntry.SetName(_L8("ROOT")); anEntry.SetAttributes(KEntryAttDir); @@ -675,21 +645,21 @@ /** -Implementation of CMountCB::FileSystemSubType(). Retrieves the sub type of Fat file system -and returns the name as a descriptor. + Implementation of CMountCB::FileSystemSubType(). Retrieves the sub type of Fat file system + and returns the name as a descriptor. -@param aName Name of the sub type of Fat file system -@return KErrNone if successful; KErrArgument if aName is not long enough; KErrNotReady if - the mount is not ready. + @param aName Name of the sub type of Fat file system + @return KErrNone if successful; KErrArgument if aName is not long enough; KErrNotReady if + the mount is not ready. -@see CMountCB::FileSystemSubType() + @see CMountCB::FileSystemSubType() */ TInt CFatMountCB::SubType(TDes& aName) const { if(aName.MaxLength() < 5) return KErrArgument; - switch (iFatType) + switch (FatType()) { case EFat12: { diff -r 56f325a607ea -r 0173bcd7697c userlibandfileserver/fileserver/sfat32/sl_scan32.cpp --- a/userlibandfileserver/fileserver/sfat32/sl_scan32.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/userlibandfileserver/fileserver/sfat32/sl_scan32.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -702,17 +702,6 @@ } -static inline TBool BoolXOR(TBool a1, TBool a2) - { - if(!a1 && !a2) - return EFalse; - else if(a1 && a2) - return EFalse; - else - return ETrue; - } - - /** Scan for differnces in the new and old FAT table writing them to media if discovered diff -r 56f325a607ea -r 0173bcd7697c userlibandfileserver/fileserver/sfat32/sl_utl.cpp --- a/userlibandfileserver/fileserver/sfat32/sl_utl.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/userlibandfileserver/fileserver/sfat32/sl_utl.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -39,18 +39,7 @@ TUint32 Log2(TUint32 aVal) { - __ASSERT_COMPILE(sizeof(TUint32) == 4); - ASSERT(aVal); - - TUint32 bitPos=31; - - if(!(aVal >> 16)) {bitPos-=16; aVal<<=16;} - if(!(aVal >> 24)) {bitPos-=8; aVal<<=8 ;} - if(!(aVal >> 28)) {bitPos-=4; aVal<<=4 ;} - if(!(aVal >> 30)) {bitPos-=2; aVal<<=2 ;} - if(!(aVal >> 31)) {bitPos-=1;} - - return bitPos; + return Log2_inline(aVal); } diff -r 56f325a607ea -r 0173bcd7697c userlibandfileserver/fileserver/sfile/Sf_plugin_util.cpp --- a/userlibandfileserver/fileserver/sfile/Sf_plugin_util.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/userlibandfileserver/fileserver/sfile/Sf_plugin_util.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -561,7 +561,9 @@ */ LOCAL_C TInt FileEntryVars(CFsRequest* aRequest, TDes& aName) { - __ASSERT_ALWAYS(aRequest->Operation()->Function()==EFsEntry,Fault(EBaseRequestMessage)); + __ASSERT_ALWAYS(aRequest->Operation()->Function()==EFsEntry || + aRequest->Operation()->Function()==EFsSetEntry, + Fault(EBaseRequestMessage)); aName = aRequest->Src().FullName(); @@ -721,6 +723,7 @@ err = FileCloseVars(aRequest->Request(), aName); break; case EFsEntry: + case EFsSetEntry: err = FileEntryVars(aRequest->Request(), aName); break; case EFsReadFileSection: diff -r 56f325a607ea -r 0173bcd7697c userlibandfileserver/fileserver/sfile/sf_dat.cpp --- a/userlibandfileserver/fileserver/sfile/sf_dat.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/userlibandfileserver/fileserver/sfile/sf_dat.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -549,3 +549,50 @@ return(EFalse); } +/** + Obtain drive information. This function is called by the default implementation of CFileSystem::DriveInfo(). + @param anInfo out: drive information + @param aDriveNumber drive number +*/ +EXPORT_C void GetDriveInfo(TDriveInfo& anInfo, TInt aDriveNumber) + { + if(!IsValidLocalDriveMapping(aDriveNumber)) + return; + + TLocalDriveCapsBuf localDriveCaps; + + TInt r = KErrNone; + + // is the drive local? + if (!IsProxyDrive(aDriveNumber)) + { + // if not valid local drive, use default values in localDriveCaps + // if valid local drive and not locked, use TBusLocalDrive::Caps() values + // if valid drive and locked, hard-code attributes + r = GetLocalDrive(aDriveNumber).Caps(localDriveCaps); + } + else + { + CExtProxyDrive* pD = GetProxyDrive(aDriveNumber); + __ASSERT_ALWAYS(pD != NULL,User::Panic(_L("GetDriveInfo - pProxyDrive == NULL"), -999)); + r = pD->Caps(localDriveCaps); + } + + TLocalDriveCaps& caps = localDriveCaps(); + if (r != KErrLocked) + { + anInfo.iMediaAtt=caps.iMediaAtt; + } + else + { + anInfo.iMediaAtt = KMediaAttLocked | KMediaAttLockable | KMediaAttHasPassword; + } + + anInfo.iType=caps.iType; + anInfo.iDriveAtt=caps.iDriveAtt; + anInfo.iConnectionBusType=caps.iConnectionBusType; + } + + + + diff -r 56f325a607ea -r 0173bcd7697c userlibandfileserver/fileserver/sfile/sf_drv.cpp --- a/userlibandfileserver/fileserver/sfile/sf_drv.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/userlibandfileserver/fileserver/sfile/sf_drv.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -17,8 +17,6 @@ #include "sf_std.h" #include "sf_file_cache.h" -#include - //const TInt KMaxNotifierAttempts=4; // not used anywhere @@ -885,29 +883,8 @@ { anInfo.iType=EMediaNotPresent; anInfo.iMediaAtt=0; - - TInt batStatus=HAL::EPowerBatteryStatus_Zero; - TInt r=HAL::Get(HAL::EPowerBatteryStatus, batStatus); - if (r==KErrNone) - { - switch(batStatus) - { - case HAL::EPowerBatteryStatus_Zero: - anInfo.iBattery=EBatLow; - break; - case HAL::EPowerBatteryStatus_Replace: - anInfo.iBattery=EBatLow; - break; - case HAL::EPowerBatteryStatus_Low: - anInfo.iBattery=EBatLow; - break; - case HAL::EPowerBatteryStatus_Good: - anInfo.iBattery=EBatGood; - break; - } - } - else - anInfo.iBattery=EBatNotSupported; + anInfo.iBattery=EBatNotSupported; + anInfo.iConnectionBusType=EConnectionBusInternal; if(iFSys) { diff -r 56f325a607ea -r 0173bcd7697c userlibandfileserver/fileserver/sfile/sf_image.h --- a/userlibandfileserver/fileserver/sfile/sf_image.h Wed Dec 23 11:43:31 2009 +0000 +++ b/userlibandfileserver/fileserver/sfile/sf_image.h Thu Jan 07 13:38:45 2010 +0200 @@ -20,6 +20,7 @@ #include #include #include +#include #include #include "sf_deflate.h" diff -r 56f325a607ea -r 0173bcd7697c userlibandfileserver/fileserver/sfile/sf_plugin.cpp --- a/userlibandfileserver/fileserver/sfile/sf_plugin.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/userlibandfileserver/fileserver/sfile/sf_plugin.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -629,6 +629,7 @@ switch(Function()) { case EFsDirOpen: + case EFsSetEntry: { aName.Copy(Request()->Src().FullName()); break; diff -r 56f325a607ea -r 0173bcd7697c userlibandfileserver/fileserver/sfile/sf_sys.cpp --- a/userlibandfileserver/fileserver/sfile/sf_sys.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/userlibandfileserver/fileserver/sfile/sf_sys.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -159,6 +159,12 @@ return(EFalse); } +EXPORT_C void CFileSystem::DriveInfo(TDriveInfo& aInfo, TInt aDriveNumber) const + { + GetDriveInfo(aInfo, aDriveNumber); + } + + EXPORT_C TInt CFileSystem::GetInterface(TInt /*aInterfaceId*/,TAny*& /*aInterface*/,TAny* /*aInput*/) { return(KErrNotSupported); diff -r 56f325a607ea -r 0173bcd7697c userlibandfileserver/fileserver/sfsrv/cl_cli.cpp --- a/userlibandfileserver/fileserver/sfsrv/cl_cli.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/userlibandfileserver/fileserver/sfsrv/cl_cli.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -644,12 +644,15 @@ /** Gets the name of the file system mounted on the specified drive. - The function can be called before calling DismountFileSystem(). @param aName On successful return, contains the name of the file system. @param aDrive The drive for which the file system name is required. + Note that the file system name, returned in the aName descriptor shall be threated as case-insensitive string. I.e. + "fileSystem" and "FILESYSTEM" mean absolutely the same. Therefore, case-insensitive string methods (like TDesC::FindF(), TDesC::CompareF()) + shall be used to deal with the names. + @return KErrNone, if successful; KErrNotFound if aFileSystemName is not found, or the drive does not have a file system mounted on it; KErrArgument, if the drive value is outside the valid range, i.e. zero to KMaxDrives-1 inclusive. @@ -676,6 +679,10 @@ If "automatic file system recognising" feature is not supported, the list will consist of just one name, and this will be the name returned by RFs::FileSystemName() API. + Note that the file system name, returned in the aName descriptor shall be threated as case-insensitive string. I.e. + "fileSystem" and "FILESYSTEM" mean absolutely the same. Therefore, case-insensitive string methods (like TDesC::FindF(), TDesC::CompareF()) + shall be used to deal with the names. + @param aName On successful return, contains the name of the file system that correspond to the aFsEnumerator value. m@param aDrive The drive number @param aFsEnumerator The supported file system enumerator. can be: @@ -3741,24 +3748,29 @@ } +/** + This function queries the sub type of the file system mounted on the specified volume. For example, 'FAT16' of the Fat file system. + TFSName is recommended as the type for aName when using this function. + + NOTE: For the file systems without a sub type (e.g. ROM file system), the the file system name is returned (For example, 'Rom'). + Examples: + "FAT" file system; the subtypes can be "fat12", "fat16" or "fat32" + "ROFS" file system; the subtype will be "ROFS" + + Note also that the file system name, returned in the aName descriptor shall be threated as case-insensitive string. I.e. + "fileSystem" and "FILESYSTEM" mean absolutely the same. Therefore, case-insensitive string methods (like TDesC::FindF(), TDesC::CompareF()) + shall be used to deal with the names. + + + @param aDrive drive number, specifies which volume to query. + @param aName descriptor containing the returned sub type name or file system name. + + @return KErrNone if successful; KErrNotSuppoted if sub type is not supported; + otherwise another system-wide error code is returned. + + @see TFSName +*/ EFSRV_EXPORT_C TInt RFs::FileSystemSubType(TInt aDrive, TDes& aName) const -/** -This function queries the sub type of the file system mounted on the specified volume. For example, 'FAT16' -of the Fat file system. - -TFSName is recommended as the type for aName when using this function. - -NOTE: File systems without a sub type (For example, a ROM file system), the name of the file system is -returned (For example, 'Rom'). - -@param aDrive A drive number, specifies which volume to query. -@param aName A descriptor containing the returned sub type name or file system name. - -@return KErrNone if successful; KErrNotSuppoted if sub type is not supported; - otherwise another system-wide error code is returned. - -@see TFSName -*/ { TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFsFileSystemSubType, MODULEUID, Handle(), aDrive, aName); diff -r 56f325a607ea -r 0173bcd7697c userlibandfileserver/fileserver/shostmassstorage/client/rusbhostmslogicalunit.cpp --- a/userlibandfileserver/fileserver/shostmassstorage/client/rusbhostmslogicalunit.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/userlibandfileserver/fileserver/shostmassstorage/client/rusbhostmslogicalunit.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -19,7 +19,6 @@ */ #include -#include #include "msgservice.h" #include "rusbhostmsdevice.h" diff -r 56f325a607ea -r 0173bcd7697c userlibandfileserver/fileserver/shostmassstorage/msproxy/hostusbmsproxy.cpp --- a/userlibandfileserver/fileserver/shostmassstorage/msproxy/hostusbmsproxy.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/userlibandfileserver/fileserver/shostmassstorage/msproxy/hostusbmsproxy.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -535,31 +535,32 @@ TLocalDriveCapsV6Buf caps; caps.FillZ(); - caps().iType = EMediaHardDisk; - caps().iBattery = EBatNotSupported; - caps().iDriveAtt = KDriveAttLocal | KDriveAttRemovable; - caps().iMediaAtt = KMediaAttFormattable; - caps().iFileSystemId = KDriveFileSysFAT; - caps().iExtraInfo = EFalse; + TLocalDriveCapsV6& c = caps(); + + c.iType = EMediaHardDisk; + c.iConnectionBusType = EConnectionBusUsb; + c.iDriveAtt = KDriveAttLocal | KDriveAttRemovable | KDriveAttExternal; + c.iMediaAtt = KMediaAttFormattable; + c.iFileSystemId = KDriveFileSysFAT; TCapsInfo capsInfo; TInt r = iUsbHostMsLun.Caps(capsInfo); if (KErrNone == r) { - caps().iBlockSize = capsInfo.iBlockLength; + c.iBlockSize = capsInfo.iBlockLength; TUint64 size = iMsDataMemMap.DataSize(); if (size == 0) { // No valid partitions so specify the size of the disk size = static_cast(capsInfo.iNumberOfBlocks) * capsInfo.iBlockLength; } - caps().iSize = size; + c.iSize = size; - caps().iEraseBlockSize = 0; + c.iEraseBlockSize = 0; if (capsInfo.iWriteProtect) { - caps().iMediaAtt |= KMediaAttWriteProtected; + c.iMediaAtt |= KMediaAttWriteProtected; } __HOSTPRINT4(_L("<<< HOST Caps Block[num=0x%x size=0x%x] Media[size=0x%lx WP=0x%x]"), capsInfo.iNumberOfBlocks, capsInfo.iBlockLength, @@ -568,7 +569,7 @@ else { __HOSTPRINT(_L("<<< HOST Caps Media Not Present")); - caps().iType = EMediaNotPresent; + c.iType = EMediaNotPresent; if(r != KErrNotReady) r = KErrUnknown; } diff -r 56f325a607ea -r 0173bcd7697c userlibandfileserver/fileserver/shostmassstorage/msproxy/tmsmemmap.cpp --- a/userlibandfileserver/fileserver/shostmassstorage/msproxy/tmsmemmap.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/userlibandfileserver/fileserver/shostmassstorage/msproxy/tmsmemmap.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -25,9 +25,7 @@ */ #include -#include #include -#include #include "tmsmemmap.h" #include "debug.h" diff -r 56f325a607ea -r 0173bcd7697c userlibandfileserver/fileserver/shostmassstorage/server/controller/cusbhostmsdevicethread.cpp --- a/userlibandfileserver/fileserver/shostmassstorage/server/controller/cusbhostmsdevicethread.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/userlibandfileserver/fileserver/shostmassstorage/server/controller/cusbhostmsdevicethread.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -257,8 +257,8 @@ iQueueFull(EFalse) { __MSFNLOG - TBuf<30> nameBuf; - nameBuf.Format(_L("Host Ms ThreadMutex%d"), aToken); + TBuf<32> nameBuf; + nameBuf.Format(_L("Host Ms ThreadMutex%8x"), aToken); iMutex.CreateGlobal(nameBuf,EOwnerProcess); } diff -r 56f325a607ea -r 0173bcd7697c userlibandfileserver/fileserver/shostmassstorage/server/controller/include/cusbhostmslogicalunit.h --- a/userlibandfileserver/fileserver/shostmassstorage/server/controller/include/cusbhostmslogicalunit.h Wed Dec 23 11:43:31 2009 +0000 +++ b/userlibandfileserver/fileserver/shostmassstorage/server/controller/include/cusbhostmslogicalunit.h Thu Jan 07 13:38:45 2010 +0200 @@ -24,6 +24,8 @@ class MTransport; class MProtocol; +class THostMassStorageConfig; +class TReadWrite; /** This class represents a Logical Unit supporting SCSI Mass Storage Class. The diff -r 56f325a607ea -r 0173bcd7697c userlibandfileserver/fileserver/shostmassstorage/server/controller/tlogicalunitlist.cpp --- a/userlibandfileserver/fileserver/shostmassstorage/server/controller/tlogicalunitlist.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/userlibandfileserver/fileserver/shostmassstorage/server/controller/tlogicalunitlist.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -18,23 +18,12 @@ @internalTechnology */ + #include -#include -#include -#include #include "msctypes.h" -#include "mscutils.h" -#include "shared.h" -#include "msgservice.h" -#include "botmsctypes.h" - -#include "mprotocol.h" -#include "mtransport.h" -#include "cbulkonlytransport.h" #include "cusbhostmslogicalunit.h" -#include "cusbhostmsdevice.h" -#include "cusbmssuspendresume.h" +#include "tlogicalunitlist.h" #include "msdebug.h" #include "debug.h" diff -r 56f325a607ea -r 0173bcd7697c userlibandfileserver/fileserver/shostmassstorage/server/protocol/cmassstoragefsm.cpp --- a/userlibandfileserver/fileserver/shostmassstorage/server/protocol/cmassstoragefsm.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/userlibandfileserver/fileserver/shostmassstorage/server/protocol/cmassstoragefsm.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -19,7 +19,6 @@ */ #include -#include #include "usbmshostpanic.h" #include "debug.h" diff -r 56f325a607ea -r 0173bcd7697c userlibandfileserver/fileserver/shostmassstorage/server/protocol/cscsiprotocol.cpp --- a/userlibandfileserver/fileserver/shostmassstorage/server/protocol/cscsiprotocol.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/userlibandfileserver/fileserver/shostmassstorage/server/protocol/cscsiprotocol.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -260,7 +260,15 @@ TLba lastLba; TUint32 blockLength; - TInt err = iSbcInterface->ReadCapacity10L(lastLba, blockLength); + // Retry ReadCapacity10L if stalled + TInt stallCounter = 4; + TInt err = KErrNone; + do + { + err = iSbcInterface->ReadCapacity10L(lastLba, blockLength); + } while (err == KErrCommandStalled && stallCounter-- > 0); + + if (err) { if (err == KErrCommandFailed) diff -r 56f325a607ea -r 0173bcd7697c userlibandfileserver/fileserver/shostmassstorage/server/protocol/tsbcclientinterface.cpp --- a/userlibandfileserver/fileserver/shostmassstorage/server/protocol/tsbcclientinterface.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/userlibandfileserver/fileserver/shostmassstorage/server/protocol/tsbcclientinterface.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -19,7 +19,7 @@ */ #include -#include + #include "msdebug.h" #include "debug.h" #include "msctypes.h" diff -r 56f325a607ea -r 0173bcd7697c userlibandfileserver/fileserver/shostmassstorage/server/protocol/tscsiclientreq.cpp --- a/userlibandfileserver/fileserver/shostmassstorage/server/protocol/tscsiclientreq.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/userlibandfileserver/fileserver/shostmassstorage/server/protocol/tscsiclientreq.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -19,7 +19,7 @@ */ #include -#include + #include "debug.h" #include "msdebug.h" #include "mprotocol.h" diff -r 56f325a607ea -r 0173bcd7697c userlibandfileserver/fileserver/shostmassstorage/server/protocol/tscsiprimarycmds.cpp --- a/userlibandfileserver/fileserver/shostmassstorage/server/protocol/tscsiprimarycmds.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/userlibandfileserver/fileserver/shostmassstorage/server/protocol/tscsiprimarycmds.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -21,7 +21,6 @@ */ #include -#include #include "msctypes.h" #include "debug.h" diff -r 56f325a607ea -r 0173bcd7697c userlibandfileserver/fileserver/shostmassstorage/server/protocol/tspcclientinterface.cpp --- a/userlibandfileserver/fileserver/shostmassstorage/server/protocol/tspcclientinterface.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/userlibandfileserver/fileserver/shostmassstorage/server/protocol/tspcclientinterface.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -19,7 +19,6 @@ */ #include -#include #include "debug.h" #include "msdebug.h" diff -r 56f325a607ea -r 0173bcd7697c userlibandfileserver/fileserver/shostmassstorage/server/src/cusbhostmssession.cpp --- a/userlibandfileserver/fileserver/shostmassstorage/server/src/cusbhostmssession.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/userlibandfileserver/fileserver/shostmassstorage/server/src/cusbhostmssession.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -115,12 +115,7 @@ } break; /* If it is a cleanup then we need to delete the iDeviceThread */ - case EUsbHostMsFinalCleanup: - if(iDeviceThread->IsActive()) - { - iThread.RequestComplete(iClientStatus, KErrSessionClosed); - } - + case EUsbHostMsFinalCleanup: delete iDeviceThread; iThread.Kill(KErrNone); aMessage.Complete(KErrNone); @@ -155,8 +150,8 @@ aMessage.ReadL(0, ptr); __HOSTPRINT1(_L("EUsbHostMsRegisterInterface Token=%d "), msDeviceConfig.iInterfaceToken); - TBuf<20> nameBuf; - nameBuf.Format(_L("Host Ms Thread%d"), msDeviceConfig.iInterfaceToken); + TBuf<32> nameBuf; + nameBuf.Format(_L("Host Ms Thread%8x"), msDeviceConfig.iInterfaceToken); iDeviceThread = CUsbHostMsDeviceThread::NewL(*this, msDeviceConfig.iInterfaceToken); RHeap* h = (RHeap*)&User::Allocator(); @@ -177,11 +172,6 @@ User::WaitForRequest(status); if(status != KErrNone) { - if(iDeviceThread->IsActive()) - { - iThread.RequestComplete(iClientStatus, KErrSessionClosed); - } - iDeviceThread->Cancel(); delete iDeviceThread; iDeviceThread = NULL; iThread.Kill(KErrNone); diff -r 56f325a607ea -r 0173bcd7697c userlibandfileserver/fileserver/shostmassstorage/server/src/entry.cpp --- a/userlibandfileserver/fileserver/shostmassstorage/server/src/entry.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/userlibandfileserver/fileserver/shostmassstorage/server/src/entry.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -19,13 +19,7 @@ */ #include -#include -#include "msctypes.h" -#include "shared.h" -#include "msgservice.h" -#include "cusbhostmslogicalunit.h" -#include "cusbhostmsdevice.h" #include "cusbhostmsserver.h" static void RunServerL() diff -r 56f325a607ea -r 0173bcd7697c userlibandfileserver/fileserver/srofs/sr_rofs.cpp --- a/userlibandfileserver/fileserver/srofs/sr_rofs.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/userlibandfileserver/fileserver/srofs/sr_rofs.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -17,6 +17,7 @@ #include #include "sr_rofs.h" #include +#include void CRofs::Panic( TPanic aPanic ) { diff -r 56f325a607ea -r 0173bcd7697c userlibandfileserver/fileserver/srom/sr_std.h --- a/userlibandfileserver/fileserver/srom/sr_std.h Wed Dec 23 11:43:31 2009 +0000 +++ b/userlibandfileserver/fileserver/srom/sr_std.h Thu Jan 07 13:38:45 2010 +0200 @@ -25,6 +25,7 @@ #include #include #include +#include #if defined(__EPOC32__) // #define __PRINT_DEBUG_INFO_SR_STD__ 1 diff -r 56f325a607ea -r 0173bcd7697c userlibandfileserver/fileserver/swins/elocal.cpp --- a/userlibandfileserver/fileserver/swins/elocal.cpp Wed Dec 23 11:43:31 2009 +0000 +++ b/userlibandfileserver/fileserver/swins/elocal.cpp Thu Jan 07 13:38:45 2010 +0200 @@ -1713,7 +1713,7 @@ void CLocal::DriveInfo(TDriveInfo& anInfo,TInt aDriveNumber) const // -// Return the drive info. iBatteryState already set. +// Return the drive info. // { @@ -1725,6 +1725,7 @@ anInfo.iType=EMediaRom; anInfo.iMediaAtt=KMediaAttWriteProtected; anInfo.iDriveAtt=KDriveAttRom|KDriveAttInternal; + anInfo.iConnectionBusType=EConnectionBusInternal; return; } if (aDriveNumber==EDriveC) @@ -1732,6 +1733,7 @@ anInfo.iType=EMediaHardDisk; anInfo.iMediaAtt=KMediaAttVariableSize; anInfo.iDriveAtt=KDriveAttLocal|KDriveAttInternal; + anInfo.iConnectionBusType=EConnectionBusInternal; return; } TFileName envValue; @@ -1739,6 +1741,7 @@ { anInfo.iType=EMediaHardDisk; anInfo.iDriveAtt=KDriveAttLocal|KDriveAttInternal; + anInfo.iConnectionBusType=EConnectionBusInternal; return; } anInfo.iType=EMediaNotPresent;