--- a/halservices/hal/bld.inf Sat Feb 20 00:10:51 2010 +0200
+++ b/halservices/hal/bld.inf Fri Mar 12 15:50:11 2010 +0200
@@ -26,9 +26,9 @@
BASEUSERDEFAULT
PRJ_EXPORTS
-inc/hal_int.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(kernel/)
-inc/hal_data.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(hal_data.h)
-inc/hal.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(hal.h)
+inc/hal_int.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(kernel/)
+inc/hal_data.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(hal_data.h)
+inc/hal.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(hal.h)
rom/hal.iby /epoc32/rom/hal/ //
rom/hal.hby /epoc32/rom/hal/ //
--- a/kernel/eka/drivers/dma/dmapil.cpp Sat Feb 20 00:10:51 2010 +0200
+++ b/kernel/eka/drivers/dma/dmapil.cpp Fri Mar 12 15:50:11 2010 +0200
@@ -861,30 +861,55 @@
// release threads doing CancelAll()
waiters->Signal();
}
- else if (!error && !iDfc.Queued() && !iReqQ.IsEmpty() && iController->IsIdle(*this))
+ else if (!error && iController->IsIdle(*this) && !iReqQ.IsEmpty() && !iDfc.Queued())
{
- __KTRACE_OPT(KDMA, Kern::Printf("Missed interrupt(s) - draining request queue"));
- ResetStateMachine();
-
- // Move orphaned requests to temporary queue so channel queue can
- // accept new requests.
- SDblQue q;
- q.MoveFrom(&iReqQ);
+ // Wait for a bit. If during that time the condition goes away then it
+ // was a 'spurious missed interrupt', in which case we just do nothing.
+ TBool spurious = EFalse;
+ const TUint32 nano_secs_per_loop = 1000 * 1000; // 1ms
+ for (TInt i = 5; i > 0; i--)
+ {
+ if (!iController->IsIdle(*this))
+ {
+ __KTRACE_OPT(KDMA, Kern::Printf("DMAC no longer idle (i = %d)", i));
+ spurious = ETrue;
+ break;
+ }
+ else if (iDfc.Queued())
+ {
+ __KTRACE_OPT(KDMA, Kern::Printf("DFC now queued (i = %d)", i));
+ spurious = ETrue;
+ break;
+ }
+ Kern::NanoWait(nano_secs_per_loop);
+ }
+ if (!spurious)
+ {
+ __KTRACE_OPT(KDMA,
+ Kern::Printf("Missed interrupt(s) - draining request queue on ch %d",
+ PslId()));
+ ResetStateMachine();
- SDblQueLink* pL;
- while ((pL = q.GetFirst()) != NULL)
- {
- iQueuedRequests--;
- DDmaRequest* pR = _LOFF(pL, DDmaRequest, iLink);
- __KTRACE_OPT(KDMA, Kern::Printf("Removing request from queue and notifying client"));
- pR->OnDeque();
- DDmaRequest::TCallback cb = pR->iCb;
- TAny* arg = pR->iCbArg;
- if (cb)
+ // Move orphaned requests to temporary queue so channel queue can
+ // accept new requests.
+ SDblQue q;
+ q.MoveFrom(&iReqQ);
+
+ SDblQueLink* pL;
+ while ((pL = q.GetFirst()) != NULL)
{
- Signal();
- (*cb)(DDmaRequest::EOk, arg);
- Wait();
+ iQueuedRequests--;
+ DDmaRequest* pR = _LOFF(pL, DDmaRequest, iLink);
+ __KTRACE_OPT(KDMA, Kern::Printf("Removing request from queue and notifying client"));
+ pR->OnDeque();
+ DDmaRequest::TCallback cb = pR->iCb;
+ TAny* arg = pR->iCbArg;
+ if (cb)
+ {
+ Signal();
+ (*cb)(DDmaRequest::EOk, arg);
+ Wait();
+ }
}
}
req_count_after = iQueuedRequests;
--- a/kernel/eka/drivers/medmmc/bgahsmmcptn.cpp Sat Feb 20 00:10:51 2010 +0200
+++ b/kernel/eka/drivers/medmmc/bgahsmmcptn.cpp Fri Mar 12 15:50:11 2010 +0200
@@ -157,46 +157,57 @@
BGAHSMMCPTN_PI_STR *partitionTable = (BGAHSMMCPTN_PI_STR*)(&iIntBuf[0]);
// Verify that this is the Nokia partition table
- if( memcompare( (TUint8*)&(partitionTable->id[0]), sizeof(BGAHSMMCPTN_PI_ID), (TUint8*)BGAHSMMCPTN_PI_ID, sizeof(BGAHSMMCPTN_PI_ID)) == 0 )
+ if( memcompare( (TUint8*)&(partitionTable->iId[0]), sizeof(BGAHSMMCPTN_PI_ID), (TUint8*)BGAHSMMCPTN_PI_ID, sizeof(BGAHSMMCPTN_PI_ID)) == 0 )
{
__KTRACE_OPT(KPBUSDRV, Kern::Printf("Nokia partition structure found"));
- __KTRACE_OPT(KPBUSDRV, Kern::Printf("partitionTable->id..............: %s", partitionTable->id ));
- __KTRACE_OPT(KPBUSDRV, Kern::Printf("partitionTable->sector_size.....: %d = 0x%x", partitionTable->sector_size, partitionTable->sector_size));
- __KTRACE_OPT(KPBUSDRV, Kern::Printf("partitionTable->major_ver.......: %d", partitionTable->major_ver));
- __KTRACE_OPT(KPBUSDRV, Kern::Printf("partitionTable->minor_ver.......: %d", partitionTable->minor_ver));
- __KTRACE_OPT(KPBUSDRV, Kern::Printf("partitionTable->partition_amount: %d", partitionTable->partition_amount));
+ __KTRACE_OPT(KPBUSDRV, Kern::Printf("partitionTable->id..............: %s", partitionTable->iId ));
+ __KTRACE_OPT(KPBUSDRV, Kern::Printf("partitionTable->sector_size.....: %d = 0x%x", partitionTable->iSector_size, partitionTable->iSector_size));
+ __KTRACE_OPT(KPBUSDRV, Kern::Printf("partitionTable->major_ver.......: %d", partitionTable->iMajor_ver));
+ __KTRACE_OPT(KPBUSDRV, Kern::Printf("partitionTable->minor_ver.......: %d", partitionTable->iMinor_ver));
+ __KTRACE_OPT(KPBUSDRV, Kern::Printf("partitionTable->partition_amount: %d", partitionTable->iPartition_amount));
+
- for( TUint8 index = 0; (index < partitionTable->partition_amount) && (index < BGAHSMMCPTN_LAST_DRIVE); index++ )
- {
- if( (partitionTable->partitions[index].size > 0) &&
- ( PartitionIsFAT(partitionTable->partitions[index].partition_id) ||
- PartitionIsFAT32(partitionTable->partitions[index].partition_id) ||
- (KPartitionTypePagedData == partitionTable->partitions[index].partition_id && !foundSwap) ) )
- {
- iPartitionInfo->iEntry[partitionCount].iPartitionType = partitionTable->partitions[index].partition_id;
- iPartitionInfo->iEntry[partitionCount].iPartitionBaseAddr = (Int64) partitionTable->partitions[index].start_sector << KDiskSectorShift;
- iPartitionInfo->iEntry[partitionCount].iPartitionLen = (Int64) partitionTable->partitions[index].size << KDiskSectorShift;
- iPartitionAttributes[partitionCount] = partitionTable->partitions[index].partition_attributes;
-
- __KTRACE_OPT(KPBUSDRV, Kern::Printf("Registering partition #%d:", partitionCount));
- __KTRACE_OPT(KPBUSDRV, Kern::Printf("partitionCount....: %d", partitionCount));
- __KTRACE_OPT(KPBUSDRV, Kern::Printf("startSector.......: 0x%x", partitionTable->partitions[index].start_sector ));
- __KTRACE_OPT(KPBUSDRV, Kern::Printf("iPartitionBaseAddr: 0x%lx (sectors: %d)", iPartitionInfo->iEntry[partitionCount].iPartitionBaseAddr, (TUint32)(iPartitionInfo->iEntry[partitionCount].iPartitionBaseAddr >> KDiskSectorShift)));
- __KTRACE_OPT(KPBUSDRV, Kern::Printf("size..............: 0x%lx", partitionTable->partitions[index].size ));
- __KTRACE_OPT(KPBUSDRV, Kern::Printf("iPartitionLen.....: 0x%lx (sectors: %d)", iPartitionInfo->iEntry[partitionCount].iPartitionLen, iPartitionInfo->iEntry[partitionCount].iPartitionLen >> KDiskSectorShift));
- __KTRACE_OPT(KPBUSDRV, Kern::Printf("iPartitionType....: %d", iPartitionInfo->iEntry[partitionCount].iPartitionType));
- __KTRACE_OPT(KPBUSDRV, Kern::Printf("iPartitionAttribs.: 0x%x", iPartitionAttributes[partitionCount]));
- __KTRACE_OPT(KPBUSDRV, Kern::Printf(" "));
-
- if(KPartitionTypePagedData == partitionTable->partitions[index].partition_id)
- {
- foundSwap = ETrue;
- }
-
- partitionCount++;
- }
- }
- }
+ TUint8 PartitionType = 0;
+ // Check Supported Version is present
+ if (partitionTable->iMajor_ver <= BGAHSMMCPTN_PI_VER_MAJOR)
+ {
+ for( TUint8 index = 0; (index < partitionTable->iPartition_amount) && (index < BGAHSMMCPTN_LAST_DRIVE); index++ )
+ {
+ if (partitionTable->iMinor_ver >= BGAHSMMCPTN_PART_TYPE_SUPP_VER_MINOR)
+ PartitionType = partitionTable->iPartitions[index].iPartition_type;
+ else
+ PartitionType = partitionTable->iPartitions[index].iPartition_id;
+
+ if( (partitionTable->iPartitions[index].iSize > 0) &&
+ ( PartitionIsFAT(PartitionType) ||
+ PartitionIsFAT32(PartitionType) ||
+ (KPartitionTypePagedData == PartitionType && !foundSwap) ) )
+ {
+ iPartitionInfo->iEntry[partitionCount].iPartitionType = PartitionType;
+ iPartitionInfo->iEntry[partitionCount].iPartitionBaseAddr = (Int64) partitionTable->iPartitions[index].iStart_sector << KDiskSectorShift;
+ iPartitionInfo->iEntry[partitionCount].iPartitionLen = (Int64) partitionTable->iPartitions[index].iSize << KDiskSectorShift;
+ iPartitionAttributes[partitionCount] = partitionTable->iPartitions[index].iPartition_attributes;
+
+ __KTRACE_OPT(KPBUSDRV, Kern::Printf("Registering partition #%d:", partitionCount));
+ __KTRACE_OPT(KPBUSDRV, Kern::Printf("partitionCount....: %d", partitionCount));
+ __KTRACE_OPT(KPBUSDRV, Kern::Printf("startSector.......: 0x%x", partitionTable->iPartitions[index].iStart_sector ));
+ __KTRACE_OPT(KPBUSDRV, Kern::Printf("iPartitionBaseAddr: 0x%lx (sectors: %d)", iPartitionInfo->iEntry[partitionCount].iPartitionBaseAddr, (TUint32)(iPartitionInfo->iEntry[partitionCount].iPartitionBaseAddr >> KDiskSectorShift)));
+ __KTRACE_OPT(KPBUSDRV, Kern::Printf("size..............: 0x%lx", partitionTable->iPartitions[index].iSize ));
+ __KTRACE_OPT(KPBUSDRV, Kern::Printf("iPartitionLen.....: 0x%lx (sectors: %d)", iPartitionInfo->iEntry[partitionCount].iPartitionLen, iPartitionInfo->iEntry[partitionCount].iPartitionLen >> KDiskSectorShift));
+ __KTRACE_OPT(KPBUSDRV, Kern::Printf("iPartitionType....: %d", iPartitionInfo->iEntry[partitionCount].iPartitionType));
+ __KTRACE_OPT(KPBUSDRV, Kern::Printf("iPartitionAttribs.: 0x%x", iPartitionAttributes[partitionCount]));
+ __KTRACE_OPT(KPBUSDRV, Kern::Printf(" "));
+
+ if(KPartitionTypePagedData == PartitionType)
+ {
+ foundSwap = ETrue;
+ }
+
+ partitionCount++;
+ }
+ }
+ }
+ }
// Validate partition address boundaries
if(partitionCount == 0)
--- a/kernel/eka/drivers/medmmc/bgahsmmcptn.h Sat Feb 20 00:10:51 2010 +0200
+++ b/kernel/eka/drivers/medmmc/bgahsmmcptn.h Fri Mar 12 15:50:11 2010 +0200
@@ -28,32 +28,36 @@
/* Partition information version */
#define BGAHSMMCPTN_PI_VER_MAJOR 1
-#define BGAHSMMCPTN_PI_VER_MINOR 0
+#define BGAHSMMCPTN_PI_VER_MINOR 1
+
+/* Partition type field supported from version 1.1 onwards */
+#define BGAHSMMCPTN_PART_TYPE_SUPP_VER_MINOR 1
#define BGAHSMMCPTN_LAST_DRIVE 7 /* MMC1_DRIVECOUNT - defined in variantmediadef.h */
typedef struct
{
- TUint32 start_sector; /* Partition start sector */
- TUint32 size; /* Partition size in sectors */
- TUint32 attributes; /* RO, RW attributes (bitmask) */
- TUint8 partition_id; /* Partition number */
- TUint8 reserved1[3]; /* Reserved (padding for compiler alignment)*/
- TUint32 partition_attributes; /* Partition attributes (see e32const.h) */
- TUint8 reserved2[8]; /* Reserved */
+ TUint32 iStart_sector; /* Partition start sector */
+ TUint32 iSize; /* Partition size in sectors */
+ TUint32 iAttributes; /* RO, RW attributes (bitmask) */
+ TUint8 iPartition_id; /* Partition number - v1.0 - partition type v1.1 - drive number*/
+ TUint8 iPartition_type; /* Partition Type - v1.1 onwards */
+ TUint8 iReserved1[2]; /* Reserved (padding for compiler alignment)*/
+ TUint32 iPartition_attributes; /* Partition attributes (see e32const.h) */
+ TUint8 iReserved2[8]; /* Reserved */
/* = 28 bytes */
} BGAHSMMCPTN_PART_STR;
typedef struct
{
- TUint8 id[BGAHSMMCPTN_PI_ID_SIZE]; /* Partition information version */
- TUint32 sector_size; /* Used sector size */
- TUint16 major_ver; /* Major version number */
- TUint16 minor_ver; /* Minor version number */
- TUint16 partition_amount; /* The amount of partitions */
- TUint8 reserved[42]; /* Reserved */
+ TUint8 iId[BGAHSMMCPTN_PI_ID_SIZE]; /* Partition information version */
+ TUint32 iSector_size; /* Used sector size */
+ TUint16 iMajor_ver; /* Major version number */
+ TUint16 iMinor_ver; /* Minor version number */
+ TUint16 iPartition_amount; /* The amount of partitions */
+ TUint8 iReserved[42]; /* Reserved */
/* = 64 bytes */
- BGAHSMMCPTN_PART_STR partitions[BGAHSMMCPTN_LAST_DRIVE];
+ BGAHSMMCPTN_PART_STR iPartitions[BGAHSMMCPTN_LAST_DRIVE];
} BGAHSMMCPTN_PI_STR;
#define BGAHSMMCPTN_PI_STR_SIZE sizeof( BGAHSMMCPTN_PI_STR )
--- a/kernel/eka/drivers/pbus/mmc/mmccd_init.cpp Sat Feb 20 00:10:51 2010 +0200
+++ b/kernel/eka/drivers/pbus/mmc/mmccd_init.cpp Fri Mar 12 15:50:11 2010 +0200
@@ -296,7 +296,7 @@
break;
}
- if (mi.iFlags & TMMCMachineInfo::ESupportsDMA)
+ if ((mi.iFlags & TMMCMachineInfo::ESupportsDMA) == TMMCMachineInfo::ESupportsDMA)
{
err = LocDrv::RegisterDmaDevice(pMedia,
KMMCardHighCapBlockSize,
--- a/kernel/eka/drivers/usbcsc/d_usbcsc.cpp Sat Feb 20 00:10:51 2010 +0200
+++ b/kernel/eka/drivers/usbcsc/d_usbcsc.cpp Fri Mar 12 15:50:11 2010 +0200
@@ -3026,7 +3026,13 @@
{
dUsbc->ProcessDeviceState(deviceState);
// Send Status to EP0 buffer.
- dUsbc->iBuffers[dUsbc->iEP0OutBuff].SendEp0StatusPacket(deviceState);
+ // Before the client calls RDevUsbcScClient::FinalizeInterface(),
+ // this function might be called.
+ // So we add a guard for dUsbc->iBuffers
+ if( dUsbc->iBuffers )
+ {
+ dUsbc->iBuffers[dUsbc->iEP0OutBuff].SendEp0StatusPacket(deviceState);
+ }
}
// Only queue if userside is interested
--- a/kernel/eka/include/e32ver.h Sat Feb 20 00:10:51 2010 +0200
+++ b/kernel/eka/include/e32ver.h Fri Mar 12 15:50:11 2010 +0200
@@ -28,7 +28,7 @@
const TInt KE32MajorVersionNumber=2;
const TInt KE32MinorVersionNumber=0;
-const TInt KE32BuildVersionNumber=2075;
+const TInt KE32BuildVersionNumber=2083;
const TInt KMachineConfigurationMajorVersionNumber=1;
const TInt KMachineConfigurationMinorVersionNumber=0;
--- a/kernel/eka/include/kernel/cache_maintenance.h Sat Feb 20 00:10:51 2010 +0200
+++ b/kernel/eka/include/kernel/cache_maintenance.h Fri Mar 12 15:50:11 2010 +0200
@@ -375,6 +375,12 @@
const TUint ARML2C_CleanByWay = 0x7bc;
const TUint ARML2C_InvalidateByWay = 0x77c;
const TUint ARML2C_CleanInvalidateByWay = 0x7fc;
+#if defined (__ARM_PL310_CACHE__)
+ const TUint ARML2C_WayShift = 28;
+#else
+ const TUint ARML2C_WayShift = 29;
+#endif
+ const TUint ARML2C_IndexShift = 5;
/*
* A set of static utility functions for external cache memory.
--- a/kernel/eka/include/nkern/nk_trace.h Sat Feb 20 00:10:51 2010 +0200
+++ b/kernel/eka/include/nkern/nk_trace.h Fri Mar 12 15:50:11 2010 +0200
@@ -574,7 +574,7 @@
@publishedPartner
@released 9.4
*/
-#if defined(__MEMMODEL_MOVING__) || defined (__MEMMODEL_MULTIPLE__)
+#if !defined(__MEMMODEL_DIRECT__) && !defined (__MEMMODEL_EMUL_SINGLE_HOST_PROCESS__)
#define BTRACE_RAM_ALLOCATOR
#endif
@@ -620,7 +620,9 @@
This BTrace category is only supported on the flexible memory model.
*/
+#ifdef __MEMMODEL_FLEXIBLE__
#define BTRACE_FLEXIBLE_MEM_MODEL
+#endif
/**
If defined, code for BTrace category BTrace::EIic is compiled into the
--- a/kernel/eka/kernel/arm/cache_external.cpp Sat Feb 20 00:10:51 2010 +0200
+++ b/kernel/eka/kernel/arm/cache_external.cpp Fri Mar 12 15:50:11 2010 +0200
@@ -558,7 +558,7 @@
for (index = 0 ; index <indexNo ; index++)
{
L220_COMMAND_PREAMBLE;
- *ctrlReg = (way<<29) | (index<<5); //this will clean,purge or flush cache line
+ *ctrlReg = (way<<ARML2C_WayShift) | (index<<ARML2C_IndexShift); //this will maintain a single cache line
L220_COMMAND_POSTAMBLE;
PL310_SPIN_FLASH;
}
--- a/kernel/eka/kernel/ekern.mmp Sat Feb 20 00:10:51 2010 +0200
+++ b/kernel/eka/kernel/ekern.mmp Fri Mar 12 15:50:11 2010 +0200
@@ -27,14 +27,19 @@
#include <variant.mmh>
macro __IN_KERNEL__
-target VariantTarget(ekern,exe)
+#ifdef MEMORY_MODEL_OPTIONS
+#include <memmodel.mmh>
+target MemoryModelTarget(ekern,exe)
+firstlib MemoryModelTarget(kc_exe,lib)
+#else
+target VariantTarget(ekern,exe)
+firstlib VariantTarget(kc_exe,lib)
+#endif
targettype exexp
#include "kern_int.mmh"
-firstlib VariantTarget(kc_exe,lib)
-
// For emulator, specify newlib containing kernel-side definitions of new and delete operators
// to override default library, containing user-side definitions, linked by toolchain for EXE and DLL targets
#ifdef WINS
--- a/kernel/eka/kernel/exmoncommon.mmp Sat Feb 20 00:10:51 2010 +0200
+++ b/kernel/eka/kernel/exmoncommon.mmp Fri Mar 12 15:50:11 2010 +0200
@@ -18,6 +18,9 @@
#ifdef EPOC32
#include <variant.mmh>
+#ifdef MEMORY_MODEL_OPTIONS
+#include <memmodel.mmh>
+#endif
#define INCLUDE_EKERN_LIB
#include "kern_int.mmh"
@@ -108,7 +111,11 @@
noexportlibrary
linkas exmoncommon.dll
+#ifdef MEMORY_MODEL_OPTIONS
+target MemoryModelTarget(exmoncommon,dll)
+#else
target VariantTarget(exmoncommon,dll)
+#endif
deffile exmoncommon.def
--- a/kernel/eka/kernel/kc_exe.mmp Sat Feb 20 00:10:51 2010 +0200
+++ b/kernel/eka/kernel/kc_exe.mmp Fri Mar 12 15:50:11 2010 +0200
@@ -14,11 +14,17 @@
// e32/kernel/kc_exe.mmp
//
//
+#include <variant.mmh>
-#include <variant.mmh>
+#ifdef MEMORY_MODEL_OPTIONS
+#include <memmodel.mmh>
+target MemoryModelTarget(kc_exe,lib)
+#else
+target VariantTarget(kc_exe,lib)
+#endif
+
#include "kern_int.mmh"
-target VariantTarget(kc_exe,lib)
targettype klib
#if defined(MARM)
--- a/kernel/eka/memmodel/epoc/flexible/mmu/arm/xmmu.cpp Sat Feb 20 00:10:51 2010 +0200
+++ b/kernel/eka/memmodel/epoc/flexible/mmu/arm/xmmu.cpp Fri Mar 12 15:50:11 2010 +0200
@@ -928,13 +928,11 @@
// Now we have the os asid check access to kernel memory.
if(aAddr >= KUserMemoryLimit && osAsid != (TUint)KKernelOsAsid)
{
- NKern::ThreadEnterCS();
- MmuLock::Unlock();
if (!iAliasLinAddr)
{// Close the new reference as RemoveAlias won't do as iAliasLinAddr is not set.
aProcess->AsyncCloseOsAsid(); // Asynchronous close as this method should be quick.
}
- NKern::ThreadLeaveCS();
+ MmuLock::Unlock();
return KErrBadDescriptor; // prevent access to supervisor only memory
}
@@ -944,10 +942,8 @@
// address is in global section, don't bother aliasing it...
if (!iAliasLinAddr)
{// Close the new reference as not required.
- NKern::ThreadEnterCS();
+ aProcess->AsyncCloseOsAsid(); // Asynchronous close as this method should be quick.
MmuLock::Unlock();
- aProcess->AsyncCloseOsAsid(); // Asynchronous close as this method should be quick.
- NKern::ThreadLeaveCS();
}
else
{// Remove the existing alias as it is not required.
@@ -1061,15 +1057,9 @@
iCpuRestoreCookie = -1;
#endif
- // Must close the os asid while in critical section to prevent it being
- // leaked. However, we can't hold the mmu lock so we have to enter an
- // explict crtical section. It is ok to release the mmu lock as the
- // iAliasLinAddr and iAliasProcess members are only ever updated by the
- // current thread.
- NKern::ThreadEnterCS();
+ // Must close the os asid while holding MmuLock so we are in an implicit critical section.
+ iAliasProcess->AsyncCloseOsAsid(); // Asynchronous close as this method should be quick.
MmuLock::Unlock();
- iAliasProcess->AsyncCloseOsAsid(); // Asynchronous close as this method should be quick.
- NKern::ThreadLeaveCS();
}
--- a/kernel/eka/memmodel/epoc/flexible/mmu/mm.cpp Sat Feb 20 00:10:51 2010 +0200
+++ b/kernel/eka/memmodel/epoc/flexible/mmu/mm.cpp Fri Mar 12 15:50:11 2010 +0200
@@ -243,21 +243,6 @@
}
-TBool DReferenceCountedObject::CheckAsyncCloseIsSafe()
- {
- __ASSERT_CRITICAL
-#ifdef _DEBUG
- NFastMutex* fm = NKern::HeldFastMutex();
- if(fm)
- {
- Kern::Printf("DReferenceCountedObject[0x%08x]::AsyncClose() fast mutex violation %M",this,fm);
- return false;
- }
-#endif
- return true;
- }
-
-
void DReferenceCountedObject::Close()
{
__ASSERT_CRITICAL
@@ -271,7 +256,6 @@
void DReferenceCountedObject::AsyncClose()
{
__ASSERT_CRITICAL
- __NK_ASSERT_DEBUG(CheckAsyncCloseIsSafe());
__NK_ASSERT_DEBUG(iReferenceCount>0);
if (__e32_atomic_tas_ord32(&iReferenceCount, 1, -1, 0) == 1)
AsyncDelete();
--- a/kernel/eka/memmodel/epoc/flexible/mmu/mmu.cpp Sat Feb 20 00:10:51 2010 +0200
+++ b/kernel/eka/memmodel/epoc/flexible/mmu/mmu.cpp Fri Mar 12 15:50:11 2010 +0200
@@ -526,6 +526,9 @@
// update this to stop assert triggering in RamAllocLock::Lock()
iRamAllocInitialFreePages = maxFreePages;
+
+ // Get the allocator to signal to the variant which RAM zones are in use so far
+ iRamPageAllocator->InitialCallback();
}
--- a/kernel/eka/memmodel/epoc/flexible/mmu/mobject.cpp Sat Feb 20 00:10:51 2010 +0200
+++ b/kernel/eka/memmodel/epoc/flexible/mmu/mobject.cpp Fri Mar 12 15:50:11 2010 +0200
@@ -587,7 +587,16 @@
void DCoarseMemory::DPageTables::AsyncClose()
{
- __NK_ASSERT_DEBUG(CheckAsyncCloseIsSafe());
+ __ASSERT_CRITICAL
+#ifdef _DEBUG
+ NFastMutex* fm = NKern::HeldFastMutex();
+ if(fm)
+ {
+ Kern::Printf("DCoarseMemory::DPageTables::[0x%08x]::AsyncClose() fast mutex violation %M",this,fm);
+ __NK_ASSERT_DEBUG(0);
+ }
+#endif
+
MmuLock::Lock();
if (__e32_atomic_tas_ord32(&iReferenceCount, 1, -1, 0) != 1)
{
--- a/kernel/eka/memmodel/epoc/flexible/mmu/mobject.h Sat Feb 20 00:10:51 2010 +0200
+++ b/kernel/eka/memmodel/epoc/flexible/mmu/mobject.h Fri Mar 12 15:50:11 2010 +0200
@@ -916,6 +916,7 @@
/**
Overriding DReferenceCountedObject::AsyncClose.
This removes the linkage with #iMemory if this object is deleted.
+ @pre No fast mutex must be held. Unlike DReferenceCountedObject::AsyncClose().
*/
void AsyncClose();
--- a/kernel/eka/memmodel/epoc/flexible/mmu/mrefcntobj.h Sat Feb 20 00:10:51 2010 +0200
+++ b/kernel/eka/memmodel/epoc/flexible/mmu/mrefcntobj.h Fri Mar 12 15:50:11 2010 +0200
@@ -97,12 +97,6 @@
*/
TBool CheckCloseIsSafe();
- /**
- Return true if the preconditions for #AsyncClose are met.
- This is for use by derived classes which overload the #AsyncClose method.
- */
- TBool CheckAsyncCloseIsSafe();
-
protected:
/**
--- a/kernel/eka/release.txt Sat Feb 20 00:10:51 2010 +0200
+++ b/kernel/eka/release.txt Fri Mar 12 15:50:11 2010 +0200
@@ -1,3 +1,88 @@
+Version 2.00.2083
+=================
+(Made by vfebvre 10/02/2010)
+
+1. martai
+ 1. PackageReleaseID=457064 FeatureReleaseID=457058
+ REQ 417-65372 Enabling and validation of WDP in TB9.2
+
+
+Version 2.00.2082
+=================
+(Made by vfebvre 08/02/2010)
+
+1. jimmzhou
+ 1. DEF144308 XLII-7ZNH37: Phone crashes when running usbmsapp test with usbcsc.ldd
+
+2. martai
+ 1. DEF144290: FMM handles IPC aliasing inefficiently
+
+
+Version 2.00.2081
+=================
+(Made by vfebvre 05/02/2010)
+
+1. cnotton
+ 1. DEF144265: eslm-82cags locmedia_ost.h is missing in wk05 NCP79 build
+
+
+Version 2.00.2080
+=================
+(Made by vfebvre 04/02/2010)
+
+1. djkovace
+ 1. DEF144258: [SymTB9.2] PL310 maintenance by IndexWay misses some ways
+
+
+Version 2.00.2079
+=================
+(Made by vfebvre 03/02/2010)
+
+1. migubarr
+ 1. DEF143959: MMC stack initialisation enables DMA when ESupportsDoubleBuffering specified
+
+2. gcochran
+ 1. DEF143479: t_perflogger tests fails at kern perf logger tests on production hw79/vasco
+
+
+Version 2.00.2078
+=================
+(Made by vfebvre 02/02/2010)
+
+1. virodion
+ 1. DEF144163 E32 T_VIDEOMEMORY test failed at line 124
+ Defect fix for TSW: EYGL-7SPCS3
+
+2. cnotton
+ 1. DEF144062 HAL header files can now been returned to platform...
+
+3. martai
+ 1. PDEF144201 FMM: The RAM zone callback function ERamZoneOp_Init isn't invoked in the FMM
+
+
+Version 2.00.2077
+=================
+(Made by vfebvre 01/02/2010)
+
+1. mipetzol
+ 1. DEF144066 DMA: PIL detection of missed interrupts can fail
+ The method whereby the DMA PIL tried to detect missed PSL DMA interrupts
+ could yield false positives resulting in spurious missed interrupts which
+ ultimately led to the DMA driver crashing. The detection condition has been
+ corrected to rule out the false positives.
+
+
+Version 2.00.2076
+=================
+(Made by vfebvre 29/01/2010)
+
+1. necliffo
+ 1. PDEF144095: BGAHSMMCPTN does not check for partition table version
+
+2. mmoate
+ 1. DEF144102 Missing distribution.policy.s60 file in TB92SF_1021
+
+
Version 2.00.2075
=================
(Made by vfebvre 26/01/2010)
--- a/kerneltest/e32test/debug/t_perflogger.cpp Sat Feb 20 00:10:51 2010 +0200
+++ b/kerneltest/e32test/debug/t_perflogger.cpp Fri Mar 12 15:50:11 2010 +0200
@@ -105,6 +105,7 @@
{
TUint8* record;
TTraceLayout traceLayout;
+ TInt nRecords = 0;
for(TInt i=0; ;++i)
{
@@ -134,7 +135,6 @@
TUint8* end = record+dataSize;
TUint8* currPos = record;
- TInt nRecords = 0;
TUint nBytes = 0;
//-- parser the record, print out fields and optionally check the correspondence to the fields of the control structure.
@@ -168,16 +168,17 @@
}
}
+
+ //-- release data buffer.
+ aTrace.DataUsed();
+ }
- //-- check number of trace records obtained
- if(apControlStruct)
- {
- test(nRecords == apControlStruct->iLogsNum);
- }
-
- //-- release data buffer.
- aTrace.DataUsed();
+ //-- check number of trace records obtained
+ if(apControlStruct)
+ {
+ test(nRecords == apControlStruct->iLogsNum);
}
+
}
--- a/kerneltest/e32test/mmu/d_shadow.cpp Sat Feb 20 00:10:51 2010 +0200
+++ b/kerneltest/e32test/mmu/d_shadow.cpp Fri Mar 12 15:50:11 2010 +0200
@@ -27,6 +27,15 @@
_LIT(KLddName,"Shadow");
+#ifdef __CPU_X86
+const TUint KPageDirectorySize = 1024;
+const TUint KMaxNumberOfPageDirectories = 1024;
+const TUint KPsudoX86TTBCR = 512;
+#else
+const TUint KPageDirectorySize = 4096; // Full size (ttbr0+ttbr1)
+const TUint KMaxNumberOfPageDirectories = 256;
+#endif
+
class DShadow;
class DShadowFactory : public DLogicalDevice
@@ -52,6 +61,11 @@
protected:
virtual TInt DoCreate(TInt aUnit, const TDesC8* anInfo, const TVersion& aVer);
virtual TInt Request(TInt aFunction, TAny* a1, TAny* a2);
+
+ // Memory model specific values will be initialised when the channel is created.
+ TUint iPageDirectoryBase;
+ TUint iPageTableBase;
+ TMemModel iMemoryModel;
};
DECLARE_STANDARD_LDD()
@@ -111,6 +125,30 @@
if (!Kern::QueryVersionSupported(TVersion(KMajorVersionNumber,KMinorVersionNumber,KBuildVersionNumber),aVer))
return KErrNotSupported;
+ // Set memory model specific values.
+ TUint32 memoryModelAttrib = (TUint32)Kern::HalFunction(EHalGroupKernel,EKernelHalMemModelInfo,0,0);
+ switch (memoryModelAttrib & EMemModelTypeMask)
+ {
+ case EMemModelTypeMoving:
+ iPageDirectoryBase = 0x61000000;
+ iPageTableBase = 0x62000000;
+ iMemoryModel = EMemModelMoving;
+ break;
+ case EMemModelTypeMultiple:
+ iPageDirectoryBase = 0xC1000000;
+ iPageTableBase = 0xC2000000;
+ iMemoryModel = EMemModelMultiple;
+ break;
+ case EMemModelTypeFlexible:
+ iPageDirectoryBase = 0xF4000000u;
+ iPageTableBase = 0xF8000000u;
+ iMemoryModel = EMemModelFlexible;
+ break;
+ default:
+ iPageDirectoryBase = 0x00000000;
+ iPageTableBase = 0x00000000;
+ iMemoryModel = EMemModelOther;
+ }
return KErrNone;
}
@@ -291,14 +329,13 @@
#ifdef __EPOC32__
-#if defined(__MEMMODEL_MULTIPLE__) || defined(__MEMMODEL_FLEXIBLE__)
- numPds = KMaxNumberOfPageDirectories;
-#else
- numPds = 0;
-#endif
- r = KMemoryModel;
+ if (iMemoryModel == EMemModelFlexible || iMemoryModel == EMemModelMultiple)
+ numPds = KMaxNumberOfPageDirectories;
+ else
+ numPds = 0;
+ r = iMemoryModel;
#endif
- pageTable = KPageTableBase;
+ pageTable = iPageTableBase;
kumemput(a1, &pageTable, sizeof(TUint));
kumemput(a2, &numPds, sizeof(TUint));
@@ -317,39 +354,38 @@
r=KErrNoPageTable;
-#if defined(__MEMMODEL_MOVING__)
-
- if (pd==KGlobalPageDirectory)
+ if (iMemoryModel == EMemModelMoving)
{
- pdSize=KPageDirectorySize;
- pdBase=KPageDirectoryBase;
- r = KErrNone;
+ if (pd==KGlobalPageDirectory)
+ {
+ pdSize=KPageDirectorySize;
+ pdBase=iPageDirectoryBase;
+ r = KErrNone;
+ }
}
-
-#elif defined(__MEMMODEL_MULTIPLE__) || defined(__MEMMODEL_FLEXIBLE__)
-
+ else if(iMemoryModel == EMemModelFlexible || iMemoryModel == EMemModelMultiple)
+ {
#ifdef __CPU_X86
- TUint ttbcr = KPsudoX86TTBCR;
+ TUint ttbcr = KPsudoX86TTBCR;
#else
- TUint ttbcr = KPageDirectorySize >> GetTTBCR();
-#endif
+ TUint ttbcr = KPageDirectorySize >> GetTTBCR();
+#endif // __CPU_X86
- if (pd==KGlobalPageDirectory)
- {
- pdSize=KPageDirectorySize - ttbcr;
- pdBase=KPageDirectoryBase + ttbcr*4;
- r = ttbcr & KPageOffsetMask;
+ if (pd==KGlobalPageDirectory)
+ {
+ pdSize=KPageDirectorySize - ttbcr;
+ pdBase=iPageDirectoryBase + ttbcr*4;
+ r = ttbcr & KPageOffsetMask;
+ }
+ else
+ {
+ pdSize = ttbcr;
+ pdBase=iPageDirectoryBase + pd * KPageDirectorySize * 4;
+
+ TPhysAddr phys=Epoc::LinearToPhysical((TLinAddr)pdBase);
+ r = (phys==KPhysAddrInvalid) ? KErrNoPageTable : KErrNone;
+ }
}
- else
- {
- pdSize = ttbcr;
- pdBase=KPageDirectoryBase + pd * KPageDirectorySize * 4;
-
- TPhysAddr phys=Epoc::LinearToPhysical((TLinAddr)pdBase);
- r = (phys==KPhysAddrInvalid) ? KErrNoPageTable : KErrNone;
- }
-
-#endif //memmodel
if ((r & KErrNoPageTable) == 0)
{
--- a/kerneltest/e32test/mmu/d_shadow.h Sat Feb 20 00:10:51 2010 +0200
+++ b/kerneltest/e32test/mmu/d_shadow.h Fri Mar 12 15:50:11 2010 +0200
@@ -37,45 +37,6 @@
ECpuArm,
ECpuX86
};
-
-
-#ifdef __KERNEL_MODE__
-
-// Memory Model Architecture
-
-#ifdef __CPU_X86
- const TUint KPageDirectorySize = 1024;
- const TUint KMaxNumberOfPageDirectories = 1024;
- const TUint KPsudoX86TTBCR = 512;
-
-#else
- const TUint KPageDirectorySize = 4096; // Full size (ttbr0+ttbr1)
- const TUint KMaxNumberOfPageDirectories = 256;
-#endif
-
-#if defined(__MEMMODEL_MOVING__)
- const TUint KPageDirectoryBase = 0x61000000;
- const TUint KPageTableBase = 0x62000000;
- const TMemModel KMemoryModel = EMemModelMoving;
-
-#elif defined(__MEMMODEL_MULTIPLE__)
- const TUint KPageDirectoryBase = 0xC1000000;
- const TUint KPageTableBase = 0xC2000000;
- const TMemModel KMemoryModel = EMemModelMultiple;
-
-#elif defined(__MEMMODEL_FLEXIBLE__)
- const TUint KPageDirectoryBase = 0xF4000000u;
- const TUint KPageTableBase = 0xF8000000u;
- const TMemModel KMemoryModel = EMemModelFlexible;
-
-#else // other memory model
- const TUint KPageDirectoryBase = 0x00000000;
- const TUint KPageTableBase = 0x00000000;
- const TMemModel KMemoryModel = EMemModelOther;
-#endif
-
-#endif
-
class TCapsShadowV01
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32test/random/d_entropysources.cpp Fri Mar 12 15:50:11 2010 +0200
@@ -0,0 +1,160 @@
+// 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\entropysources\d_entropysources.cpp
+//
+//
+/**
+ @file
+ @internalComponent
+ @test
+*/
+#include <dfcs.h>
+#include <kernel/kernel.h>
+#include <kernel/kern_priv.h>
+#include "kern_test.h"
+#include "d_entropysources.h"
+
+//---------------------------------------------------------------------------------------------------------------------
+//! @SYMTestCaseID KBASE-entropysources-2703
+//! @SYMTestType UT
+//! @SYMTestCaseDesc Verifies that entropy is contributed to the Secure RNG
+//! @SYMPREQ PREQ211
+//! @SYMTestPriority High
+//! @SYMTestActions
+//! 1. TestReseed: tests that the interval between RNG reseeds is less than KMaxReseedTime, unless the platform is
+//! known not to have a viable entropy source.
+//!
+//!
+//! @SYMTestExpectedResults
+//! 1. Properties checked:
+//! 1) checks that there is a valid entropy source contrbuting entropy data.
+//! 2) checks that the entropy collection framework is functioning correctly..
+//!
+//---------------------------------------------------------------------------------------------------------------------
+
+class DEntropySourcesFactory : public DLogicalDevice
+ {
+public:
+ DEntropySourcesFactory();
+ virtual TInt Install();
+ virtual void GetCaps(TDes8 &aDes) const;
+ virtual TInt Create(DLogicalChannelBase*& aChannel);
+ };
+
+class DEntropySources : public DLogicalChannelBase
+ {
+public:
+ DEntropySources();
+ ~DEntropySources();
+ void ReseedHook();
+
+protected:
+ virtual TInt DoCreate(TInt aUnit, const TDesC8* anInfo, const TVersion& aVer);
+ virtual TInt Request(TInt aReqNo, TAny* a1, TAny* a2);
+
+private:
+ DThread* iClient;
+ TClientRequest* iRequest;
+ };
+
+// Function to be called from the kernel side code.
+void ReseedHook(TAny* aPtr)
+ {
+ ((DEntropySources*)aPtr)->ReseedHook();
+ }
+
+DECLARE_STANDARD_LDD()
+ {
+ return new DEntropySourcesFactory;
+ }
+
+//
+// DEntropySourcesFactory
+//
+
+DEntropySourcesFactory::DEntropySourcesFactory()
+ {
+ // Set version number for this device
+ iVersion = TVersion(0,1,1);
+
+ // Indicate we don't support units or a PDD
+ iParseMask = 0;
+ }
+
+TInt DEntropySourcesFactory::Install()
+ {
+ return(SetName(&KEntropySourcesName));
+ }
+
+void DEntropySourcesFactory::GetCaps(TDes8& aDes) const
+ {
+ // Create a capabilities object
+ TCapsEntropySources caps;
+ caps.iVersion = iVersion;
+
+ // Write it back to user memory
+ Kern::InfoCopy(aDes,(TUint8*)&caps,sizeof(caps));
+ }
+
+TInt DEntropySourcesFactory::Create(DLogicalChannelBase*& aChannel)
+ {
+ aChannel = new DEntropySources;
+ if(!aChannel)
+ return KErrNoMemory;
+ return KErrNone;
+ }
+
+//
+// DEntropySources
+//
+
+DEntropySources::DEntropySources()
+ {
+ iClient = &Kern::CurrentThread();
+ iClient->Open();
+ }
+
+DEntropySources::~DEntropySources()
+ {
+ KernTest::Test(KernTest::ERNGReseedHook, NULL, NULL);
+ Kern::SafeClose((DObject*&)iClient, NULL);
+ Kern::DestroyClientRequest(iRequest);
+ }
+
+TInt DEntropySources::DoCreate(TInt /*aUnit*/, const TDesC8* /*aInfo*/, const TVersion& /*aVer*/)
+ {
+ return Kern::CreateClientRequest(iRequest);
+ }
+
+TInt DEntropySources::Request(TInt aReqNo, TAny* a1, TAny* a2)
+ {
+ (void)a2;
+ TInt r = KErrNotSupported;
+ switch(aReqNo)
+ {
+ case ~REntropySources::EReseedTest:
+ r = iRequest->SetStatus((TRequestStatus*)a1);
+ if (r!=KErrNone)
+ return r;
+ KernTest::Test(KernTest::ERNGReseedHook, (TAny*)&::ReseedHook, this);
+ break;
+ }
+ return r;
+ }
+
+void DEntropySources::ReseedHook()
+ {
+ KernTest::Test(KernTest::ERNGReseedHook, NULL, NULL);
+ Kern::QueueRequestComplete(iClient, iRequest, KErrNone);
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32test/random/d_entropysources.h Fri Mar 12 15:50:11 2010 +0200
@@ -0,0 +1,63 @@
+// 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\entropysources\d_entropysources.h
+//
+// Test driver which notifies userspace when an RNG reseed has taken place
+//
+//
+
+/**
+ @file
+ @internalComponent
+ @test
+*/
+
+#if !defined(__D_ENTROPYSOURCES_H__)
+#define __D_ENTROPYSOURCES_H__
+
+#include <e32cmn.h>
+#ifndef __KERNEL_MODE__
+#include <e32std.h>
+#endif
+
+_LIT(KEntropySourcesName,"D_ENTROPYSOURCES");
+
+class TCapsEntropySources
+ {
+public:
+ TVersion iVersion;
+ };
+
+class REntropySources : public RBusLogicalChannel
+ {
+public:
+ enum TRequest
+ {
+ EReseedTest,
+ };
+
+#ifndef __KERNEL_MODE__
+public:
+ inline TInt Open()
+ {
+ return DoCreate(KEntropySourcesName,TVersion(0, 1, 1),KNullUnit,NULL,NULL,EOwnerThread);
+ }
+ inline void ReseedTest(TRequestStatus& aRequestStatus)
+ {
+ DoRequest(EReseedTest, aRequestStatus);
+ }
+#endif
+ };
+
+#endif // __D_ENTROPYSOURCES_H__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32test/random/t_entropysources.cpp Fri Mar 12 15:50:11 2010 +0200
@@ -0,0 +1,131 @@
+// 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:
+// Test suite to check whether the device has good enough entropy sources or not.
+// More the no. of sources, high the quality of the random numbers (least predictable).
+//
+//
+
+/**
+ @file
+ @internalTechnology
+*/
+
+#define __E32TEST_EXTENSION__
+#include <e32test.h>
+#include <hal.h>
+#include <e32math.h>
+#include "d_entropysources.h"
+
+//---------------------------------------------------------------------------------------------------------------------
+//! @SYMTestCaseID KBASE-entropysources-2703
+//! @SYMTestType UT
+//! @SYMTestCaseDesc Verifies that entropy is contributed to the Secure RNG
+//! @SYMPREQ PREQ211
+//! @SYMTestPriority High
+//! @SYMTestActions
+//! 1. TestReseed: tests that the interval between RNG reseeds is less than KMaxReseedTime, unless the platform is
+//! known not to have a viable entropy source.
+//!
+//!
+//! @SYMTestExpectedResults
+//! 1. Properties checked:
+//! 1) checks that there is a valid entropy source contrbuting entropy data.
+//! 2) checks that the entropy collection framework is functioning correctly..
+//!
+//---------------------------------------------------------------------------------------------------------------------
+
+// In a worst case scenario, we expect the reseed to happen within ten minutes.
+// This is approximately 1/10 of the actual reseed intervel time (97.8 rounded to => 98).
+// ((2^24 (reseed intervel) * 350 (micro seconds per request)) / 1000000) / 60 => 97.8 minutes.
+//
+const TTimeIntervalMicroSeconds32 KMaxReseedTime = 10 * 60 * 1000000;
+
+REntropySources Ldd;
+
+LOCAL_D RTest test(_L("T_ENTROPYSOURCES"));
+
+LOCAL_C void TestReseed()
+ {
+ test.Next(_L("Loading test driver"));
+ TInt r = User::LoadLogicalDevice(KEntropySourcesName);
+ test(r==KErrNone || r==KErrAlreadyExists);
+
+ test.Next(_L("Opening the logical channel"));
+ test_KErrNone(Ldd.Open());
+
+ RTimer timer;
+ test_KErrNone(timer.CreateLocal());
+
+ test.Next(_L("Testing reseed interval"));
+ // Wait for two reseeds, so we can prove the interval between them is ok
+ for (TInt i=0; i<2; ++i)
+ {
+ // Request notification of the next reseed, with a timeout
+ test.Next(_L("Requesting reseed notification"));
+ TRequestStatus reseed, timeout;
+ Ldd.ReseedTest(reseed);
+ timer.After(timeout, KMaxReseedTime);
+
+ // Prod the RNG to make sure it's not idle, then wait for an event
+ test.Next(_L("Prod RNG and wait"));
+ Math::Random();
+ User::WaitForRequest(reseed, timeout);
+
+ // Check we didn't time out and cancel the timer
+ test_Equal(KRequestPending, timeout.Int());
+ timer.Cancel();
+ User::WaitForRequest(timeout);
+ test_Equal(KErrCancel, timeout.Int());
+ test_KErrNone(reseed.Int());
+ }
+
+ Ldd.Close();
+
+ User::FreeLogicalDevice(KEntropySourcesName);
+ }
+
+LOCAL_C TBool HardwareRNGPresent()
+ {
+ TInt muid = 0;
+ const TInt r = HAL::Get(HAL::EMachineUid, muid);
+ if (r != KErrNone) return EFalse;;
+ return ((muid != HAL::EMachineUid_X86PC) &&
+ (muid != HAL::EMachineUid_NE1_TB) &&
+ (muid != HAL::EMachineUid_OmapH6) &&
+ (muid != HAL::EMachineUid_OmapZoom) &&
+ (muid != HAL::EMachineUid_Win32Emulator));
+ }
+
+GLDEF_C TInt E32Main()
+ {
+ test.Title();
+ test.Start(_L("Test periodic entropy source"));
+
+ if(HardwareRNGPresent())
+ {
+ __UHEAP_MARK;
+
+ TestReseed();
+
+ __UHEAP_MARKEND;
+ }
+ else
+ {
+ test.Printf(_L("Test skipped, platform is known not to have a periodic entropy source\n"));
+ }
+ test.End();
+ test.Close();
+
+ return 0;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32test/random/t_securerng.cpp Fri Mar 12 15:50:11 2010 +0200
@@ -0,0 +1,255 @@
+// 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.
+//
+//
+// Description:
+// e32test\random\t_securerng.cpp
+//
+//
+
+//system include
+#include <e32test.h>
+#include <e32math.h>
+#include <e32cmn.h>
+#include "../mmu/mmudetect.h"
+
+//---------------------------------------------------------------------------------------------------------------------
+//! @SYMTestCaseID KBASE-securerng-2702
+//! @SYMTestType UT
+//! @SYMTestCaseDesc Verifies correct operation of the Secure RNG
+//! @SYMPREQ PREQ211
+//! @SYMTestPriority High
+//! @SYMTestActions
+//! 1. TestRandomNumberGeneration: tests that random data is generated correctly.
+//!
+//! 2. SecureRNGTestWithMultiThread: tests that random data can be provided to multiple threads simultaneously
+//!
+//! 3. TestSecureRNGForPanicScenarios: tests that the correct panics are issued for common error conditions
+//!
+//!
+//! @SYMTestExpectedResults
+//! 1. Properties checked:
+//! 1) checks that requests for random data with a buffer length of zero do not cause an error.
+//! 2) checks that requests for a large amount of random data do not cause an error.
+//! 3) checks that some random data has been returned (comparison to zero filled buffer).
+//! 4) checks that the new Math::RandomL() API either returns some random data or correctly indicates the RNG
+//! as not secure (KErrNotReady).
+//!
+//! 2. Properties checked:
+//! 5) checks that making requests for random data from multiple threads simultaneously does not cause an error.
+//!
+//! 3. Properties checked:
+//! 6) checks passing a user non-writable memory address to the random function through a valid pointer results
+//! results in the correct panic.
+//! 7) checks passing a null pointer to the random function results in the correct panic.
+//! 8) checks passing a non-modifiable descriptor to the random function results in the correct panic.
+//---------------------------------------------------------------------------------------------------------------------
+
+
+// RTest for testing Secure RNG unit
+RTest test(_L("Secure RNG Unit Test"));
+
+// Threads required for multi thread testing
+RThread SecureRNGTestThread1;
+RThread SecureRNGTestThread2;
+RThread SecureRNGTestThread3;
+
+// Threads name to identify
+_LIT(KSecureRNGTestThread1, "SecureRNGTestThread1");
+_LIT(KSecureRNGTestThread2, "SecureRNGTestThread2");
+_LIT(KSecureRNGTestThread3, "SecureRNGTestThread3");
+
+//length of the buffer data
+const TInt KDataLength = 10;
+
+/*
+ *Test Secure RNG with invalid and non-writable and non modifiable descriptor type
+ */
+TInt PanicFuncForBadDesc(TAny* aDes)
+ {
+ Math::Random(*(TDes8*)aDes);
+ return KErrNone;
+ }
+
+void CreatePanicThreads(TAny* aThreadData, TInt aExpectedStatusOfThread)
+ {
+ RThread panicThread;
+ _LIT(KPanicThreadName, "SecureRNGTestPanicThread");
+
+ test(panicThread.Create(KPanicThreadName(),PanicFuncForBadDesc,KDefaultStackSize,0x200,0x900,aThreadData) == KErrNone);
+ TRequestStatus status;
+ panicThread.Logon(status);
+ panicThread.Resume();
+ User::WaitForRequest(status);
+ test.Printf(_L("Exit Reason %d\r\n"), status.Int());
+ test.Printf(_L("Exit Type %d\r\n"),(TInt)panicThread.ExitType());
+ //Test for expected result from thread
+ test(status.Int()== aExpectedStatusOfThread); //(status of thread = thread Exit Reason)
+ test(panicThread.ExitCategory() == _L("KERN-EXEC"));
+ test(panicThread.ExitType()==EExitPanic);
+
+ CLOSE_AND_WAIT(panicThread);
+ }
+
+/*
+ * Panic test cases for testing Secure RNG
+ */
+void TestSecureRNGForPanicScenarios()
+ {
+ test.Printf(_L("Passing user non-writable memory address to the random function through a valid pointer \n"));
+ TPtr8 tptr(KernData(), KDataLength, KDataLength);
+ CreatePanicThreads(&tptr, 3);
+
+ test.Printf(_L("Passing null pointer to random function \n"));
+ tptr.Set(NULL, KDataLength, KDataLength);
+ CreatePanicThreads(&tptr, 3);
+
+ test.Printf(_L("Passing non-modifiable descriptor to the random function \n"));
+ HBufC8* randbuf =HBufC8::New(25);
+ TPtr8 ptr = randbuf->Des();
+ ptr.SetMax();
+ CreatePanicThreads(randbuf, 34);
+ delete randbuf;
+ }
+
+TInt GenerateRandomNumber(TAny*)
+ {
+ HBufC8* randbuf = HBufC8::New(3000);
+ TPtr8 ptr = randbuf->Des();
+ ptr.SetMax();
+ for(;;)
+ {
+ Math::Random(ptr);
+ }
+ }
+
+/*
+ * Test Secure RNG with multi threads requesting for random numbers
+ */
+void SecureRNGTestWithMultiThread()
+ {
+ test(SecureRNGTestThread1.Create(KSecureRNGTestThread1(),GenerateRandomNumber,KDefaultStackSize,0x200,0x900,NULL)== KErrNone);
+ SecureRNGTestThread1.SetPriority(EPriorityLess);
+ test(SecureRNGTestThread2.Create(KSecureRNGTestThread2(),GenerateRandomNumber,KDefaultStackSize,0x200,0x900,NULL)== KErrNone);
+ SecureRNGTestThread2.SetPriority(EPriorityLess);
+ test(SecureRNGTestThread3.Create(KSecureRNGTestThread3(),GenerateRandomNumber,KDefaultStackSize,0x200,0x900,NULL)== KErrNone);
+ SecureRNGTestThread3.SetPriority(EPriorityLess);
+
+ SecureRNGTestThread1.Resume();
+ SecureRNGTestThread2.Resume();
+ SecureRNGTestThread3.Resume();
+
+ User::After(30 * 1000 * 1000); //30 seconds
+ // After waiting for few seconds, kill the threads now.
+ SecureRNGTestThread1.Kill(KErrNone);
+ test(SecureRNGTestThread1.ExitType()==EExitKill);
+ SecureRNGTestThread2.Kill(KErrNone);
+ test(SecureRNGTestThread2.ExitType()==EExitKill);
+ SecureRNGTestThread3.Kill(KErrNone);
+ test(SecureRNGTestThread3.ExitType()==EExitKill);
+
+ CLOSE_AND_WAIT(SecureRNGTestThread1);
+ CLOSE_AND_WAIT(SecureRNGTestThread2);
+ CLOSE_AND_WAIT(SecureRNGTestThread3);
+ }
+
+const TInt KChunkLength = 2048;
+void CheckForRandomNumbers(const TUint8* aRandomNumbers, TInt aLength)
+ {
+ TBuf8<KChunkLength> buf;
+ buf.FillZ();
+ TInt bytesToCompare = aLength;
+ TInt index = 0;
+ while(bytesToCompare > 0)
+ {
+ // check there is at least some random numbers in every chunk
+ TInt newLength = bytesToCompare > KChunkLength ? KChunkLength : bytesToCompare;
+ test(memcompare(aRandomNumbers+ (index* KChunkLength), newLength, buf.Ptr(), newLength) != 0);
+ index++;
+ bytesToCompare = bytesToCompare - KChunkLength;
+ }
+ }
+/*
+ * Functionality test for the Random APIs
+ */
+//required for testing for large number of random numbers request
+const TInt KRandomNumsRequired = 70000;
+void TestRandomNumberGeneration()
+ {
+ test.Printf(_L(" Request for zero random numbers \n"));
+ TBuf8<KDataLength> randomBuffer;
+ randomBuffer.SetLength(0);
+ TRAPD(error, Math::RandomL(randomBuffer));
+ test(error == KErrNone);
+
+ test.Printf(_L(" Request for huge random numbers of 70000 bytes in length \n"));
+ HBufC8* randbuf =HBufC8::New(KRandomNumsRequired);
+ TPtr8 ptr = randbuf->Des();
+ ptr.SetMax();
+ TRAP(error, Math::RandomL(ptr));
+ test(error == KErrNotReady || error == KErrNone);
+ //check we have some random numbers atleast in every chunk of large randomnumbers received
+ CheckForRandomNumbers(ptr.Ptr(), KRandomNumsRequired);
+ delete randbuf;
+
+ test.Printf(_L(" Request for 32 bit random number using the new leaving function: Math::RandomL() api \n"));
+ for (TInt i=0; i<50; ++i)
+ {
+ // Try to prove it's working by looking for a nonzero value - 50 32-bit zero values
+ // in a row from a random source is extremely unlikely. However, if it's not ready
+ // we will get 0 every time as the return value is not set when it leaves, so we
+ // give up.
+ TUint32 randomNumber = 0;
+ TRAP(error ,randomNumber = Math::RandomL());
+ test.Printf(_L("The generated four byte random number is %d \n" ), randomNumber);
+ test(error == KErrNotReady || error == KErrNone);
+ if (error == KErrNotReady || randomNumber != 0)
+ break;
+ }
+ }
+
+/*
+ * Test Secure RNG for functionality test, multi-thread tests and panic test cases
+ */
+void SecureRNGTest()
+ {
+ test.Printf(_L("\n Functionality test for RNG \n"));
+ TestRandomNumberGeneration();
+
+ // Test Secure RNG with multi threads
+ test.Printf(_L("Testing Secure RNG with Multithreads requesting for random numbers \n"));
+ SecureRNGTestWithMultiThread();
+
+ //Panic test cases - check with non-writable descriptor type and null pointer
+ test.Printf(_L("\n Panic test cases for Secure RNG \n"));
+ TestSecureRNGForPanicScenarios();
+ }
+
+/*
+Gobal Entry Function
+*/
+GLDEF_C TInt E32Main()
+ {
+ test.Title();
+ test.Start(_L("\n Starting Secure RNG Unit tests \n"));
+
+ CTrapCleanup* cleanup=CTrapCleanup::New();
+ test(cleanup != NULL);
+
+ __KHEAP_MARK;
+ __UHEAP_MARK;
+ SecureRNGTest();
+ __UHEAP_MARKEND;
+ __KHEAP_MARKEND;
+
+ test.End();
+ delete cleanup;
+ return KErrNone;
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/kerneltest/e32test/random/t_sha256.cpp Fri Mar 12 15:50:11 2010 +0200
@@ -0,0 +1,98 @@
+// 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/random/tsha256.cpp
+//
+
+//---------------------------------------------------------------------------------------------------------------------
+//! @SYMTestCaseID KBASE-sha256-2701
+//! @SYMTestType UT
+//! @SYMTestCaseDesc Verifies the implementation of SHA256 used by the Secure RNG
+//! @SYMPREQ PREQ211
+//! @SYMTestPriority High
+//! @SYMTestActions
+//! 1. Tests the correct operation of the SHA256 implementation used by the Secure RNG using publically published
+//! test vectors and corresponding outputs.
+//!
+//! @SYMTestExpectedResults
+//! 1. The implementation should always return the expected outputs for the given test vectors.
+//---------------------------------------------------------------------------------------------------------------------
+
+//epoc include
+#include <e32test.h>
+//user include
+#include "sha256.h"
+
+
+//RTest for testing SHA256
+RTest test(_L("Unit Test For SHA256"));
+
+//Test data input for SHA256 taken from FIPS 180-2 and openssl
+_LIT8(KTestData1, "\x61\x62\x63");
+_LIT8(KTestData2, "\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F\x10\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F\x10\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F\x10\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F\x10");
+_LIT8(KTestData3, "\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F\x10\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F\x10\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F\x10\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F\x10\x01\x02\x03\x04");
+
+//Expected output for the above test data input for SHA256 taken from FIPS 180-2
+_LIT8(KTestVector1, "\xba\x78\x16\xbf\x8f\x01\xcf\xea\x41\x41\x40\xde\x5d\xae\x22\x23\xb0\x03\x61\xa3\x96\x17\x7a\x9c\xb4\x10\xff\x61\xf2\x00\x15\xad");
+_LIT8(KTestVector2, "\x91\x1B\x64\x76\x69\x49\xA2\xE8\x56\xF1\xB6\xC3\x50\x1D\x5A\x6B\xF1\x7D\xD5\x0B\x6A\x78\xD6\x09\x3A\xFC\x42\x52\xD2\xF7\x1A\x18");
+_LIT8(KTestVector3, "\x27\x53\x57\xF9\x38\x73\xAF\xFF\xF0\x0C\x4A\x83\x04\x33\xCA\x51\x37\xCC\x32\x7D\xDF\xB1\x5C\x46\xD6\xCD\x8A\x0A\x8A\x6E\x48\x3C");
+
+/*
+Functionality test for SHA256 algorithm
+*/
+void Sha256FunctionalityTest(const TDesC8& aMessageData, const TDesC8& aHashOfMessageData)
+ {
+ TBuf8<KSHA256HashSize> hash; // temp buffer
+ SHA256 sha256;
+ sha256.Update(aMessageData.Ptr(), aMessageData.Length());
+ hash.Copy(sha256.Final().Ptr(),KSHA256HashSize);
+ TInt compareVal = aHashOfMessageData.Compare(hash);
+ test(compareVal == 0);
+ }
+
+/*
+Basic functionality test for Sha256
+*/
+void SHA2Tests()
+ {
+ //functionality test for Hash Algorithm using short message data (3 bytes in length)
+ Sha256FunctionalityTest(KTestData1(), KTestVector1());
+
+ //functionality test for Hash Algorithm using sha256 block size message data (64 bytes)
+ Sha256FunctionalityTest(KTestData2(), KTestVector2());
+
+ //functionality test for Hash Algorithm using long message data (68 bytes)
+ Sha256FunctionalityTest(KTestData3(), KTestVector3());
+ }
+
+/*
+Main function for sha256 algorithm testing
+*/
+GLDEF_C TInt E32Main(void)
+ {
+ test.Title();
+ test.Start(_L(" SHA256 Algorithm Test \n"));
+
+ CTrapCleanup* cleanup=CTrapCleanup::New();
+ test(cleanup != NULL);
+
+ __UHEAP_MARK;
+ SHA2Tests();
+ __UHEAP_MARKEND;
+
+ test.End();
+ delete cleanup;
+ return KErrNone;
+ }
+
+
+
--- a/kerneltest/e32test/video/t_videomemory.cpp Sat Feb 20 00:10:51 2010 +0200
+++ b/kerneltest/e32test/video/t_videomemory.cpp Fri Mar 12 15:50:11 2010 +0200
@@ -115,7 +115,6 @@
test(KErrNone == ret);
pChunkBase = reinterpret_cast<TUint32 *>(chunk.Base());
- test.Printf(_L("Display Memory Address = %08x\n"), reinterpret_cast<TUint>(pChunkBase));
*pChunkBase = KTestValue2;
test(KTestValue2 == *pChunkBase);
// We should see the new value through the pMemory pointer!
@@ -123,7 +122,8 @@
{
test(KTestValue2 == *pMemory);
}
-
+ // print it after test as this will corrupt memory buffer
+ test.Printf(_L("Display Memory Address = %08x\n"), reinterpret_cast<TUint>(pChunkBase));
}
else
{
@@ -186,10 +186,11 @@
test(KErrNone == ret);
pChunkBase2 = reinterpret_cast<TUint32 *>(chunk2.Base());
- test.Printf(_L("Display Memory Address = %08x\n"), reinterpret_cast<TUint>(pChunkBase));
test(KTestValue2 == *pChunkBase2);
*pChunkBase2 = KTestValue3;
test(KTestValue3 == *pChunkBase2);
+ // print it after test as this will corrupt memory buffer
+ test.Printf(_L("Display Memory Address = %08x\n"), reinterpret_cast<TUint>(pChunkBase));
chunk2.Close();
}
--- a/kerneltest/f32test/server/t_fman.cpp Sat Feb 20 00:10:51 2010 +0200
+++ b/kerneltest/f32test/server/t_fman.cpp Fri Mar 12 15:50:11 2010 +0200
@@ -13,6 +13,8 @@
// Description:
//
+#define __E32TEST_EXTENSION__
+
#include <f32file.h>
#include <e32test.h>
#include <hal.h>
@@ -57,8 +59,8 @@
TFileName fileName=iFileMan->CurrentEntry().iName;
if (gAsynch==EFalse)
test.Printf(_L("CurrentEntry is %S\n"),&fileName);
- test(lastError==KErrAlreadyExists);
- test(fileName.MatchF(_L("PIPE1.PLP"))!=KErrNotFound || fileName.MatchF(_L("FOUR"))!=KErrNotFound || fileName.MatchF(_L("File*.TXT"))!=KErrNotFound || fileName.MatchF(_L("ah"))!=KErrNotFound || fileName.MatchF(_L("a"))!=KErrNotFound);
+ test_Equal(KErrAlreadyExists, lastError);
+ test_Value(KErrNotFound, fileName.MatchF(_L("PIPE1.PLP"))!=KErrNotFound || fileName.MatchF(_L("FOUR"))!=KErrNotFound || fileName.MatchF(_L("File*.TXT"))!=KErrNotFound || fileName.MatchF(_L("ah"))!=KErrNotFound || fileName.MatchF(_L("a"))!=KErrNotFound);
}
return(MFileManObserver::EContinue);
}
@@ -78,7 +80,7 @@
//
{
User::WaitForRequest(gStat);
- test(gStat==aResult);
+ test_Value(aResult, gStat==aResult);
}
LOCAL_C void TestResult(TInt aReturnVal, TInt aExpectedAsynchReturnStatus=KErrNone, TInt aExpectedSynchReturn=KErrNone)
@@ -87,10 +89,12 @@
//
{
if (!gAsynch)
- test(aReturnVal==aExpectedAsynchReturnStatus);
+ {
+ test_Equal(aExpectedAsynchReturnStatus, aReturnVal);
+ }
else
{
- test(aReturnVal==aExpectedSynchReturn);
+ test_Equal(aExpectedSynchReturn, aReturnVal);
WaitForResult(aExpectedAsynchReturnStatus);
}
}
@@ -102,7 +106,7 @@
{
gFileMan->Attribs(aDirName, 0, KEntryAttReadOnly, 0, CFileMan::ERecurse);
TInt r=gFileMan->RmDir(aDirName);
- test(r==KErrNone || r==KErrNotFound || r==KErrPathNotFound);
+ test_Value(r, r==KErrNone || r==KErrNotFound || r==KErrPathNotFound);
}
LOCAL_C void Compare(const TDesC& aDir1,const TDesC& aDir2)
@@ -174,25 +178,25 @@
*aDestOtherDrive = gSessionPath[0] == 'C' ? _L("Y:\\F32-TST\\TFMAN\\dest\\") : _L("C:\\F32-TST\\TFMAN\\dest\\");
#endif
err = TheFs.MkDirAll(*aDestOtherDrive);
- test(err == KErrNone || err == KErrAlreadyExists);
+ test_Value(err, err == KErrNone || err == KErrAlreadyExists);
}
err = TheFs.MkDirAll(sourceName);
- test(err == KErrNone || err == KErrAlreadyExists);
+ test_Value(err, err == KErrNone || err == KErrAlreadyExists);
err = TheFs.MkDirAll(sourceCompare);
- test(err == KErrNone || err == KErrAlreadyExists);
+ test_Value(err, err == KErrNone || err == KErrAlreadyExists);
err = TheFs.MkDirAll(destSameDrive);
- test(err == KErrNone || err == KErrAlreadyExists);
+ test_Value(err, err == KErrNone || err == KErrAlreadyExists);
if(aCreateFiles)
{
err = TheFs.MkDirAll(sourceNameSubDir);
- test(err == KErrNone || err == KErrAlreadyExists);
+ test_Value(err, err == KErrNone || err == KErrAlreadyExists);
err = TheFs.MkDirAll(sourceCompareSubDir);
- test(err == KErrNone || err == KErrAlreadyExists);
+ test_Value(err, err == KErrNone || err == KErrAlreadyExists);
for(TInt i=0; i<5; i++)
{
@@ -204,7 +208,7 @@
RFile file;
err = file.Create(TheFs,name,EFileRead|EFileWrite);
- test(err == KErrNone || err == KErrAlreadyExists);
+ test_Value(err, err == KErrNone || err == KErrAlreadyExists);
file.Close();
// ...and another to compare against
@@ -214,7 +218,7 @@
name.Append(_L(".TXT"));
err = file.Create(TheFs,name,EFileRead|EFileWrite);
- test(err == KErrNone || err == KErrAlreadyExists);
+ test_Value(err, err == KErrNone || err == KErrAlreadyExists);
file.Close();
}
}
@@ -233,7 +237,7 @@
buf.Insert(0, _L("\\"));
buf.Append(_L("\\file"));
err = TheFs.Delete(buf);
- test(err == KErrNone);
+ test_KErrNone(err);
ret = ETrue;
}
RmDir(_L("\\longname1\\"));
@@ -276,7 +280,7 @@
MakeFile(_L("\\TEST\\LONG\\NAME\\ABCDE\\FILEFILE01FILEFILE02FILEFILE03FILEFILE04"));
TFileName name1(KLongName1);
r=gFileMan->Rename(_L("\\TEST\\LONG"),name1,CFileMan::EOverWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
// Two long directory names - makes paths invalid
MakeDir(_L("\\TEST\\LONG\\NAME\\FGHIJ"));
MakeDir(_L("\\TEST\\LONG\\NAME\\FGHIJ\\DIRECTORY1DIRECTORY2DIRECTORY3DIRECTORY4\\"));
@@ -285,14 +289,14 @@
// Testing invalid long file name (i.e. >256)
r=gFileMan->Rename(_L("\\TEST\\LONG"),KInvalidLongName,CFileMan::EOverWrite);
- test(r==KErrBadName);
+ test_Equal(KErrBadName, r);
// Testing invalid long path (i.e. >256)
r=gFileMan->Rename(_L("\\TEST\\LONG"),KInvalidLongPath,CFileMan::EOverWrite);
- test(r==KErrBadName);
+ test_Equal(KErrBadName, r);
r=gFileMan->Rename(_L("\\TEST\\LONG"),_L("\\TEST\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20as\\fdsa21asdffds"),CFileMan::EOverWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
}
//testing invalid source path at the beginning:
@@ -337,10 +341,10 @@
TFileName name1(KLongName1);
name1+=_L("\\NAME\\ABCDE\\*.*");
r=gFileMan->Delete(name1);
- test(r==KErrNone);
+ test_KErrNone(r);
r=gFileMan->Delete(_L("\\TEST\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20as\\fdsa21asdffds\\NAME\\FGHIJ\\*.*"));
- test(r==KErrNone);
+ test_KErrNone(r);
}
}
else
@@ -353,11 +357,11 @@
name1+=_L("\\NAME\\ABCDE\\*.*");
r=gFileMan->Delete(name1,0,gStat);
WaitForSuccess();
- test(r==KErrNone);
+ test_KErrNone(r);
r=gFileMan->Delete(_L("\\TEST\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20as\\fdsa21asdffds\\NAME\\FGHIJ\\*.*"),0,gStat);
WaitForSuccess();
- test(r==KErrNone);
+ test_KErrNone(r);
}
}
@@ -372,7 +376,7 @@
if (testingInvalidPathLengths)
{
r=gFileMan->RmDir(_L("\\TEST\\"));
- test(r==KErrNone);
+ test_KErrNone(r);
}
/**
@@ -383,25 +387,25 @@
*/
TInt theDrive;
r=TheFs.CharToDrive(gDriveToTest,theDrive);
- test(r==KErrNone);
+ test_KErrNone(r);
TFSName f;
r = TheFs.FileSystemName(f, theDrive);
- test(r == KErrNone || r == KErrNotFound);
+ test_Value(r, r == KErrNone || r == KErrNotFound);
if (f.FindF(_L("Fat")) == 0 )
{
test.Next(_L("Test wild card matching in short file names"));
MakeFile(_L("abcdefghi.txt"));
TInt err = gFileMan->Delete(_L("ABCDEF~*"));
- test(err == KErrNone);
+ test_KErrNone(err);
MakeFile(_L("abcdefghi.txt"));
err = gFileMan->Delete(_L("ABCDEF~*.TXT"));
- test(err == KErrNone);
+ test_KErrNone(err);
MakeFile(_L("abcdefghi.txt"));
err = gFileMan->Delete(_L("ABCDEF~*.?XT"));
- test(err == KErrNone);
+ test_KErrNone(err);
MakeFile(_L("abcdefghi.txt"));
err = gFileMan->Delete(_L("ABCDEF~1.*"));
- test(err == KErrNone);
+ test_KErrNone(err);
}
}
@@ -441,7 +445,7 @@
MakeFile(_L("\\START\\LONG\\DINOSAUR01DINOSAUR02DINOSAUR03DINOSAUR04.txt"));
MakeFile(_L("\\START\\LONG\\FILEFILE01FILEFILE02FILEFILE03FILEFILE04.txt"));
r=gFileMan->Rename(_L("\\START\\LONG"),_L("\\START\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff"),CFileMan::EOverWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
MakeDir(_L("\\START\\ASDFFDSA\\"));
}
@@ -533,35 +537,35 @@
if (!gAsynch)
{
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\DELDIR\\*.TXT"),_L("\\F32-TST\\TFMAN\\COPYDIR\\"));
- test(r==KErrNone);
+ test_KErrNone(r);
if (testingInvalidPathLengths)
{
test.Next(_L("Test invalid length paths"));
r=gFileMan->Copy(_L("\\START\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff\\*.*"),_L("\\FINISH\\"));
- test(r==KErrNone);
+ test_KErrNone(r);
r=gFileMan->RmDir(_L("\\START\\"));
- test(r==KErrNone);
+ test_KErrNone(r);
r=gFileMan->RmDir(_L("\\FINISH\\"));
- test(r==KErrNone);
+ test_KErrNone(r);
}
}
else
{
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\DELDIR\\*.TXT"),_L("\\F32-TST\\TFMAN\\COPYDIR\\"),0,gStat);
WaitForSuccess();
- test(r==KErrNone);
+ test_KErrNone(r);
if (testingInvalidPathLengths)
{
test.Next(_L("Test invalid length paths (Asynch)"));
r=gFileMan->Copy(_L("\\START\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff\\*.*"),_L("\\FINISH\\"),0,gStat);
WaitForSuccess();
- test(r==KErrNone);
+ test_KErrNone(r);
r=gFileMan->RmDir(_L("\\START\\"),gStat);
WaitForSuccess();
- test(r==KErrNone);
+ test_KErrNone(r);
r=gFileMan->RmDir(_L("\\FINISH\\"),gStat);
WaitForSuccess();
- test(r==KErrNone);
+ test_KErrNone(r);
}
}
@@ -593,23 +597,27 @@
TEntry entry;
r=TheFs.Entry(_L("\\F32-TST\\TFMAN\\COPYDIR\\T_FSRV.CPP"),entry);
- test(r==KErrNone);
+ test_KErrNone(r);
test(entry.iName.MatchF(_L("T_FSRV.CPP"))!=KErrNotFound);
#if defined (__WINS__)
- test(entry.iAtt==KEntryAttArchive);
+ test_Equal(KEntryAttArchive, entry.iAtt);
#else
if (!IsTestingLFFS())
- test(entry.iAtt==KEntryAttReadOnly);
+ {
+ test_Equal(KEntryAttReadOnly, entry.iAtt);
+ }
else
+ {
test(entry.iAtt&KEntryAttReadOnly); // ???
+ }
#endif
r=TheFs.SetAtt(_L("\\F32-TST\\TFMAN\\COPYDIR\\T_FSRV.CPP"),0,KEntryAttReadOnly);
- test(r==KErrNone);
+ test_KErrNone(r);
r=gFileMan->Delete(_L("\\F32-TST\\TFMAN\\AFTER\\RUMBA?.TXT"));
- test(r==KErrNone);
+ test_KErrNone(r);
r=gFileMan->Delete(_L("\\F32-TST\\TFMAN\\DELDIR\\RUMBA?.TXT"));
- test(r==KErrNone);
+ test_KErrNone(r);
}
LOCAL_C void TestDEF121663_Setup(TFileName& aSrcPath)
@@ -1017,7 +1025,7 @@
MakeFile(_L("\\START\\LONG\\DINOSAUR01DINOSAUR02DINOSAUR03DINOSAUR04.txt"));
MakeFile(_L("\\START\\LONG\\FILEFILE01FILEFILE02FILEFILE03FILEFILE04.txt"));
r=gFileMan->Rename(_L("\\START\\LONG"),_L("\\START\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff"),CFileMan::EOverWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
// Two long directory names - makes paths invalid
MakeDir(_L("\\TEST\\LONG\\NAME\\FGHIJ"));
@@ -1025,7 +1033,7 @@
MakeFile(_L("\\TEST\\LONG\\NAME\\FGHIJ\\ELEPHANT01ELEPHANT02ELEPHANT03ELEPHANT04"));
MakeFile(_L("\\TEST\\LONG\\NAME\\FGHIJ\\FILEFILE01FILEFILE02FILEFILE03FILEFILE04"));
r=gFileMan->Rename(_L("\\TEST\\LONG"),_L("\\TEST\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20as\\fdsa21asdffds"),CFileMan::EOverWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
MakeDir(_L("\\START\\ASDFFDSA\\"));
}
@@ -1106,30 +1114,30 @@
if ((!gAsynch)&&(testingInvalidPathLengths))
{
r=gFileMan->Move(_L("\\START\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff\\*.*"),_L("\\FINISH\\"));
- test(r==KErrNone);
+ test_KErrNone(r);
r=gFileMan->Move(_L("\\TEST\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20as\\fdsa21asdffds\\*.*"),_L("\\FINISH\\"), CFileMan::EOverWrite | CFileMan::ERecurse);
- test(r==KErrNone);
+ test_KErrNone(r);
r=gFileMan->RmDir(_L("\\START\\"));
- test(r==KErrNone);
+ test_KErrNone(r);
r=gFileMan->RmDir(_L("\\FINISH\\"));
- test(r==KErrNone);
+ test_KErrNone(r);
}
if ((gAsynch)&&(testingInvalidPathLengths))
{
r=gFileMan->Move(_L("\\START\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff\\*.*"),_L("\\FINISH\\"),CFileMan::EOverWrite,gStat);
User::WaitForRequest(gStat);
- test(r==KErrNone);
+ test_KErrNone(r);
r=gFileMan->Move(_L("\\TEST\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20as\\fdsa21asdffds\\*.*"),_L("\\FINISH\\"), CFileMan::EOverWrite | CFileMan::ERecurse,gStat);
User::WaitForRequest(gStat);
- test(r==KErrNone);
+ test_KErrNone(r);
r=gFileMan->RmDir(_L("\\START\\"),gStat);
WaitForSuccess();
- test(r==KErrNone);
+ test_KErrNone(r);
r=gFileMan->RmDir(_L("\\FINISH\\"),gStat);
WaitForSuccess();
- test(r==KErrNone);
+ test_KErrNone(r);
}
if (!gAsynch)
@@ -1157,7 +1165,7 @@
r=gFileMan->Move(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE1.TXT"),_L("\\F32-TST\\TFMAN\\MoveDIR\\FILE1.TXT"),0,gStat);
TestResult(r,KErrAlreadyExists);
r=TheFs.Delete(_L("\\F32-TST\\TFMAN\\DELDIR\\FILE1.TXT"));
- test(r==KErrNone);
+ test_KErrNone(r);
test.Next(_L("Check files have been moved"));
RmDir(_L("\\F32-TST\\TFMAN\\AFTER\\*"));
@@ -1176,7 +1184,7 @@
if (testingInvalidPathLengths)
{
r=gFileMan->RmDir(_L("\\TEST\\"));
- test(r==KErrNone);
+ test_KErrNone(r);
}
TestDEF121663(); // Test moving directory to its subdirectory
@@ -1207,9 +1215,9 @@
CFileMan* fman=CFileMan::NewL(TheFs);
TRequestStatus stat1;
TInt r=fman->Delete(_L("\\F32-TST\\TFMAN\\FMAN1\\*.*"),0,stat1);
- test(r==KErrNone);
+ test_KErrNone(r);
r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\FMAN2\\*.TXT"),_L("\\F32-TST\\TFMAN\\FMAN2\\*.EXT"),0,gStat);
- test(r==KErrNone);
+ test_KErrNone(r);
FOREVER
{
if (stat1!=KRequestPending && gStat!=KRequestPending)
@@ -1243,11 +1251,11 @@
MakeFile(_L("\\DEF092084\\FILE1.TXT"));
TInt r = gFileMan->Rename(_L("\\DEF092084\\*.TXT"),_L("\\DEF092084\\*.DDB"), CFileMan::EOverWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
CheckFileExists(_L("\\DEF092084\\FILE1.DDB"), KErrNone);
r = gFileMan->Rename(_L("\\DEF092084\\?*.DD?"),_L("\\DEF092084\\?*.TXT"), CFileMan::EOverWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
CheckFileExists(_L("\\DEF092084\\FILE1.TXT"), KErrNone);
RmDir(_L("\\DEF092084\\"));
@@ -1316,44 +1324,44 @@
test.Printf(_L("1: Create Test File\n"));
RFile testFile;
r = testFile.Create(TheFs, KTestFile, EFileRead | EFileWrite);
- test(r == KErrNone);
+ test_KErrNone(r);
test.Printf(_L("2: Populate testFile1 Data\n"));
r = testFile.Write(_L8("ABCDEFGHIJKLMNOPQRSTUVWXYZ"));
- test(r == KErrNone);
+ test_KErrNone(r);
test.Printf(_L("3: Get Initial Attributes\n"));
TUint atts = 0;
r = testFile.Att(atts);
- test(r == KErrNone);
+ test_KErrNone(r);
test.Printf(_L(" Attributes: %08x"), atts);
test.Printf(_L("4: Set KEntryAttHidden Attribute\n"));
r = testFile.SetAtt(KEntryAttHidden, 0);
- test(r == KErrNone);
+ test_KErrNone(r);
test.Printf(_L("5: Verify KEntryAttHidden Attribute is set for testFile1\n"));
r = testFile.Att(atts);
- test(r == KErrNone);
+ test_KErrNone(r);
test(atts & KEntryAttHidden);
test.Printf(_L("6: Read Data from beginning of file testFile1\n"));
TBuf8<4> data;
r = testFile.Read(0, data);
- test(r == KErrNone);
+ test_KErrNone(r);
test.Printf(_L("7: Close all the testFiles\n"));
testFile.Close();
test.Printf(_L("8: Verify KEntryAttHidden is present\n"));
r = TheFs.Att(KTestFile, atts);
- test(r == KErrNone);
+ test_KErrNone(r);
test.Printf(_L(" Finally, attributes are : %08x\n"), atts);
test(atts & KEntryAttHidden);
test.Printf(_L("9: Delete Test File\n"));
r = TheFs.Delete(KTestFile);
- test(r == KErrNone || r == KErrNotFound);
+ test_Value(r, r == KErrNone || r == KErrNotFound);
}
LOCAL_C void TestDEF113299()
@@ -1413,7 +1421,7 @@
MakeFile(_L("\\LONGNAME\\DINOSAUR01DINOSAUR02DINOSAUR03DINOSAUR04.txt"));
MakeFile(_L("\\LONGNAME\\FILEFILE01FILEFILE02FILEFILE03FILEFILE04.bin"));
r=gFileMan->Rename(_L("\\LONGNAME"),_L("\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff"),CFileMan::EOverWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
// Two long directory names - makes paths invalid
MakeDir(_L("\\TEST\\LONG\\NAME\\FGHIJ"));
@@ -1421,7 +1429,7 @@
MakeFile(_L("\\TEST\\LONG\\NAME\\FGHIJ\\ELEPHANT01ELEPHANT02ELEPHANT03ELEPHANT.txt"));
MakeFile(_L("\\TEST\\LONG\\NAME\\FGHIJ\\FILEFILE01FILEFILE02FILEFILE03FILEFILE.txt"));
r=gFileMan->Rename(_L("\\TEST\\LONG"),_L("\\TEST\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20as\\fdsa21asdffds"),CFileMan::EOverWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
}
//testing invalid source path at the beginning:
@@ -1494,28 +1502,28 @@
if (!gAsynch)
{
r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\RENAME\\SRC\\*.TXT"),_L("\\F32-TST\\TFMAN\\RENAME\\DEST\\*.DDB"),CFileMan::EOverWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
if (testingInvalidPathLengths)
{
r=gFileMan->Rename(_L("\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff\\elephant01elephant02elephant03elephant04.txt"),_L("\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff\\elephant01elephant02elephant03elephant04.bin"));
- test(r==KErrBadName);
+ test_Equal(KErrBadName, r);
r=gFileMan->Rename(_L("\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff"),_L("\\Shortened"),CFileMan::EOverWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
r=gFileMan->Rename(_L("\\Shortened\\*.txt"),_L("\\Shortened\\*.cat"));
- test(r==KErrNone);
+ test_KErrNone(r);
r=gFileMan->RmDir(_L("\\Shortened\\"));
- test(r==KErrNone);
+ test_KErrNone(r);
r=gFileMan->Rename(_L("\\TEST\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20as\\fdsa21asdffds"),_L("\\TEST\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20as\\NotSoShortened"),CFileMan::EOverWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
r=gFileMan->Rename(_L("\\TEST"),_L("\\OXO!"));
- test(r==KErrNone);
+ test_KErrNone(r);
r=gFileMan->Rename(_L("\\OXO!\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20as"),_L("\\OXO!\\Shorter"));
- test(r==KErrNone);
+ test_KErrNone(r);
r=gFileMan->Rename(_L("\\OXO!\\Shorter\\NotSoShortened\\NAME\\FGHIJ\\*.txt"),_L("\\TEST\\Shorter\\NotSoShortened\\NAME\\FGHIJ\\*.cat"));
- test(r==KErrNone);
+ test_KErrNone(r);
r=gFileMan->RmDir(_L("\\OXO!\\"));
- test(r==KErrNone);
+ test_KErrNone(r);
}
}
@@ -1526,7 +1534,7 @@
if (testingInvalidPathLengths)
{
r=gFileMan->Rename(_L("\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff\\elephant01elephant02elephant03elephant04.txt"),_L("\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff\\elephant01elephant02elephant03elephant04.bin"));
- test(r==KErrBadName);
+ test_Equal(KErrBadName, r);
r=gFileMan->Rename(_L("\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff"),_L("\\Shortened"),CFileMan::EOverWrite,gStat);
WaitForSuccess();
r=gFileMan->Rename(_L("\\Shortened\\*.txt"),_L("\\Shortened\\*.bin"),0,gStat);
@@ -1536,20 +1544,20 @@
r=gFileMan->Rename(_L("\\TEST\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20as\\fdsa21asdffds"),_L("\\TEST\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20as\\NotSoShortened"),CFileMan::EOverWrite,gStat);
WaitForSuccess();
- test(r==KErrNone);
+ test_KErrNone(r);
r=gFileMan->Rename(_L("\\TEST"),_L("\\OXO!"),CFileMan::EOverWrite,gStat);
WaitForSuccess();
- test(r==KErrNone);
+ test_KErrNone(r);
r=gFileMan->Rename(_L("\\OXO!\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20as"),_L("\\OXO!\\Shorter"),CFileMan::EOverWrite,gStat);
WaitForSuccess();
- test(r==KErrNone);
+ test_KErrNone(r);
r=gFileMan->Rename(_L("\\OXO!\\Shorter\\NotSoShortened\\NAME\\FGHIJ\\*.txt"),_L("\\TEST\\Shorter\\NotSoShortened\\NAME\\FGHIJ\\*.cat"),CFileMan::EOverWrite,gStat);
WaitForSuccess();
- test(r==KErrNone);
+ test_KErrNone(r);
r=gFileMan->RmDir(_L("\\OXO!\\"));
- test(r==KErrNone);
+ test_KErrNone(r);
r=gFileMan->RmDir(_L("\\TEST\\"));
- test(r==KErrNone);
+ test_KErrNone(r);
}
}
RmDir(_L("\\F32-TST\\TFMAN\\after\\"));
@@ -1598,28 +1606,28 @@
// For this, default should be session path
TFileName sessionPath;
TInt err=TheFs.SessionPath(sessionPath);
- test(err==KErrNone);
+ test_KErrNone(err);
SetupDirectories(ETrue, NULL);
err=TheFs.SetSessionPath(_L("\\F32-TST\\TFMAN\\dest\\"));
- test(err == KErrNone);
+ test_KErrNone(err);
err = gFileMan->Rename(_L("\\F32-TST\\TFMAN\\source"), _L(""));
- test(err == KErrNone);
+ test_KErrNone(err);
Compare(_L("\\F32-TST\\TFMAN\\compare\\*"), _L("\\F32-TST\\TFMAN\\dest\\source\\*"));
RmDir(_L("\\F32-TST\\TFMAN\\dest\\"));
RmDir(_L("\\F32-TST\\TFMAN\\source\\"));
SetupDirectories(ETrue, NULL);
err=TheFs.SetSessionPath(_L("\\F32-TST\\TFMAN\\source\\"));
- test(err == KErrNone);
+ test_KErrNone(err);
err = gFileMan->Rename(_L(""), _L("\\F32-TST\\TFMAN\\dest\\"));
- test(err == KErrNone);
+ test_KErrNone(err);
Compare(_L("\\F32-TST\\TFMAN\\compare\\*"), _L("\\F32-TST\\TFMAN\\dest\\*"));
err=TheFs.SetSessionPath(sessionPath);
- test(err==KErrNone);
+ test_KErrNone(err);
TestINC109754(); // Test empty source directory should exist after contents being renamed
TestDEF092084(); // Test wildcards are replaced with letters from the matched file
@@ -1641,12 +1649,12 @@
if (!gAsynch)
{
TInt r=gFileMan->Attribs(_L("\\F32-TST\\TFMAN\\ATTRIBS\\AT*.AT"),setMask,clearMask,TTime(0));
- test(r==KErrNone);
+ test_KErrNone(r);
}
else
{
TInt r=gFileMan->Attribs(_L("\\F32-TST\\TFMAN\\ATTRIBS\\AT*.AT"),setMask,clearMask,TTime(0),0,gStat);
- test(r==KErrNone);
+ test_KErrNone(r);
WaitForSuccess();
}
@@ -1655,13 +1663,13 @@
CDir* entryList;
scan->NextL(entryList);
TInt count=entryList->Count();
- test(count==2);
+ test_Equal(2, count);
TEntry entry=(*entryList)[0];
test(entry.iName.MatchF(_L("attrib1.AT"))!=KErrNotFound);
- test(entry.iAtt==KEntryAttReadOnly);
+ test_Equal(KEntryAttReadOnly, entry.iAtt);
entry=(*entryList)[1];
test(entry.iName.MatchF(_L("attrib2.AT"))!=KErrNotFound);
- test(entry.iAtt==KEntryAttReadOnly);
+ test_Equal(KEntryAttReadOnly, entry.iAtt);
delete entryList;
TDateTime dateTime(1990,ENovember,20,9,5,0,0);
@@ -1670,22 +1678,22 @@
if (!gAsynch)
{
TInt r=gFileMan->Attribs(_L("\\F32-TST\\TFMAN\\ATTRIBS\\AT*.AT"),0,legalAttMask,time);
- test(r==KErrNone);
+ test_KErrNone(r);
}
else
{
TInt r=gFileMan->Attribs(_L("\\F32-TST\\TFMAN\\ATTRIBS\\AT*.AT"),0,legalAttMask,time,0,gStat);
- test(r==KErrNone);
+ test_KErrNone(r);
WaitForSuccess();
}
scan->SetScanDataL(_L("\\F32-TST\\TFMAN\\ATTRIBS\\*"),KEntryAttMaskSupported,ESortByName);
scan->NextL(entryList);
count=entryList->Count();
- test(count==2);
+ test_Equal(2, count);
entry=(*entryList)[0];
test(entry.iName.MatchF(_L("attrib1.AT"))!=KErrNotFound);
- test(entry.iAtt==0);
+ test_Equal(0, entry.iAtt);
TDateTime dt=(entry.iModified).DateTime();
test(dt.Year()==dateTime.Year());
test(dt.Month()==dateTime.Month());
@@ -1696,7 +1704,7 @@
test(entry.iModified==time);
entry=(*entryList)[1];
test(entry.iName.MatchF(_L("attrib2.AT"))!=KErrNotFound);
- test(entry.iAtt==0);
+ test_Equal(0, entry.iAtt);
test(entry.iModified==time);
delete entryList;
delete scan;
@@ -1727,10 +1735,10 @@
if(oldname.Length() >= KMaxFileName-5) // if not, it means that we won't be calling ShrinkNames !!
{
TInt r = gFileMan->Rename(_L("\\12345678\\Book\\12345678"),_L("\\INC091841\\Book\\012-235-abcd"),0);
- test(r==KErrNone);
+ test_KErrNone(r);
CDir* dir;
r = TheFs.GetDir(_L("\\INC091841\\Book\\012-235-abcd\\"), KEntryAttNormal, ESortNone, dir);
- test(r==KErrNone);
+ test_KErrNone(r);
r = KErrNotFound;
TInt dirlen = sizeof("\\INC091841\\Book\\012-235-abcd\\");
for(TInt i=0; r==KErrNotFound && i<dir->Count(); i++)
@@ -1741,9 +1749,9 @@
}
}
delete dir;
- test(r==KErrNone);
+ test_KErrNone(r);
r = gFileMan->RmDir(_L("\\INC091841\\"));
- test(r==KErrNone);
+ test_KErrNone(r);
}
RmDir(_L("\\12345678\\"));
}
@@ -1774,7 +1782,7 @@
MakeFile(_L("\\LONGNAMETEST\\ELEPHANT01ELEPHANT02ELEPHANT03ELEPHANT04"));
MakeFile(_L("\\LONGNAMETEST\\FILEFILE01FILEFILE02FILEFILE03FILEFILE04"));
r=gFileMan->Rename(_L("\\LONGNAMETEST"),_L("\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff"),CFileMan::EOverWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
}
//testing invalid source path at the beginning:
@@ -1813,72 +1821,72 @@
if (!gAsynch)
{
r=gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\RMDIR\\*.AT"));
- test(r==KErrNone);
+ test_KErrNone(r);
if (testingInvalidPathLengths)
{
r=gFileMan->RmDir(_L("\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff\\"));
- test(r==KErrNone);
+ test_KErrNone(r);
}
}
else
{
r=gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\RMDIR\\*.AT"),gStat);
- test(r==KErrNone);
+ test_KErrNone(r);
WaitForSuccess();
if (testingInvalidPathLengths)
{
r=gFileMan->RmDir(_L("\\asdffdsa01asdffdsa02asdffdsa03asdffdsa04asdffdsa05asdffdsa06asdffdsa07asdffdsa08asdffdsa09asdffdsa10asdffdsa11asdffdsa12asdffdsa13asdffdsa14asdffdsa15asdffdsa16asdffdsa17asdffdsa18asdffdsa19asdffdsa20asdffdsa21asdffdsa22asdff\\"),gStat);
- test(r==KErrNone);
+ test_KErrNone(r);
WaitForSuccess();
}
}
TEntry entry;
r=TheFs.Entry(_L("\\F32-TST\\TFMAN\\RMDIR"),entry);
- test(r==KErrNotFound);
+ test_Equal(KErrNotFound, r);
MakeDir(_L("\\F32-TST\\TFMAN\\READONLY\\"));
r=TheFs.SetAtt(_L("\\F32-TST\\TFMAN\\READONLY\\"),KEntryAttReadOnly,0);
- test(r==KErrNone);
+ test_KErrNone(r);
if (!gAsynch)
{
r=gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\READONLY\\"));
- test(r==KErrAccessDenied);
+ test_Equal(KErrAccessDenied, r);
}
else
{
r=gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\READONLY\\"),gStat);
- test(r==KErrNone);
+ test_KErrNone(r);
WaitForResult(KErrAccessDenied);
}
r=TheFs.SetAtt(_L("\\F32-TST\\TFMAN\\READONLY\\"),0,KEntryAttReadOnly);
- test(r==KErrNone);
+ test_KErrNone(r);
r=gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\READONLY\\"));
- test(r==KErrNone);
+ test_KErrNone(r);
// Test behaviour for omitted parameters
// For this, default should be session path
TFileName sessionPath;
r=TheFs.SessionPath(sessionPath);
- test(r==KErrNone);
+ test_KErrNone(r);
SetupDirectories(ETrue, NULL);
r=TheFs.SetSessionPath(_L("\\F32-TST\\TFMAN\\source\\"));
// Default removal of session path
r=gFileMan->RmDir(_L(""));
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.SetSessionPath(sessionPath);
r = gFileMan->Rename(_L("\\F32-TST\\TFMAN\\source\\subdir"), _L("\\F32-TST\\TFMAN\\source\\tofail"), CFileMan::ERecurse);
- test(r == KErrPathNotFound);
+ test_Equal(KErrPathNotFound, r);
r = gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\"));
- test(r==KErrNone);
+ test_KErrNone(r);
MakeDir(_L("\\F32-TST\\TFMAN\\"));
if(testingInvalidPathLengths)
@@ -1905,28 +1913,28 @@
RFile file;
r = file.Open(TheFs,_L("\\F32-TST\\TFMAN\\OPENFILE\\FILE.TXT"), EFileRead | EFileShareExclusive);
- test(r==KErrNone);
+ test_KErrNone(r);
if (!gAsynch)
{
r=gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\OPENFILE\\"));
- test(r==KErrInUse);
+ test_Equal(KErrInUse, r);
file.Close();
r=gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\OPENFILE\\"));
- test(r==KErrNone);
+ test_KErrNone(r);
}
else
{
r=gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\OPENFILE\\"), gStat);
- test(r==KErrNone);
+ test_KErrNone(r);
WaitForResult(KErrInUse);
file.Close();
r=gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\OPENFILE\\"), gStat);
- test(r==KErrNone);
+ test_KErrNone(r);
WaitForResult(KErrNone);
}
@@ -1976,7 +1984,7 @@
// For this, default should be session path
TFileName sessionPath;
r=TheFs.SessionPath(sessionPath);
- test(r==KErrNone);
+ test_KErrNone(r);
RmDir(_L("\\F32-TST\\TFMAN\\COPYDIR\\"));
MakeDir(_L("\\F32-TST\\TFMAN\\COPYDIR\\"));
@@ -2005,7 +2013,7 @@
RmDir(_L("\\F32-TST\\TFMAN\\COPYDIR\\"));
RmDir(_L("\\F32-TST\\TFMAN\\DELDIR\\"));
r=TheFs.SetSessionPath(sessionPath);
- test(r==KErrNone);
+ test_KErrNone(r);
}
LOCAL_C void TestRecursiveAttribs()
@@ -2021,12 +2029,12 @@
if (!gAsynch)
{
TInt r=gFileMan->Attribs(_L("\\F32-TST\\TFMAN\\RECATTRIBS\\"),KEntryAttReadOnly,0,TTime(0),CFileMan::ERecurse);
- test(r==KErrNone);
+ test_KErrNone(r);
}
else
{
TInt r=gFileMan->Attribs(_L("\\F32-TST\\TFMAN\\RECATTRIBS\\"),KEntryAttReadOnly,0,TTime(0),CFileMan::ERecurse,gStat);
- test(r==KErrNone);
+ test_KErrNone(r);
WaitForSuccess();
}
@@ -2035,32 +2043,44 @@
scan->SetScanDataL(_L("\\F32-TST\\TFMAN\\RECATTRIBS\\*"),KEntryAttMaskSupported,ESortByName);
scan->NextL(entryList);
TInt count=entryList->Count();
- test(count==3);
+ test_Equal(3, count);
TEntry entry=(*entryList)[0];
test(entry.iName.MatchF(_L("ATTRIB1.AT"))!=KErrNotFound);
if (!IsTestingLFFS())
- test(entry.iAtt==(KEntryAttReadOnly|KEntryAttArchive));
+ {
+ test_Equal((KEntryAttReadOnly|KEntryAttArchive), entry.iAtt);
+ }
else
+ {
test(entry.iAtt&KEntryAttReadOnly); // ???
+ }
entry=(*entryList)[1];
test(entry.iName.MatchF(_L("ATTRIB2.AT"))!=KErrNotFound);
if (!IsTestingLFFS())
- test(entry.iAtt==(KEntryAttReadOnly|KEntryAttArchive));
+ {
+ test_Equal((KEntryAttReadOnly|KEntryAttArchive), entry.iAtt);
+ }
else
+ {
test(entry.iAtt&KEntryAttReadOnly); // ???
+ }
entry=(*entryList)[2];
test(entry.iName.MatchF(_L("SUBDIR"))!=KErrNotFound);
delete entryList;
scan->NextL(entryList);
count=entryList->Count();
- test(count==1);
+ test_Equal(1, count);
entry=(*entryList)[0];
test(entry.iName.MatchF(_L("ATFILE.TXT"))!=KErrNotFound);
if (!IsTestingLFFS())
- test(entry.iAtt==(KEntryAttReadOnly|KEntryAttArchive));
+ {
+ test_Equal((KEntryAttReadOnly|KEntryAttArchive), entry.iAtt);
+ }
else
+ {
test(entry.iAtt&KEntryAttReadOnly); // ???
+ }
delete entryList;
scan->NextL(entryList);
@@ -2069,35 +2089,35 @@
if (!gAsynch)
{
TInt r=gFileMan->Attribs(_L("\\F32-TST\\TFMAN\\RECATTRIBS\\"),0,KEntryAttReadOnly|KEntryAttArchive,TTime(0),CFileMan::ERecurse);
- test(r==KErrNone);
+ test_KErrNone(r);
}
else
{
TInt r=gFileMan->Attribs(_L("\\F32-TST\\TFMAN\\RECATTRIBS\\"),0,KEntryAttReadOnly|KEntryAttArchive,TTime(0),CFileMan::ERecurse,gStat);
- test(r==KErrNone);
+ test_KErrNone(r);
WaitForSuccess();
}
scan->SetScanDataL(_L("\\F32-TST\\TFMAN\\RECATTRIBS\\*"),KEntryAttMaskSupported,ESortByName);
scan->NextL(entryList);
count=entryList->Count();
- test(count==3);
+ test_Equal(3, count);
entry=(*entryList)[0];
test(entry.iName.MatchF(_L("ATTRIB1.AT"))!=KErrNotFound);
- test(entry.iAtt==KEntryAttNormal);
+ test_Equal(KEntryAttNormal, entry.iAtt);
entry=(*entryList)[1];
test(entry.iName.MatchF(_L("ATTRIB2.AT"))!=KErrNotFound);
- test(entry.iAtt==KEntryAttNormal);
+ test_Equal(KEntryAttNormal, entry.iAtt);
entry=(*entryList)[2];
test(entry.iName.MatchF(_L("SUBDIR"))!=KErrNotFound);
delete entryList;
scan->NextL(entryList);
count=entryList->Count();
- test(count==1);
+ test_Equal(1, count);
entry=(*entryList)[0];
test(entry.iName.MatchF(_L("ATFILE.TXT"))!=KErrNotFound);
- test(entry.iAtt==KEntryAttNormal);
+ test_Equal(KEntryAttNormal, entry.iAtt);
delete entryList;
scan->NextL(entryList);
@@ -2119,12 +2139,12 @@
if (!gAsynch)
{
TInt r=gFileMan->Delete(_L("\\F32-TST\\TFMAN\\RECDELETE\\*.PLP"),CFileMan::ERecurse);
- test(r==KErrNone);
+ test_KErrNone(r);
}
else
{
TInt r=gFileMan->Delete(_L("\\F32-TST\\TFMAN\\RECDELETE\\*.PLP"),CFileMan::ERecurse,gStat);
- test(r==KErrNone);
+ test_KErrNone(r);
WaitForSuccess();
}
@@ -2230,7 +2250,7 @@
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\INC108401\\src"), _L("\\F32-TST\\TFMAN\\INC108401\\dest\\"), 0, gStat);
test.Next(_L("Test INC108401 : SAME DRIVE with 0"));
TestResult(err);
- // test(err==KErrNone);
+ // test_KErrNone(err);
RmDir(_L("\\F32-TST\\TFMAN\\INC108401\\"));
// case for gFileMan->Move(_L("\\F32-TST\\TFMAN\\INC108401\\src"), _L("\\F32-TST\\TFMAN\\INC108401\\dest\\"), CFileMan::EOverWrite);
@@ -2247,7 +2267,7 @@
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\INC108401\\src"), _L("\\F32-TST\\TFMAN\\INC108401\\dest\\"), CFileMan::EOverWrite, gStat);
test.Next(_L("Test INC108401 : SAME DRIVE with CFileMan::EOverWrite"));
TestResult(err);
- // test(err==KErrNone);
+ // test_KErrNone(err);
RmDir(_L("\\F32-TST\\TFMAN\\INC108401\\"));
// case for gFileMan->Move(_L("\\F32-TST\\TFMAN\\INC108401\\src"), _L("\\F32-TST\\TFMAN\\INC108401\\dest\\"), CFileMan::EOverWrite|CFileMan::ERecurse);
@@ -2268,7 +2288,7 @@
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\INC108401\\src"), _L("\\F32-TST\\TFMAN\\INC108401\\dest\\"), CFileMan::ERecurse|CFileMan::EOverWrite, gStat);
test.Next(_L("Test INC108401 : SAME DRIVES with CFileMan::ERecurse|CFileMan::EOverWrite"));
TestResult(err);
- // test(err==KErrNone);
+ // test_KErrNone(err);
RmDir(_L("\\F32-TST\\TFMAN\\INC108401\\"));
// cleanup for the current drive
@@ -2295,13 +2315,13 @@
MakeFile(_L("\\INC089638\\source\\subdir2\\file5"));
MakeFile(_L("\\INC089638\\source\\subdir2\\file6"));
MakeDir(_L("\\INC089638\\dest\\"));
- test(TheFs.SetAtt(_L("\\INC089638\\source\\subdir1"), KEntryAttHidden, 0) == KErrNone);
- test(TheFs.SetAtt(_L("\\INC089638\\source\\subdir2"), KEntryAttReadOnly, 0) == KErrNone);
+ test_KErrNone(TheFs.SetAtt(_L("\\INC089638\\source\\subdir1"), KEntryAttHidden, 0));
+ test_KErrNone(TheFs.SetAtt(_L("\\INC089638\\source\\subdir2"), KEntryAttReadOnly, 0));
TInt r = gFileMan->Move(_L("\\INC089638\\source\\"), _L("\\INC089638\\dest\\"), CFileMan::ERecurse);
- test(r==KErrNone);
+ test_KErrNone(r);
r = TheFs.RmDir(_L("\\INC089638\\source\\"));
- test(r==KErrNone);
+ test_KErrNone(r);
RmDir(_L("\\INC089638\\"));
}
@@ -2325,7 +2345,7 @@
err = gFileMan->Move(KSourceDir, dest, CFileMan::ERecurse|CFileMan::EOverWrite);
else
err = gFileMan->Move(KSourceDir, dest, CFileMan::ERecurse|CFileMan::EOverWrite, gStat);
- test(err==KErrInUse); // Recursive move prohibited
+ test_Equal(KErrInUse, err); // Recursive move prohibited
if (gAsynch)
WaitForResult(KErrInUse);
CheckFileContents(KFile1, _L8("qwerty"));
@@ -2386,43 +2406,43 @@
TEntry entry;
r = gFileMan->Move(src, KDest, 0); // ahsx\ah
- test(r == KErrNone);
+ test_KErrNone(r);
r = TheFs.Entry(src, entry);
- test(r == KErrNotFound);
+ test_Equal(KErrNotFound, r);
src.SetLength(src.Length()-1); // ahsx\a
r = gFileMan->Move(src, KDest, 0);
- test(r == KErrNone);
+ test_KErrNone(r);
r = TheFs.Entry(src, entry);
- test(r == KErrNotFound);
+ test_Equal(KErrNotFound, r);
src.SetLength(src.Length()-3); // ahs
r = gFileMan->Move(src, KDest, 0);
- test(r == KErrNone);
+ test_KErrNone(r);
r = TheFs.Entry(src, entry);
- test(r == KErrNotFound);
+ test_Equal(KErrNotFound, r);
src.SetLength(src.Length()-1); // ah
r = gFileMan->Move(src, KDest, 0);
- test(r == KErrAlreadyExists);
+ test_Equal(KErrAlreadyExists, r);
r = TheFs.Entry(src, entry);
- test(r == KErrNone);
+ test_KErrNone(r);
r = gFileMan->Move(src, KDest, CFileMan::EOverWrite); // ah
- test(r == KErrNone);
+ test_KErrNone(r);
r = TheFs.Entry(src, entry);
- test(r == KErrNotFound);
+ test_Equal(KErrNotFound, r);
src.SetLength(src.Length()-1); // a
r = gFileMan->Move(src, KDest, 0);
- test(r == KErrAlreadyExists);
+ test_Equal(KErrAlreadyExists, r);
r = TheFs.Entry(src, entry);
- test(r == KErrNone);
+ test_KErrNone(r);
r = gFileMan->Move(src, KDest, CFileMan::EOverWrite); // a
- test(r == KErrNone);
+ test_KErrNone(r);
r = TheFs.Entry(src, entry);
- test(r == KErrNotFound);
+ test_Equal(KErrNotFound, r);
RmDir(source);
RmDir(KDest);
@@ -2537,25 +2557,25 @@
SetupDirectories(EFalse, NULL);
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source\\"), _L("\\F32-TST\\TFMAN\\dest\\"), CFileMan::ERecurse);
- test(err == KErrNotFound); // Expected - directory is empty
+ test_Equal(KErrNotFound, err); // Expected - directory is empty
// Test that all directories are still present
TEntry entry;
err = TheFs.Entry(_L("\\F32-TST\\TFMAN\\source\\"), entry);
- test(err == KErrNone);
+ test_KErrNone(err);
err = TheFs.Entry(_L("\\F32-TST\\TFMAN\\dest\\"), entry);
- test(err == KErrNone);
+ test_KErrNone(err);
SetupDirectories(EFalse, NULL);
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source"), _L("\\F32-TST\\TFMAN\\dest\\"), CFileMan::ERecurse);
- test(err == KErrNone); // Expected - should move (or rename) directory
+ test_KErrNone(err); // Expected - should move (or rename) directory
// Test directory has been moved
err = TheFs.Entry(_L("\\F32-TST\\TFMAN\\dest\\source\\"), entry);
- test(err == KErrNone);
+ test_KErrNone(err);
err = TheFs.Entry(_L("\\F32-TST\\TFMAN\\source\\"), entry);
- test(err == KErrNotFound);
+ test_Equal(KErrNotFound, err);
RmDir(_L("\\F32-TST\\TFMAN\\dest\\source\\"));
@@ -2566,7 +2586,7 @@
SetupDirectories(ETrue, NULL);
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source\\"), _L("\\F32-TST\\TFMAN\\dest\\"), CFileMan::ERecurse | CFileMan::EOverWrite);
- test(err == KErrNone);
+ test_KErrNone(err);
Compare(_L("\\F32-TST\\TFMAN\\compare\\*"), _L("\\F32-TST\\TFMAN\\dest\\*"));
@@ -2587,7 +2607,7 @@
RmDir(_L("\\F32-TST\\TFMAN\\dest\\"));
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source\\"), _L("\\F32-TST\\TFMAN\\dest\\"), CFileMan::ERecurse);
- test(err == KErrNone);
+ test_KErrNone(err);
Compare(_L("\\F32-TST\\TFMAN\\compare\\*"), _L("\\F32-TST\\TFMAN\\dest\\*"));
@@ -2596,7 +2616,7 @@
RmDir(_L("\\F32-TST\\TFMAN\\dest\\"));
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source\\"), _L("\\F32-TST\\TFMAN\\dest"), CFileMan::ERecurse);
- test(err == KErrNone);
+ test_KErrNone(err);
Compare(_L("\\F32-TST\\TFMAN\\compare\\*"), _L("\\F32-TST\\TFMAN\\dest\\*"));
@@ -2605,7 +2625,7 @@
RmDir(_L("\\F32-TST\\TFMAN\\dest\\"));
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source"), _L("\\F32-TST\\TFMAN\\dest\\"), CFileMan::ERecurse);
- test(err == KErrNone);
+ test_KErrNone(err);
MakeDir(_L("\\F32-TST\\TFMAN\\compare\\subdir\\"));
Compare(_L("\\F32-TST\\TFMAN\\compare\\*"), _L("\\F32-TST\\TFMAN\\dest\\source\\*"));
@@ -2616,7 +2636,7 @@
RmDir(_L("\\F32-TST\\TFMAN\\dest\\"));
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source\\File1.TXT"), _L("\\F32-TST\\TFMAN\\dest\\"), CFileMan::ERecurse);
- test(err == KErrNone);
+ test_KErrNone(err);
CheckFileExists(_L("\\F32-TST\\TFMAN\\source\\File1.TXT"), KErrNotFound, ETrue);
CheckFileExists(_L("\\F32-TST\\TFMAN\\dest\\File1.TXT"), KErrNone, ETrue);
@@ -2628,28 +2648,28 @@
// For this, default should be session path
TFileName sessionPath;
err=TheFs.SessionPath(sessionPath);
- test(err==KErrNone);
+ test_KErrNone(err);
SetupDirectories(ETrue, NULL);
err=TheFs.SetSessionPath(_L("\\F32-TST\\TFMAN\\dest\\"));
- test(err == KErrNone);
+ test_KErrNone(err);
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source"), _L(""), CFileMan::ERecurse);
- test(err == KErrNone);
+ test_KErrNone(err);
Compare(_L("\\F32-TST\\TFMAN\\compare\\*"), _L("\\F32-TST\\TFMAN\\dest\\source\\*"));
RmDir(_L("\\F32-TST\\TFMAN\\dest\\"));
RmDir(_L("\\F32-TST\\TFMAN\\source\\"));
SetupDirectories(ETrue, NULL);
err=TheFs.SetSessionPath(_L("\\F32-TST\\TFMAN\\source\\"));
- test(err == KErrNone);
+ test_KErrNone(err);
err = gFileMan->Move(_L(""), _L("\\F32-TST\\TFMAN\\dest\\"), CFileMan::ERecurse);
- test(err == KErrNone);
+ test_KErrNone(err);
Compare(_L("\\F32-TST\\TFMAN\\compare\\*"), _L("\\F32-TST\\TFMAN\\dest\\*"));
err=TheFs.SetSessionPath(sessionPath);
- test(err==KErrNone);
+ test_KErrNone(err);
//---------------------------------------------
//! @SYMTestCaseID PBASE-T_FMAN-0520
@@ -2813,14 +2833,14 @@
SetupDirectories(EFalse, &destOtherDrive);
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source\\"), destOtherDrive, CFileMan::ERecurse);
- test(err == KErrNotFound); // Expected - directory is empty
+ test_Equal(KErrNotFound, err); // Expected - directory is empty
// Test that all directories are still present
TEntry entry;
err = TheFs.Entry(_L("\\F32-TST\\TFMAN\\source\\"), entry);
- test(err == KErrNone);
+ test_KErrNone(err);
err = TheFs.Entry(destOtherDrive, entry);
- test(err == KErrNone);
+ test_KErrNone(err);
//---------------------------------------------
//! @SYMTestCaseID PBASE-T_FMAN-0571
@@ -2863,7 +2883,7 @@
SetupDirectories(ETrue, &destOtherDrive);
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source\\"), destOtherDrive, CFileMan::ERecurse | CFileMan::EOverWrite);
- test(err == KErrNone);
+ test_KErrNone(err);
destOtherDrive.Append(_L("*"));
Compare(_L("\\F32-TST\\TFMAN\\compare\\*"), destOtherDrive);
@@ -2885,7 +2905,7 @@
RmDir(destOtherDrive);
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source\\"), destOtherDrive, CFileMan::ERecurse);
- test(err == KErrNone);
+ test_KErrNone(err);
Compare(_L("\\F32-TST\\TFMAN\\compare\\*"), destOtherDrive);
@@ -2894,7 +2914,7 @@
RmDir(destOtherDrive);
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source"), destOtherDrive, CFileMan::ERecurse);
- test(err == KErrNone);
+ test_KErrNone(err);
MakeDir(_L("\\F32-TST\\TFMAN\\compare\\subdir\\"));
destOtherDrive.Append(_L("source\\"));
@@ -2906,7 +2926,7 @@
RmDir(destOtherDrive);
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source\\File1.TXT"), destOtherDrive, CFileMan::ERecurse);
- test(err == KErrNone);
+ test_KErrNone(err);
CheckFileExists(_L("\\F32-TST\\TFMAN\\source\\File1.TXT"), KErrNotFound, ETrue);
destOtherDrive.Append(_L("File1.TXT"));
@@ -2926,11 +2946,11 @@
for(level=0; level < KNumFiles; level++)
{
err = TheFs.MkDirAll(complexFile[level]);
- test(err == KErrNone || err == KErrAlreadyExists);
+ test_Value(err, err == KErrNone || err == KErrAlreadyExists);
RFile file;
err = file.Create(TheFs, complexFile[level], EFileRead | EFileWrite);
- test(err == KErrNone || err == KErrAlreadyExists || err == KErrBadName);
+ test_Value(err, err == KErrNone || err == KErrAlreadyExists || err == KErrBadName);
file.Close();
}
@@ -2942,16 +2962,16 @@
//
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\complex\\dir1"), _L("\\F32-TST\\TFMAN\\complex\\dir12\\"), CFileMan::ERecurse);
- test(err == KErrAlreadyExists);
+ test_Equal(KErrAlreadyExists, err);
for(level=0; level < KNumFilesResult1; level++)
{
err = TheFs.MkDirAll(complexResult1[level]);
- test(err == KErrNone || err == KErrAlreadyExists);
+ test_Value(err, err == KErrNone || err == KErrAlreadyExists);
RFile file;
err = file.Create(TheFs, complexResult1[level], EFileRead | EFileWrite);
- test(err == KErrNone || err == KErrAlreadyExists || err == KErrBadName);
+ test_Value(err, err == KErrNone || err == KErrAlreadyExists || err == KErrBadName);
file.Close();
}
@@ -2961,16 +2981,16 @@
// Move directory 'dir1' into 'dir12' *with* overwrite flag set
//
err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\complex\\dir1"), _L("\\F32-TST\\TFMAN\\complex\\dir12\\"), CFileMan::ERecurse | CFileMan::EOverWrite);
- test(err == KErrNone);
+ test_KErrNone(err);
for(level=0; level < KNumFilesResult2; level++)
{
err = TheFs.MkDirAll(complexResult2[level]);
- test(err == KErrNone || err == KErrAlreadyExists);
+ test_Value(err, err == KErrNone || err == KErrAlreadyExists);
RFile file;
err = file.Create(TheFs, complexResult2[level], EFileRead | EFileWrite);
- test(err == KErrNone || err == KErrAlreadyExists || err == KErrBadName);
+ test_Value(err, err == KErrNone || err == KErrAlreadyExists || err == KErrBadName);
file.Close();
}
@@ -3107,7 +3127,7 @@
TInt lastError=iFileMan->GetLastError();
if (lastError!=KErrNone)
{
- test(lastError==KErrAlreadyExists);
+ test_Equal(KErrAlreadyExists, lastError);
if (gAsynch==EFalse)
{
TFileName fileName=iFileMan->CurrentEntry().iName;
@@ -3139,40 +3159,40 @@
if (!gAsynch)
{
TInt r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\OVERWRITE\\SRC"),_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG"),0);
- test(r==KErrAlreadyExists);
+ test_Equal(KErrAlreadyExists, r);
}
else
{
TInt r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\OVERWRITE\\SRC"),_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG"),0,gStat);
- test(r==KErrNone);
+ test_KErrNone(r);
WaitForResult(KErrAlreadyExists);
}
RFile f;
TInt r=f.Open(TheFs,_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG\\FILE1.TXT"),EFileRead);
- test(r==KErrNone);
+ test_KErrNone(r);
TBuf8<128> data;
r=f.Read(data);
- test(r==KErrNone);
- test(data.Length()==0);
+ test_KErrNone(r);
+ test_Equal(0, data.Length());
f.Close();
if (!gAsynch)
{
TInt r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\OVERWRITE\\SRC"),_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG"),CFileMan::EOverWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
}
else
{
TInt r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\OVERWRITE\\SRC"),_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG"),CFileMan::EOverWrite,gStat);
- test(r==KErrNone);
+ test_KErrNone(r);
WaitForSuccess();
}
r=f.Open(TheFs,_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG\\FILE1.TXT"),EFileRead);
- test(r==KErrNone);
+ test_KErrNone(r);
r=f.Read(data);
- test(r==KErrNone);
+ test_KErrNone(r);
test(data==contentsFile1);
f.Close();
@@ -3183,38 +3203,38 @@
if (!gAsynch)
{
TInt r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\OVERWRITE\\SRC\\*"),_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG\\*"),0);
- test(r==KErrAlreadyExists);
+ test_Equal(KErrAlreadyExists, r);
}
else
{
TInt r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\OVERWRITE\\SRC\\*"),_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG\\*"),0,gStat);
- test(r==KErrNone);
+ test_KErrNone(r);
WaitForResult(KErrAlreadyExists);
}
r=f.Open(TheFs,_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG\\FILE2.TXT"),EFileRead);
- test(r==KErrNone);
+ test_KErrNone(r);
r=f.Read(data);
- test(r==KErrNone);
- test(data.Length()==0);
+ test_KErrNone(r);
+ test_Equal(0, data.Length());
f.Close();
if (!gAsynch)
{
TInt r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\OVERWRITE\\SRC\\*"),_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG\\*"),CFileMan::EOverWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
}
else
{
TInt r=gFileMan->Rename(_L("\\F32-TST\\TFMAN\\OVERWRITE\\SRC\\*"),_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG\\*"),CFileMan::EOverWrite,gStat);
- test(r==KErrNone);
+ test_KErrNone(r);
WaitForSuccess();
}
r=f.Open(TheFs,_L("\\F32-TST\\TFMAN\\OVERWRITE\\TRG\\FILE2.TXT"),EFileRead);
- test(r==KErrNone);
+ test_KErrNone(r);
r=f.Read(data);
- test(r==KErrNone);
+ test_KErrNone(r);
test(data==contentsFile2);
f.Close();
gFileMan->SetObserver(gObserver);
@@ -3230,12 +3250,12 @@
if (!gAsynch)
{
TInt r=gFileMan->Delete(_L("\\F32-TST\\TFMAN\\BADPATH\\*"));
- test(r==KErrPathNotFound);
+ test_Equal(KErrPathNotFound, r);
}
else
{
TInt r=gFileMan->Delete(_L("\\F32-TST\\TFMAN\\BADPATH\\*"),0,gStat);
- test(r==KErrNone);
+ test_KErrNone(r);
WaitForResult(KErrPathNotFound);
}
@@ -3252,7 +3272,7 @@
TBuf<16> bad(KBad);
bad[0] = TUint16('A'+drvNum);
TInt r=fMan->Delete(bad);
- test(r==KErrNotReady);
+ test_Equal(KErrNotReady, r);
break;
}
}
@@ -3266,28 +3286,28 @@
r=gFileMan->Copy(_L("\\ONE\\TWO\\*"),_L("\\ONE\\TWO\\THREE\\"),CFileMan::ERecurse);
else
r=gFileMan->Copy(_L("\\ONE\\TWO\\*"),_L("\\ONE\\TWO\\THREE\\"),CFileMan::ERecurse,gStat);
- test(r==KErrArgument);
+ test_Equal(KErrArgument, r);
test.Next(_L("Test src name == trg name"));
if (!gAsynch)
{
r=gFileMan->Copy(_L("\\ONE\\TWO\\FOUR"),_L("\\ONE\\TWO\\FOUR")); // default aSwitch=EOverWrite
- test(r==KErrNone);
+ test_KErrNone(r);
r=gFileMan->Copy(_L("\\ONE\\TWO\\FOUR"),_L("\\ONE\\TWO\\FOUR"), 0);
- test(r==KErrAlreadyExists);
+ test_Equal(KErrAlreadyExists, r);
r=gFileMan->Copy(_L("\\ONE\\TWO\\FOUR"),_L("\\ONE\\TWO\\FOUR"),CFileMan::ERecurse);
- test(r==KErrAlreadyExists);
+ test_Equal(KErrAlreadyExists, r);
r=gFileMan->Copy(_L("\\ONE\\TWO\\F*R"),_L("\\ONE\\TWO\\FOUR"),CFileMan::ERecurse);
- test(r==KErrAlreadyExists);
+ test_Equal(KErrAlreadyExists, r);
}
else
{
r=gFileMan->Copy(_L("\\ONE\\TWO\\*.TXT"),_L("\\ONE\\TWO\\*.TXT"),0,gStat);
- test(r==KErrNone);
+ test_KErrNone(r);
WaitForResult(KErrAlreadyExists);
r=gFileMan->Copy(_L("\\ONE\\TWO\\FOUR"),_L("\\ONE\\TWO\\F*R"),CFileMan::ERecurse,gStat);
- test(r==KErrNone);
- WaitForResult(KErrNone);
+ test_KErrNone(r);
+ WaitForResult(KErrNone);
}
RmDir(_L("\\ONE\\"));
@@ -3295,17 +3315,17 @@
if (!gAsynch)
{
r=gFileMan->Copy(_L("\\ONE\\TWO\\XXXYYY"),_L("\\ONE\\TWO\\asdfsadf"));
- test(r==KErrPathNotFound);
+ test_Equal(KErrPathNotFound, r);
r=gFileMan->Copy(_L("\\ONE\\TWO\\XXXYYY"),_L("\\ONE\\TWO\\asdfsadf"),CFileMan::ERecurse);
- test(r==KErrPathNotFound);
+ test_Equal(KErrPathNotFound, r);
}
else
{
r=gFileMan->Copy(_L("\\ONE\\TWO\\*.TXT"),_L("\\ONE\\TWO\\*.YYY"),0,gStat);
- test(r==KErrNone);
+ test_KErrNone(r);
WaitForResult(KErrPathNotFound);
r=gFileMan->Copy(_L("\\ONE\\TWO\\XXXYYY"),_L("\\ONE\\TWO\\asdfsadf"),CFileMan::ERecurse,gStat);
- test(r==KErrNone);
+ test_KErrNone(r);
WaitForResult(KErrPathNotFound);
}
@@ -3313,17 +3333,17 @@
if (!gAsynch)
{
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\*.LPQ"),_L("\\ONE\\TWO\\*.YYY"));
- test(r==KErrNotFound);
+ test_Equal(KErrNotFound, r);
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\XXXYYY"),_L("\\ONE\\TWO\\asdfsadf"),CFileMan::ERecurse);
- test(r==KErrNotFound);
+ test_Equal(KErrNotFound, r);
}
else
{
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\XXXYYY"),_L("\\ONE\\TWO\\asdfsadf"),0,gStat);
- test(r==KErrNone);
+ test_KErrNone(r);
WaitForResult(KErrNotFound);
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\XXXYYY"),_L("\\ONE\\TWO\\asdfsadf"),CFileMan::ERecurse,gStat);
- test(r==KErrNone);
+ test_KErrNone(r);
WaitForResult(KErrNotFound);
}
@@ -3335,27 +3355,27 @@
if (!gAsynch)
{
r=gFileMan->Copy(_L("\\EMPTYSRC\\"),_L("\\EMPTYTRG\\"));
- test(r==KErrNotFound);
+ test_Equal(KErrNotFound, r);
r=gFileMan->Copy(_L("\\EMPTYSRC\\"),_L("\\EMPTYTRG\\"), CFileMan::ERecurse);
- test(r==KErrNotFound);
+ test_Equal(KErrNotFound, r);
r=gFileMan->Copy(_L("\\EMPTYSRC"),_L("\\EMPTYTRG\\"));
- test(r==KErrNotFound);
+ test_Equal(KErrNotFound, r);
r=gFileMan->Copy(_L("\\EMPTYSRC"),_L("\\EMPTYTRG\\"), CFileMan::ERecurse);
- test(r==KErrNotFound);
+ test_Equal(KErrNotFound, r);
}
else
{
r=gFileMan->Copy(_L("\\EMPTYSRC\\"),_L("\\EMPTYTRG\\"), 0, gStat);
- test(r==KErrNone);
+ test_KErrNone(r);
WaitForResult(KErrNotFound);
r=gFileMan->Copy(_L("\\EMPTYSRC\\"),_L("\\EMPTYTRG\\"), CFileMan::ERecurse, gStat);
- test(r==KErrNone);
+ test_KErrNone(r);
WaitForResult(KErrNotFound);
r=gFileMan->Copy(_L("\\EMPTYSRC"),_L("\\EMPTYTRG\\"), 0, gStat);
- test(r==KErrNone);
+ test_KErrNone(r);
WaitForResult(KErrNotFound);
r=gFileMan->Copy(_L("\\EMPTYSRC"),_L("\\EMPTYTRG\\"), CFileMan::ERecurse, gStat);
- test(r==KErrNone);
+ test_KErrNone(r);
WaitForResult(KErrNotFound);
}
RmDir(_L("\\EMPTYSRC\\"));
@@ -3365,48 +3385,48 @@
MakeFile(_L("Dummyfile"));
test.Next(_L("Test illegal names"));
r=gFileMan->Attribs(_L(":C:"),0,0,TTime(0),0);
- test(r==KErrBadName);
+ test_Equal(KErrBadName, r);
r=gFileMan->Copy(_L(":C:"),_L("newname"),0);
- test(r==KErrBadName);
+ test_Equal(KErrBadName, r);
r=gFileMan->Copy(_L("Dummyfile"),_L(":C:"),0);
- test(r==KErrBadName);
+ test_Equal(KErrBadName, r);
r=gFileMan->Delete(_L(":C:"),0);
- test(r==KErrBadName);
+ test_Equal(KErrBadName, r);
r=gFileMan->Move(_L(":C:"),_L("newname"),0);
- test(r==KErrBadName);
+ test_Equal(KErrBadName, r);
r=gFileMan->Move(_L("dummyFile"),_L(":C:"),0);
- test(r==KErrBadName);
+ test_Equal(KErrBadName, r);
r=gFileMan->Rename(_L(":C:"),_L("newname"),0);
- test(r==KErrBadName);
+ test_Equal(KErrBadName, r);
r=gFileMan->Rename(_L("DummyFile"),_L(":C:"),0);
- test(r==KErrBadName);
+ test_Equal(KErrBadName, r);
r=gFileMan->RmDir(_L("\\:C:\\"));
- test(r==KErrBadName);
+ test_Equal(KErrBadName, r);
r=gFileMan->Attribs(_L("::C:"),0,0,TTime(0),0);
- test(r==KErrBadName);
+ test_Equal(KErrBadName, r);
r=gFileMan->Copy(_L("::C:"),_L("newname"),0);
- test(r==KErrBadName);
+ test_Equal(KErrBadName, r);
r=gFileMan->Copy(_L("Dummyfile"),_L("::C:"),0);
- test(r==KErrBadName);
+ test_Equal(KErrBadName, r);
r=gFileMan->Delete(_L("::C:"),0);
- test(r==KErrBadName);
+ test_Equal(KErrBadName, r);
r=gFileMan->Move(_L("::C:"),_L("newname"),0);
- test(r==KErrBadName);
+ test_Equal(KErrBadName, r);
r=gFileMan->Move(_L("dummyFile"),_L("::C:"),0);
- test(r==KErrBadName);
+ test_Equal(KErrBadName, r);
r=gFileMan->Rename(_L("::C:"),_L("newname"),0);
- test(r==KErrBadName);
+ test_Equal(KErrBadName, r);
r=gFileMan->Rename(_L("DummyFile"),_L("::C:"),0);
- test(r==KErrBadName);
+ test_Equal(KErrBadName, r);
r=gFileMan->RmDir(_L("::C:"));
- test(r==KErrBadName);
+ test_Equal(KErrBadName, r);
r=TheFs.Delete(_L("DummyFile"));
- test(r==KErrNone);
+ test_KErrNone(r);
// test copying two files with identical names that do not exist
_LIT(KNonExistent,"\\azzzz.txt");
r=gFileMan->Copy(KNonExistent,KNonExistent,0);
- test(r==KErrNotFound);
+ test_Equal(KErrNotFound, r);
}
LOCAL_C void TestNameMangling()
@@ -3427,10 +3447,10 @@
MakeFile(_L("\\F32-TST\\TFMAN\\NAMEMANGLER\\SRC\\zyx.abcdefghijk.defgh"));
TInt r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\NAMEMANGLER\\SRC\\*.*"),_L("\\F32-TST\\TFMAN\\NAMEMANGLER\\TRG\\*.*"));
- test(r==KErrNone);
+ test_KErrNone(r);
Compare(_L("\\F32-TST\\TFMAN\\NAMEMANGLER\\SRC\\*"),_L("\\F32-TST\\TFMAN\\NAMEMANGLER\\TRG\\*"));
r=gFileMan->Delete(_L("\\F32-TST\\TFMAN\\NAMEMANGLER\\TRG\\*.*"));
- test(r==KErrNone);
+ test_KErrNone(r);
}
LOCAL_C void TestLongNames()
@@ -3460,7 +3480,7 @@
longRootDirNameA+=longFileNameA;
longRootDirNameA+=_L("\\");
TInt r=TheFs.MkDir(longRootDirNameA);
- test(r==KErrNone || r==KErrAlreadyExists);
+ test_Value(r, r==KErrNone || r==KErrAlreadyExists);
// Second folder
TFileName longFileNameB;
longFileNameB.SetLength(longFileLength);
@@ -3469,7 +3489,7 @@
longRootDirNameB+=longFileNameB;
longRootDirNameB+=_L("\\");
r=TheFs.MkDir(longRootDirNameB);
- test(r==KErrNone || r==KErrAlreadyExists);
+ test_Value(r, r==KErrNone || r==KErrAlreadyExists);
TInt longFilePtrLength = KMaxFileName-3; // We do not want the trailing backslash
TPtrC ptrLongFileA(longRootDirNameA.Ptr(),longFilePtrLength);
@@ -3480,42 +3500,42 @@
// This test will return KErrGeneral because the new path will exceed the maximum length
// See KMaxFileName
r=gFileMan->Move(ptrLongFileA,ptrLongFileB);
- test(r==KErrGeneral);
+ test_Equal(KErrGeneral, r);
r=gFileMan->RmDir(longRootDirNameA);
- test(r==KErrNone);
+ test_KErrNone(r);
r=gFileMan->Rename(ptrLongFileB,ptrLongFileA);
- test(r==KErrNone);
+ test_KErrNone(r);
r=gFileMan->RmDir(longRootDirNameB);
- test(r==KErrPathNotFound);
+ test_Equal(KErrPathNotFound, r);
r=gFileMan->RmDir(longRootDirNameA);
- test(r==KErrNone);
+ test_KErrNone(r);
TFileName longSubDirName=_L("\\Files\\");
TPtrC longSubDirFileName(longFileNameA.Ptr(),longFilePtrLength-longSubDirName.Length());
longSubDirName+=longSubDirFileName;
longSubDirName+=_L("\\");
r=TheFs.MkDirAll(longSubDirName);
- test(r==KErrNone);
+ test_KErrNone(r);
CDir* dirList;
r=TheFs.GetDir(longSubDirName,KEntryAttMaskSupported,0,dirList);
- test(r==KErrNone);
- test(dirList->Count()==0);
+ test_KErrNone(r);
+ test_Equal(0, dirList->Count());
delete dirList;
TPtrC ptrLongSubDirSrc(longSubDirName.Ptr(),longSubDirName.Length()-1);
TPtrC ptrLongSubDirTrg(longRootDirNameA.Ptr(),longRootDirNameA.Length()-1);
r=gFileMan->Copy(ptrLongSubDirSrc,ptrLongSubDirTrg);
- test(r==KErrNone);
+ test_KErrNone(r);
r=TheFs.MkDir(longRootDirNameB);
- test(r==KErrNone);
+ test_KErrNone(r);
r=gFileMan->Move(ptrLongSubDirSrc,longRootDirNameB);
- test(r==KErrBadName);
+ test_Equal(KErrBadName, r);
r=TheFs.RmDir(longRootDirNameB);
- test(r==KErrNone);
- test(TheFs.RmDir(longSubDirName) == KErrNone);
- test(TheFs.RmDir(_L("\\Files\\")) == KErrNone);
+ test_KErrNone(r);
+ test_KErrNone(TheFs.RmDir(longSubDirName));
+ test_KErrNone(TheFs.RmDir(_L("\\Files\\")));
gFileMan->SetObserver(gObserver);
}
@@ -3533,14 +3553,14 @@
MakeFile(_L("\\F32-TST\\TFMAN\\FILEATT\\SRC\\systemarchive.def"),KEntryAttArchive|KEntryAttSystem);
TInt r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\FILEATT\\SRC\\*.*"),_L("\\F32-TST\\TFMAN\\FILEATT\\TRG\\*.*"));
- test(r==KErrNone);
+ test_KErrNone(r);
Compare(_L("\\F32-TST\\TFMAN\\FILEATT\\SRC\\*.*"),_L("\\F32-TST\\TFMAN\\FILEATT\\TRG\\*"));
r=gFileMan->Attribs(_L("\\F32-TST\\TFMAN\\FILEATT\\SRC\\*"),0,KEntryAttReadOnly,TTime(0));
- test(r==KErrNone);
+ test_KErrNone(r);
r=gFileMan->Attribs(_L("\\F32-TST\\TFMAN\\FILEATT\\TRG\\*"),0,KEntryAttReadOnly,TTime(0));
- test(r==KErrNone);
+ test_KErrNone(r);
r=gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\FILEATT\\"));
- test(r==KErrNone);
+ test_KErrNone(r);
}
class CFileManObserverContinue : public CBase, public MFileManObserver
@@ -3589,30 +3609,30 @@
MakeFile(_L("\\F32-TST\\TFMAN\\FILECOPY\\asdf.asdf"),bufPtr);
RFile f;
TInt r=f.Open(TheFs,_L("\\F32-TST\\TFMAN\\FILECOPY\\asdf.asdf"),EFileRead|EFileShareReadersOnly);
- test(r==KErrNone);
+ test_KErrNone(r);
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\FILECOPY\\asdf.asdf"),_L("\\F32-TST\\TFMAN\\FILECOPY\\xxxx.xxxx"));
- test(r==KErrNone);
+ test_KErrNone(r);
f.Close();
r=f.Open(TheFs,_L("\\F32-TST\\TFMAN\\FILECOPY\\xxxx.xxxx"),EFileRead);
- test(r==KErrNone);
+ test_KErrNone(r);
TBuf8<256*sizeof(TText)> temp;
r=f.Read(temp);
- test(r==KErrNone);
+ test_KErrNone(r);
test(temp==bufPtr);
r=f.Read(temp);
- test(r==KErrNone);
- test(temp.Length()==0);
+ test_KErrNone(r);
+ test_Equal(0, temp.Length());
f.Close();
r=f.Open(TheFs,_L("\\F32-TST\\TFMAN\\FILECOPY\\asdf.asdf"),EFileRead);
- test(r==KErrNone);
+ test_KErrNone(r);
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\FILECOPY\\asdf.asdf"),_L("\\F32-TST\\TFMAN\\FILECOPY\\xxxx.xxxx"));
- test(r==KErrInUse);
+ test_Equal(KErrInUse, r);
f.Close();
gFileMan->SetObserver(gObserver);
r=gFileMan->RmDir(_L("\\F32-TST\\TFMAN\\FILECOPY\\"));
- test(r==KErrNone);
+ test_KErrNone(r);
delete fManObserver;
}
@@ -3651,41 +3671,41 @@
// Move directory containing files and subdirs with different attributes
r = gFileMan->Move(source, KDest, 0);
- test(r==KErrNone);
+ test_KErrNone(r);
// Check that the files and subdirs have moved and have the correct attributes
TEntry entry;
src = KDest;
src.Append(_L("file1"));
r = TheFs.Entry(src, entry);
- test(r == KErrNone);
+ test_KErrNone(r);
test(entry.iAtt&KEntryAttReadOnly);
src = KDest;
src.Append(_L("file2"));
r = TheFs.Entry(src, entry);
- test(r == KErrNone);
+ test_KErrNone(r);
test(entry.iAtt&KEntryAttHidden);
src = KDest;
src.Append(_L("file3"));
r = TheFs.Entry(src, entry);
- test(r == KErrNone);
+ test_KErrNone(r);
test(entry.iAtt&KEntryAttSystem);
src = source;
src.Append(_L("subdir1\\"));
r = gFileMan->Move(src, source, 0);
- test(r == KErrNone);
+ test_KErrNone(r);
r = TheFs.RmDir(src);
- test(r==KErrNone);
+ test_KErrNone(r);
src = source;
src.Append(_L("file4"));
r = TheFs.Delete(src);
- test(r==KErrNone);
+ test_KErrNone(r);
r = TheFs.RmDir(source);
- test(r==KErrNone);
+ test_KErrNone(r);
RmDir(KDest);
}
@@ -3739,7 +3759,7 @@
CheckFileExists(trgDirFile,KErrNone);
RmDir(trgDir);
- test(TheFs.Delete(trgFile) == KErrNone);
+ test_KErrNone(TheFs.Delete(trgFile));
TestINC101844(); // Test move files and subdirs with different attributes
}
@@ -3782,15 +3802,15 @@
//
{
TInt lastError = iFileMan->GetLastError();
- test(lastError == KErrNone);
+ test_KErrNone(lastError);
TFileName srcfile;
iFileMan->GetCurrentSource(srcfile);
TInt action = iFileMan->CurrentAction();
- test(action == CFileMan::EMove ||
- action == CFileMan::EDelete ||
- action == CFileMan::ERmDir);
+ test_Value(action, action == CFileMan::EMove ||
+ action == CFileMan::EDelete ||
+ action == CFileMan::ERmDir);
iCurrentStep--;
return(iCurrentStep ? MFileManObserver::EContinue : MFileManObserver::EAbort);
@@ -3927,30 +3947,30 @@
MakeFile(_L("\\F32-TST\\TFMAN\\CPMV\\TWO.BAD"));
TInt r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\TWO.*"), _L("\\F32-TST\\TFMAN\\THREE.*"), CFileMan::ERecurse);
- test(r==KErrNone);
+ test_KErrNone(r);
CheckFileExists(_L("\\F32-TST\\TFMAN\\CPMV\\THREE.TXT"), KErrNone);
CheckFileExists(_L("\\F32-TST\\TFMAN\\CPMV\\THREE.GOD"), KErrNone);
CheckFileExists(_L("\\F32-TST\\TFMAN\\CPMV\\THREE.BAD"), KErrNone);
r=gFileMan->Delete(_L("\\F32-TST\\TFMAN\\CPMV\\THREE.*"));
- test(r==KErrNone);
+ test_KErrNone(r);
MakeFile(_L("\\F32-TST\\TFMAN\\CPMV\\TWO2\\TWO__1.TXT"));
MakeFile(_L("\\F32-TST\\TFMAN\\CPMV\\TWO2\\TWO__2.TXT"));
// copy and rename dir
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\CPMV\\TWO2"), _L("\\F32-TST\\TFMAN\\CPMV\\THREE"), CFileMan::ERecurse);
- test(r==KErrNone);
+ test_KErrNone(r);
Compare(_L("\\F32-TST\\TFMAN\\CPMV\\TWO2\\*"), _L("\\F32-TST\\TFMAN\\CPMV\\THREE\\*"));
// copy and move into another dir
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\CPMV\\TWO2"), _L("\\F32-TST\\TFMAN\\CPMV\\THREE\\TWO"), CFileMan::ERecurse);
- test(r==KErrNone);
+ test_KErrNone(r);
Compare(_L("\\F32-TST\\TFMAN\\CPMV\\TWO2\\*"), _L("\\F32-TST\\TFMAN\\CPMV\\THREE\\TWO\\*"));
// copy and rename files and dirs in current dir
r=gFileMan->Copy(_L("\\F32-TST\\TFMAN\\CPMV\\TWO*"), _L("\\F32-TST\\TFMAN\\CPMV\\THREE*"), CFileMan::ERecurse);
- test(r==KErrNone);
+ test_KErrNone(r);
// Compare(_L("\\F32-TST\\TFMAN\\CPMV\\TWO2\\*"), _L("\\F32-TST\\TFMAN\\CPMV\\THREE2\\*"));
CheckFileExists(_L("\\F32-TST\\TFMAN\\CPMV\\ONE\\THREEO.TWO"), KErrNone);
@@ -4002,33 +4022,33 @@
gFileMan->SetObserver(NULL);
// Attribs
r = gFileMan->Attribs(KDir, 0, 0, 0, CFileMan::ERecurse);
- test(r==KErrNone);
+ test_KErrNone(r);
// Move
r = gFileMan->Move(KFile1, KFile2, CFileMan::ERecurse);
- test(r==KErrAlreadyExists);
+ test_Equal(KErrAlreadyExists, r);
r = gFileMan->Move(KFile1, KFile2, CFileMan::ERecurse | CFileMan::EOverWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
// Copy
r = gFileMan->Copy(KFile2, KFile1, CFileMan::ERecurse);
- test(r==KErrNone);
+ test_KErrNone(r);
// Rename
r = gFileMan->Rename(KFile1, KFile2, 0);
- test(r==KErrAlreadyExists);
+ test_Equal(KErrAlreadyExists, r);
r = gFileMan->Rename(KFile1, KFile2, CFileMan::EOverWrite);
- test(r==KErrNone);
+ test_KErrNone(r);
// Delete
r = gFileMan->Delete(KFile2, CFileMan::ERecurse);
- test(r==KErrNone);
+ test_KErrNone(r);
// RmDir
r = gFileMan->RmDir(KDir);
- test(r==KErrNone);
+ test_KErrNone(r);
gFileMan->SetObserver(gObserver);
}
@@ -4158,11 +4178,11 @@
// Verify src contents after move operation
CDir *dir = NULL;
err = TheFs.GetDir(srcPath, KEntryAttMaskSupported, ESortNone, dir);
- test(6 == dir->Count());
+ test_Equal(6, dir->Count());
delete dir;
// Verify dest contents after move operation
err = TheFs.GetDir(trgPath, KEntryAttMaskSupported, ESortNone, dir);
- test(3 == dir->Count());
+ test_Equal(3, dir->Count());
delete dir;
// Recursive move with "\\" at the end of srcPath
@@ -4179,11 +4199,11 @@
// Verify src has no content
err = TheFs.GetDir(srcPath, KEntryAttMaskSupported, ESortNone, dir);
- test(0 == dir->Count());
+ test_Equal(0, dir->Count());
delete dir;
// Verify dest contents after move operation
err = TheFs.GetDir(trgPath, KEntryAttMaskSupported, ESortNone, dir);
- test(9 == dir->Count());
+ test_Equal(9, dir->Count());
delete dir;
// Recursive move without "\\" at the end of srcPath
@@ -4204,10 +4224,10 @@
srcPath.Append(KPathDelimiter);
// Verify src doesnt not exist
err = gFileMan->RmDir(srcPath);
- test(err==KErrPathNotFound); // KErrPathNotFound expected as src has been moved to dest
+ test_Equal(KErrPathNotFound, err); // KErrPathNotFound expected as src has been moved to dest
// Verify dest after move operation
err = TheFs.GetDir(trgPath, KEntryAttMaskSupported, ESortNone, dir);
- test(1 == dir->Count());
+ test_Equal(1, dir->Count());
delete dir;
// clean up before leaving
@@ -4310,7 +4330,7 @@
TheFs.SetAllocFailure(gAllocFailOff);
TInt uid;
- test(HAL::Get(HAL::EMachineUid,uid)==KErrNone);
+ test_KErrNone(HAL::Get(HAL::EMachineUid,uid));
TBool doTargetTests = (!IsTestingLFFS() &&
uid!=HAL::EMachineUid_Cogent &&
uid!=HAL::EMachineUid_IQ80310 &&
@@ -4384,12 +4404,12 @@
#ifndef __WINS__
RThread t;
TThreadStackInfo stack;
- test(t.StackInfo(stack)==KErrNone);
+ test_KErrNone(t.StackInfo(stack));
TestStackUsage(0, stack);
#endif
Cleanup();
DeleteTestDirectory();
- test(TheFs.RmDir(_L("\\F32-TST\\")) == KErrNone);
+ test_KErrNone(TheFs.RmDir(_L("\\F32-TST\\")));
}
--- a/kerneltest/f32test/server/t_locate.cpp Sat Feb 20 00:10:51 2010 +0200
+++ b/kerneltest/f32test/server/t_locate.cpp Fri Mar 12 15:50:11 2010 +0200
@@ -541,24 +541,29 @@
entry=(*dir)[0];
test(entry.iName.MatchF(_L("FILE.AAA"))!=KErrNotFound);
delete dir;
+
r=finder.FindWildByPath(_L("*FILE.AAA"), &gPath1, dir);
test(r==KErrNone);
test(dir->Count()==1);
entry=(*dir)[0];
test(entry.iName.MatchF(_L("FILE.AAA"))!=KErrNotFound);
delete dir;
+
r=finder.FindWildByPath(_L("FILE.AAA*"), &gPath1, dir);
test(r==KErrNone);
test(dir->Count()==1);
entry=(*dir)[0];
test(entry.iName.MatchF(_L("FILE.AAA"))!=KErrNotFound);
delete dir;
+
+
r=finder.FindWildByPath(_L("CONFUSED.DOG"), &gPath1, dir);
test(r==KErrNone);
test(dir->Count()==1);
entry=(*dir)[0];
test(entry.iName.MatchF(_L("CONFUSED.DOG"))!=KErrNotFound);
delete dir;
+
r=finder.FindWildByPath(_L("*CONFUSED.DOG"), &gPath1, dir);
test(r==KErrNone);
test(dir->Count()==1);
@@ -993,10 +998,119 @@
}
+//---------------------------------------------------------------------------------------
+/**
+ Test that callinng TFindFile methods that allocate CDir objects doesn't lead to memory leaks if some error occurs.
+*/
+void TestFailures()
+ {
+
+ test.Next(_L("Test TFindFile failures\n"));
+
+#ifndef _DEBUG
+ test.Printf(_L("This test can't be performed in UREL mode, skipping\n"));
+ return;
+#else
+
+ TFindFile finder(TheFs);
+ CDir* pDir;
+ TInt nRes;
+ TInt cnt=0;
+
+ _LIT(KPath, "\\F32-TST\\LOCTEST\\");
+
+ const TInt KMyError = -756; //-- specific error code we will simulate
+
+ //------------------------------------
+ test.Printf(_L("Test FindWildByPath failures\n"));
+
+ __UHEAP_MARK;
+ nRes = finder.FindWildByPath(_L("*"), &gPath1, pDir);
+ test(nRes == KErrNone);
+ test(pDir && pDir->Count() > 1);
+ delete pDir;
+
+
+ for(cnt = 0; ;cnt++)
+ {
+ nRes =TheFs.SetErrorCondition(KMyError, cnt);
+ test(nRes == KErrNone);
+
+ pDir = (CDir*)0xaabbccdd;
+ nRes = finder.FindWildByPath(_L("*"), &gPath1, pDir);
+
+ //-- on error the memory allocated internally for CDir shall be freed and the pointer CDir* shall be set to NULL
+ if(nRes == KErrNone)
+ {
+ test.Printf(_L("Test FindWildByPath->FindWild() failures\n"));
+ test(pDir && pDir->Count() > 1);
+ delete pDir;
+ pDir = (CDir*)0xaabbccdd;
+
+ TheFs.SetErrorCondition(KMyError);
+ nRes = finder.FindWild(pDir);
+ test(nRes != KErrNone);
+ test(pDir == NULL);
+
+ break;
+ }
+ else
+ {
+ test(pDir == NULL);
+ }
+
+ }
+
+ __UHEAP_MARKEND;
+ TheFs.SetErrorCondition(KErrNone);
+ //------------------------------------
+ test.Printf(_L("Test FindWildByDir failures\n"));
+
+ __UHEAP_MARK;
+ nRes = finder.FindWildByDir(_L("*"), KPath, pDir);
+ test(nRes == KErrNone);
+ test(pDir && pDir->Count() > 1);
+ delete pDir;
+
+ for(cnt = 0; ;cnt++)
+ {
+ nRes =TheFs.SetErrorCondition(KMyError, cnt);
+ test(nRes == KErrNone);
-GLDEF_C void CallTestsL()
+ pDir = (CDir*)0xaabbccdd;
+ nRes = finder.FindWildByDir(_L("*"), KPath, pDir);
+
+ //-- on error the memory allocated internally for CDir shall be freed and the pointer CDir* shall be set to NULL
+ if(nRes == KErrNone)
+ {
+ test.Printf(_L("Test FindWildByDir->FindWild() failures\n"));
+ test(pDir && pDir->Count() > 1);
+ delete pDir;
+ pDir = (CDir*)0xaabbccdd;
+
+ TheFs.SetErrorCondition(KMyError);
+ nRes = finder.FindWild(pDir);
+ test(nRes != KErrNone);
+ test(pDir == NULL);
+
+ break;
+ }
+ else
+ {
+ test(pDir == NULL);
+ }
+
+ }
+
+ __UHEAP_MARKEND;
+ TheFs.SetErrorCondition(KErrNone);
+#endif
+}
+
+//---------------------------------------------------------------------------------------
+void CallTestsL()
//
// Do all tests
//
@@ -1026,6 +1140,8 @@
CreateTestDirectory(_L("\\F32-TST\\LOCTEST\\"));
MakeLocateTestDirectoryStructure();
+
+ TestFailures();
Test1();
Test2();
Test3();
--- a/userlibandfileserver/fileserver/group/release.txt Sat Feb 20 00:10:51 2010 +0200
+++ b/userlibandfileserver/fileserver/group/release.txt Fri Mar 12 15:50:11 2010 +0200
@@ -1,3 +1,50 @@
+Version 2.00.2036
+=================
+(Made by vfebvre 09/02/2010)
+
+1. kaduan
+ 1. PDEF144352: Unwanted directory cache change caused performance regression
+
+2. dlyokhin
+ 1. DEF144134 potential memory leak in TFindFile::FindWildByDir()
+
+
+Version 2.00.2035
+=================
+(Made by vfebvre 05/02/2010)
+
+1. niccox
+ 1. DEF144268 Add ModeSense10 support to USB MS Client
+
+
+Version 2.00.2034
+=================
+(Made by vfebvre 03/02/2010)
+
+1. migubarr
+ 1. DEF144172: Small FAT32 partitions on large media can sometimes be formatted incorrectly
+
+
+Version 2.00.2033
+=================
+(Made by vfebvre 01/02/2010)
+
+1. jsucksmi
+ 1. DEF144003 Emulated removable drive X is not present in tb10.1(MSF00326) and tb9.2(1014)
+
+
+Version 2.00.2032
+=================
+(Made by vfebvre 28/01/2010)
+
+1. famustaf
+ 1. PDEF144033 Change tests in t_fman to use __E32TEST_EXTENSION__
+
+2. hengrant
+ 1. PDEF144090 New Memory & File Server Coverity Defects
+ 3 Coverity Fixes
+
+
Version 2.00.2031
=================
(Made by vfebvre 26/01/2010)
--- a/userlibandfileserver/fileserver/inc/f32file.h Sat Feb 20 00:10:51 2010 +0200
+++ b/userlibandfileserver/fileserver/inc/f32file.h Fri Mar 12 15:50:11 2010 +0200
@@ -3029,7 +3029,7 @@
-class TFindFile
+
/**
@publishedAll
@released
@@ -3056,6 +3056,7 @@
be searched must match.
*/
+class TFindFile
{
public:
IMPORT_C TFindFile(RFs& aFs);
@@ -3074,6 +3075,7 @@
TInt DoFindInDir();
TInt DoFindNextInPath();
TInt DoFindNextInDriveList();
+ TInt CallSafe(TInt aResult);
private:
RFs* const iFs;
TParse iFile;
--- a/userlibandfileserver/fileserver/inc/f32ver.h Sat Feb 20 00:10:51 2010 +0200
+++ b/userlibandfileserver/fileserver/inc/f32ver.h Fri Mar 12 15:50:11 2010 +0200
@@ -58,6 +58,6 @@
@see TVersion
*/
-const TInt KF32BuildVersionNumber=2031;
+const TInt KF32BuildVersionNumber=2036;
//
#endif
--- a/userlibandfileserver/fileserver/sfat/sl_fat16.cpp Sat Feb 20 00:10:51 2010 +0200
+++ b/userlibandfileserver/fileserver/sfat/sl_fat16.cpp Fri Mar 12 15:50:11 2010 +0200
@@ -82,37 +82,49 @@
iSectorsPerFat=MaxFat16Sectors();
}
- // Ensure cluster size is a multiple of the block size
- TInt blockSizeInSectors = aCaps.iBlockSize >> iSectorSizeLog2;
- __PRINT1(_L("blockSizeInSectors: %d"),blockSizeInSectors);
- ASSERT(blockSizeInSectors == 0 || IsPowerOf2(blockSizeInSectors));
- if (blockSizeInSectors != 0 && IsPowerOf2(blockSizeInSectors))
- {
- __PRINT1(_L("iSectorsPerCluster (old): %d"),iSectorsPerCluster);
- AdjustClusterSize(blockSizeInSectors);
- __PRINT1(_L("iSectorsPerCluster (new): %d"),iSectorsPerCluster);
- }
-
- // Align first data sector on an erase block boundary if
- // (1) the iEraseBlockSize is specified
- // (2) the start of the partition is already aligned to an erase block boundary,
- // i.e. iHiddenSectors is zero or a multiple of iEraseBlockSize
- __PRINT1(_L("iHiddenSectors: %d"),iHiddenSectors);
- TInt eraseblockSizeInSectors = aCaps.iEraseBlockSize >> iSectorSizeLog2;
- __PRINT1(_L("eraseblockSizeInSectors: %d"),eraseblockSizeInSectors);
- ASSERT(eraseblockSizeInSectors == 0 || IsPowerOf2(eraseblockSizeInSectors));
- ASSERT(eraseblockSizeInSectors == 0 || eraseblockSizeInSectors >= blockSizeInSectors);
- if ((eraseblockSizeInSectors != 0) &&
- (iHiddenSectors % eraseblockSizeInSectors == 0) &&
- (IsPowerOf2(eraseblockSizeInSectors)) &&
- (eraseblockSizeInSectors >= blockSizeInSectors))
- {
- TInt r = AdjustFirstDataSectorAlignment(eraseblockSizeInSectors);
- ASSERT(r == KErrNone);
- (void) r;
- }
- __PRINT1(_L("iReservedSectors: %d"),iReservedSectors);
- __PRINT1(_L("FirstDataSector: %d"), FirstDataSector());
+ const TFatType fatType = SuggestFatType();
+
+ // Ensure cluster size is a multiple of the block size
+ TInt blockSizeInSectors = aCaps.iBlockSize >> iSectorSizeLog2;
+ __PRINT1(_L("blockSizeInSectors: %d"),blockSizeInSectors);
+ ASSERT(blockSizeInSectors == 0 || IsPowerOf2(blockSizeInSectors));
+ if (blockSizeInSectors != 0 && IsPowerOf2(blockSizeInSectors))
+ {
+ __PRINT1(_L("iSectorsPerCluster (old): %d"),iSectorsPerCluster);
+ AdjustClusterSize(blockSizeInSectors);
+ __PRINT1(_L("iSectorsPerCluster (new): %d"),iSectorsPerCluster);
+ }
+
+
+ for (; iSectorsPerCluster>1; iSectorsPerCluster>>= 1)
+ {
+ // Align first data sector on an erase block boundary if
+ // (1) the iEraseBlockSize is specified
+ // (2) the start of the partition is already aligned to an erase block boundary,
+ // i.e. iHiddenSectors is zero or a multiple of iEraseBlockSize
+ __PRINT1(_L("iHiddenSectors: %d"),iHiddenSectors);
+ TInt eraseblockSizeInSectors = aCaps.iEraseBlockSize >> iSectorSizeLog2;
+ __PRINT1(_L("eraseblockSizeInSectors: %d"),eraseblockSizeInSectors);
+ ASSERT(eraseblockSizeInSectors == 0 || IsPowerOf2(eraseblockSizeInSectors));
+ ASSERT(eraseblockSizeInSectors == 0 || eraseblockSizeInSectors >= blockSizeInSectors);
+ if ((eraseblockSizeInSectors != 0) &&
+ (iHiddenSectors % eraseblockSizeInSectors == 0) &&
+ (IsPowerOf2(eraseblockSizeInSectors)) &&
+ (eraseblockSizeInSectors >= blockSizeInSectors))
+ {
+ TInt r = AdjustFirstDataSectorAlignment(eraseblockSizeInSectors);
+ ASSERT(r == KErrNone);
+ (void) r;
+ }
+ __PRINT1(_L("iReservedSectors: %d"),iReservedSectors);
+ __PRINT1(_L("FirstDataSector: %d"), FirstDataSector());
+
+ // If we've shrunk the number of clusters by so much that it's now invalid for this FAT type
+ // then we need to decrease the cluster size and try again, otherwise we're finshed.
+ if (SuggestFatType() == fatType)
+ break;
+ }
+ __PRINT1(_L("iSectorsPerCluster (final): %d"),iSectorsPerCluster);
return KErrNone;
}
@@ -124,11 +136,11 @@
}
void CFatFormatCB::AdjustClusterSize(TInt aRecommendedSectorsPerCluster)
- {
- const TInt KMaxSecPerCluster = 64; // 32K
- while (aRecommendedSectorsPerCluster > iSectorsPerCluster && iSectorsPerCluster <= (KMaxSecPerCluster/2))
- iSectorsPerCluster<<= 1;
- }
+ {
+ const TInt KMaxSecPerCluster = 64; // 32K
+ while (aRecommendedSectorsPerCluster > iSectorsPerCluster && iSectorsPerCluster <= (KMaxSecPerCluster/2))
+ iSectorsPerCluster<<= 1;
+ }
// AdjustFirstDataSectorAlignment()
// Attempts to align the first data sector on an erase block boundary by modifying the
--- a/userlibandfileserver/fileserver/sfat32/inc/sl_std.h Sat Feb 20 00:10:51 2010 +0200
+++ b/userlibandfileserver/fileserver/sfat32/inc/sl_std.h Fri Mar 12 15:50:11 2010 +0200
@@ -1073,7 +1073,7 @@
@param the length in characters of the name
@return the number of VFat entries required
*/
-TInt NumberOfVFatEntries(TInt aNameLength);
+TUint NumberOfVFatEntries(TUint aNameLength);
/**
Calculates the check sum for a standard directory entry
--- a/userlibandfileserver/fileserver/sfat32/sl_dir_cache.cpp Sat Feb 20 00:10:51 2010 +0200
+++ b/userlibandfileserver/fileserver/sfat32/sl_dir_cache.cpp Fri Mar 12 15:50:11 2010 +0200
@@ -159,7 +159,8 @@
// 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;
+ const TUint KThreadCount = 1;
+ iPermanentlyAllocatedPageCount = KThreadCount + 1;
if (iPermanentlyAllocatedPageCount > iMinSizeInPages)
iMinSizeInPages = iPermanentlyAllocatedPageCount;
@@ -679,6 +680,9 @@
{
// __PRINT1(_L("MakePageMRU (%lx)"), aPos);
// __PRINT4(_L("Current Cache State: iLockedQCount=%d, iUnlockedQCount=%d, iLookupTbl=%d, iMaxSizeInPages=%d"), iLockedQCount, iUnlockedQCount, iLookupTable.Count(), iMaxSizeInPages);
+ // check there are at least two locked pages
+ ASSERT(iLockedQCount > 1);
+
// check the MRU page first, if it is already the MRU page, we can return immediately
TInt64 pageStartMedPos = CalcPageStartPos(aPos);
if (!iLockedQ.IsEmpty())
@@ -949,46 +953,49 @@
@see CDynamicDirCache::Control()
*/
void CDynamicDirCache::Dump()
- {
- __PRINT(_L("======== CDynamicDirCache::Dump ========="));
- if (!iLockedQ.IsEmpty())
- {
- TDblQueIter<TDynamicDirCachePage> q(iLockedQ);
- q.SetToFirst();
- TInt i = 0;
- while((TDynamicDirCachePage*)q)
- {
- TDynamicDirCachePage* pP = q++;
- __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())
- {
- TDblQueIter<TDynamicDirCachePage> q(iUnlockedQ);
- q.SetToFirst();
- TInt i = 0;
- while((TDynamicDirCachePage*)q)
- {
- TDynamicDirCachePage* pP = q++;
- __PRINT5(_L("=== CDynamicDirCache::iUnlockedQ\t[%4d](pos=%lx, locked=%d, valid=%d, size=%u)"), i++, pP->StartPos(), pP->IsLocked(), pP->IsValid(), pP->PageSizeInBytes());
- }
- }
+ {
+ __PRINT(_L("======== CDynamicDirCache::Dump ========="));
+ if (!iLockedQ.IsEmpty())
+ {
+ TDblQueIter<TDynamicDirCachePage> q(iLockedQ);
+ q.SetToFirst();
+ TInt i = 0;
+ while((TDynamicDirCachePage*)q)
+ {
+ TDynamicDirCachePage* pP = q++;
+ __PRINT5(_L("=== CDynamicDirCache::iLockedQ [%4d](pos=%lx, locked=%d, valid=%d, size=%u)"), i++, pP->StartPos(), pP->IsLocked(), pP->IsValid(), pP->PageSizeInBytes());
+ }
+ }
+ __PRINT(_L("=== CDynamicDirCache:: --------------------"));
- if (iLookupTable.Count())
- {
- TInt i = 0;
- THashSetIter<TLookupEntry> iter(iLookupTable);
- TLookupEntry* pEntry;
- pEntry = (TLookupEntry*) iter.Next();
- while(pEntry)
- {
- TDynamicDirCachePage* pP = pEntry->iPage;
- __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();
- };
- }
- __PRINT(_L("===========================================\n"));
- }
+ if (!iUnlockedQ.IsEmpty())
+ {
+ TDblQueIter<TDynamicDirCachePage> q(iUnlockedQ);
+ q.SetToFirst();
+ TInt i = 0;
+ while((TDynamicDirCachePage*)q)
+ {
+ TDynamicDirCachePage* pP = q++;
+ __PRINT5(_L("=== CDynamicDirCache::iUnlockedQ [%4d](pos=%lx, locked=%d, valid=%d, size=%u)"), i++, pP->StartPos(), pP->IsLocked(), pP->IsValid(), pP->PageSizeInBytes());
+ }
+ }
+ __PRINT(_L("=== CDynamicDirCache:: --------------------"));
+
+ if (iLookupTable.Count())
+ {
+ TInt i = 0;
+ THashSetIter<TLookupEntry> iter(iLookupTable);
+ TLookupEntry* pEntry;
+ pEntry = (TLookupEntry*) iter.Next();
+ while(pEntry)
+ {
+ TDynamicDirCachePage* pP = pEntry->iPage;
+ __PRINT5(_L("=== CDynamicDirCache::iLookupTable [%4d](pos=%lx, locked=%d, valid=%d, size=%u)"), i++, pP->StartPos(), pP->IsLocked(), pP->IsValid(), pP->PageSizeInBytes());
+ pEntry = (TLookupEntry*) iter.Next();
+ };
+ }
+ __PRINT(_L("===========================================\n"));
+ }
#endif //_DEBUG
/**
--- a/userlibandfileserver/fileserver/sfat32/sl_fatmisc32.cpp Sat Feb 20 00:10:51 2010 +0200
+++ b/userlibandfileserver/fileserver/sfat32/sl_fatmisc32.cpp Fri Mar 12 15:50:11 2010 +0200
@@ -142,37 +142,49 @@
}
+ const TFatType fatType = SuggestFatType();
+
// Ensure cluster size is a multiple of the block size
TInt blockSizeInSectors = aCaps.iBlockSize >> iSectorSizeLog2;
__PRINT1(_L("blockSizeInSectors: %d"),blockSizeInSectors);
ASSERT(blockSizeInSectors == 0 || IsPowerOf2(blockSizeInSectors));
if (blockSizeInSectors != 0 && IsPowerOf2(blockSizeInSectors))
{
- __PRINT1(_L("iSectorsPerCluster (old): %d"),iSectorsPerCluster);
+ __PRINT1(_L("iSectorsPerCluster (old): %d"),iSectorsPerCluster);
AdjustClusterSize(blockSizeInSectors);
- __PRINT1(_L("iSectorsPerCluster (new): %d"),iSectorsPerCluster);
+ __PRINT1(_L("iSectorsPerCluster (new): %d"),iSectorsPerCluster);
}
- // Align first data sector on an erase block boundary if
- // (1) the iEraseBlockSize is specified
- // (2) the start of the partition is already aligned to an erase block boundary,
- // i.e. iHiddenSectors is zero or a multiple of iEraseBlockSize
- __PRINT1(_L("iHiddenSectors: %d"),iHiddenSectors);
- TInt eraseblockSizeInSectors = aCaps.iEraseBlockSize >> iSectorSizeLog2;
- __PRINT1(_L("eraseblockSizeInSectors: %d"),eraseblockSizeInSectors);
- ASSERT(eraseblockSizeInSectors == 0 || IsPowerOf2(eraseblockSizeInSectors));
- ASSERT(eraseblockSizeInSectors == 0 || eraseblockSizeInSectors >= blockSizeInSectors);
- if ((eraseblockSizeInSectors != 0) &&
- (iHiddenSectors % eraseblockSizeInSectors == 0) &&
- (IsPowerOf2(eraseblockSizeInSectors)) &&
- (eraseblockSizeInSectors >= blockSizeInSectors))
+
+ for (; iSectorsPerCluster>1; iSectorsPerCluster>>= 1)
{
- TInt r = AdjustFirstDataSectorAlignment(eraseblockSizeInSectors);
- ASSERT(r == KErrNone);
- (void) r;
+ // Align first data sector on an erase block boundary if
+ // (1) the iEraseBlockSize is specified
+ // (2) the start of the partition is already aligned to an erase block boundary,
+ // i.e. iHiddenSectors is zero or a multiple of iEraseBlockSize
+ __PRINT1(_L("iHiddenSectors: %d"),iHiddenSectors);
+ TInt eraseblockSizeInSectors = aCaps.iEraseBlockSize >> iSectorSizeLog2;
+ __PRINT1(_L("eraseblockSizeInSectors: %d"),eraseblockSizeInSectors);
+ ASSERT(eraseblockSizeInSectors == 0 || IsPowerOf2(eraseblockSizeInSectors));
+ ASSERT(eraseblockSizeInSectors == 0 || eraseblockSizeInSectors >= blockSizeInSectors);
+ if ((eraseblockSizeInSectors != 0) &&
+ (iHiddenSectors % eraseblockSizeInSectors == 0) &&
+ (IsPowerOf2(eraseblockSizeInSectors)) &&
+ (eraseblockSizeInSectors >= blockSizeInSectors))
+ {
+ TInt r = AdjustFirstDataSectorAlignment(eraseblockSizeInSectors);
+ ASSERT(r == KErrNone);
+ (void) r;
+ }
+ __PRINT1(_L("iReservedSectors: %d"),iReservedSectors);
+ __PRINT1(_L("FirstDataSector: %d"), FirstDataSector());
+
+ // If we've shrunk the number of clusters by so much that it's now invalid for this FAT type
+ // then we need to decrease the cluster size and try again, otherwise we're finshed.
+ if (SuggestFatType() == fatType)
+ break;
}
- __PRINT1(_L("iReservedSectors: %d"),iReservedSectors);
- __PRINT1(_L("FirstDataSector: %d"), FirstDataSector());
+ __PRINT1(_L("iSectorsPerCluster (final): %d"),iSectorsPerCluster);
return KErrNone;
}
--- a/userlibandfileserver/fileserver/sfat32/sl_mnt.cpp Sat Feb 20 00:10:51 2010 +0200
+++ b/userlibandfileserver/fileserver/sfat32/sl_mnt.cpp Fri Mar 12 15:50:11 2010 +0200
@@ -3040,12 +3040,17 @@
const TUint8 entryCheckSum = aDosEntry.CheckSum(); //-- check sum from the 1st VFat entry
+ TUint nameChunkOffset = KMaxVFatEntryName*(count-1);
+
while (count--)
{
- TPtr fileNamePtr(&aLongFileName[0]+KMaxVFatEntryName*count,aLongFileName.Length()-KMaxVFatEntryName*count);
+ TPtr fileNamePtr(&aLongFileName[0]+nameChunkOffset, aLongFileName.Length()-nameChunkOffset);
fileNamePtr.Copy(vBuf);
if (count==0)
break; //-- all VFat entries read, only DOS entry remained
+
+ ASSERT(nameChunkOffset >= (TUint)KMaxVFatEntryName);
+ nameChunkOffset-=KMaxVFatEntryName;
MoveToNextEntryL(aPos);
ReadDirEntryL(aPos,aDosEntry);
--- a/userlibandfileserver/fileserver/sfat32/sl_utl.cpp Sat Feb 20 00:10:51 2010 +0200
+++ b/userlibandfileserver/fileserver/sfat32/sl_utl.cpp Fri Mar 12 15:50:11 2010 +0200
@@ -117,23 +117,16 @@
return result;
}
-TInt NumberOfVFatEntries(TInt aNameLength)
-//
-// Return the number of VFat entries required to describe a filename of length aNameLength
-//
+/**
+ @param aNameLength file name length
+ @return the number of VFat entries required to describe a filename of length aNameLength
+*/
+TUint NumberOfVFatEntries(TUint aNameLength)
{
- TInt numberOfEntries=0;
- if (aNameLength%KMaxVFatEntryName)
- aNameLength++; // Include a zero terminator
-// If aNameLength is a exact multiple of KMaxVFatEntryName, don't bother
-// with a zero terminator - it just adds an unnecessary directory entry
-
- numberOfEntries=(1+(aNameLength/KMaxVFatEntryName));
-
- if (aNameLength%KMaxVFatEntryName)
- numberOfEntries++;
-
- return(numberOfEntries);
+ ASSERT(aNameLength);
+ //-- 1 compulsory DOS entry included
+ const TUint numberOfEntries=1+(aNameLength + KMaxVFatEntryName - 1) / KMaxVFatEntryName;
+ return numberOfEntries;
}
//-----------------------------------------------------------------------------
--- a/userlibandfileserver/fileserver/sfat32/sl_vfat.cpp Sat Feb 20 00:10:51 2010 +0200
+++ b/userlibandfileserver/fileserver/sfat32/sl_vfat.cpp Fri Mar 12 15:50:11 2010 +0200
@@ -573,6 +573,9 @@
*/
void TFatDirEntry::SetVFatEntry(const TDesC& aName, TUint aLen, TUint8 aCheckSum)
{
+ //-- LFN in the last entry must be padded with FFs
+ Mem::Fill(iData,sizeof(iData),0xFF);
+
//-- initialise some VFAT entry specific fields
iData[0x0B]=0x0F;
iData[0x0C]=0x00; iData[0x0D]=aCheckSum;
@@ -660,10 +663,13 @@
startPos = aPos;
TBool movedCluster = EFalse;
+ TUint nRemLen = KMaxVFatEntryName*(numEntries-1);
+
while(numEntries)
{
TFatDirEntry* pEntry = (TFatDirEntry*)(&scratchBuf[posInBuf]);
- pEntry->SetVFatEntry(aLongName, KMaxVFatEntryName*(numEntries-1), cksum); //KMaxVFatEntryName=13
+
+ pEntry->SetVFatEntry(aLongName, nRemLen, cksum);
posInBuf += KSizeOfFatDirEntry;
MoveToNextEntryL(aPos);
@@ -673,6 +679,9 @@
if(!numEntries || movedCluster)
break; //-- VFAT entryset is completed
+
+ ASSERT(nRemLen >= (TUint)KMaxVFatEntryName);
+ nRemLen -= KMaxVFatEntryName;
}
if(movedCluster)
--- a/userlibandfileserver/fileserver/sfile/sf_file_cache_defs.h Sat Feb 20 00:10:51 2010 +0200
+++ b/userlibandfileserver/fileserver/sfile/sf_file_cache_defs.h Fri Mar 12 15:50:11 2010 +0200
@@ -26,7 +26,12 @@
// Global file-cache settings
const TBool KDefaultGlobalCacheEnabled = ETrue;
+#ifdef __WINS__
+// Reduce impact on S60 emulator memory budget
+const TInt KDefaultGlobalCacheSize = ( 8*1024); // 8192 K = 8 MBytes - the maximum for all files
+#else
const TInt KDefaultGlobalCacheSize = (32*1024); // 32768 K = 32 MBytes - the maximum for all files
+#endif
// The maximum amount of locked data allowed for all files
const TInt KDefaultGlobalCacheMaxLockedSize = (1*1024); // 1 Mb maximum locked data
// Low memory threshold as a percentage of total RAM.
--- a/userlibandfileserver/fileserver/sfile/sf_memory_client.cpp Sat Feb 20 00:10:51 2010 +0200
+++ b/userlibandfileserver/fileserver/sfile/sf_memory_client.cpp Fri Mar 12 15:50:11 2010 +0200
@@ -34,7 +34,11 @@
{
const TUint32 segCnt = iTouchedRegionFlag <= iReservedRegionMarkInSegs ?
iReservedRegionMarkInSegs : iTouchedRegionFlag;
- DecommitSegments(iBase, segCnt);
+ TInt r = DecommitSegments(iBase, segCnt);
+ if (r != KErrNone) // this 'if() {}' is to remove build warnings
+ {
+ ASSERT(0);
+ }
iReusablePagePool.Close();
delete iName;
}
--- a/userlibandfileserver/fileserver/sfsrv/cl_find.cpp Sat Feb 20 00:10:51 2010 +0200
+++ b/userlibandfileserver/fileserver/sfsrv/cl_find.cpp Fri Mar 12 15:50:11 2010 +0200
@@ -20,93 +20,104 @@
#define gPathDelimiter TChar(';')
enum TMode {EFindByDrives,EFindByDrivesInPath,EFindByPath};
-TInt TFindFile::DoFindInDir()
+
//
// Look for aFileName in aDir
//
+TInt TFindFile::DoFindInDir()
{
- if (iDir==NULL)
+ if (!iDir)
{
TEntry entry;
TInt r=iFs->Entry(iFile.FullName(),entry);
- if (r==KErrNone /*|| r==KErrAccessDenied*/)
- return(KErrNone);
- else if (r==KErrNoMemory)
+
+ if (r != KErrNone && r != KErrNoMemory && r != KErrPermissionDenied)
+ r = KErrNotFound;
+
return r;
- else if (r==KErrPermissionDenied)
- return (KErrPermissionDenied);
- else
- return(KErrNotFound);
}
+
TInt r=iFs->GetDir(iFile.FullName(),KEntryAttMaskSupported|KEntryAttAllowUid,ESortByName,*iDir);
- if (r==KErrNoMemory)
- return r;
- else if (r==KErrPermissionDenied)
- return r;
- else if (r!=KErrNone)
- return(KErrNotFound);
- if ((*iDir)->Count()==0)
+
+ if(r == KErrNone)
+ {
+ if(!(*iDir)->Count())
+ r = KErrNotFound; //-- empty directory
+ }
+ else if(r != KErrNoMemory && r != KErrPermissionDenied)
+ {
+ r = KErrNotFound;
+ }
+
+ if (r != KErrNone && iDir)
{
delete (*iDir);
*iDir=NULL;
- return(KErrNotFound);
}
- else
- return(KErrNone);
+
+ return r;
}
-TInt TFindFile::DoFindNextInPath()
+
//
// Look for aFileName along the path and increment aPathPos
//
+TInt TFindFile::DoFindNextInPath()
{
if (iMode==EFindByDrivesInPath)
{
TInt r=DoFindNextInDriveList();
- if (r==KErrNone)
- return(KErrNone);
if (r!=KErrNotFound)
return(r);
+
iMode=EFindByPath;
}
+
FOREVER
{
if (iPath->Length()<iPathPos)
return(KErrNotFound);
+
TPtrC path(iPath->Ptr()+iPathPos,iPath->Length()-iPathPos);
+
TInt r=path.Locate(gPathDelimiter);
+
if (r==KErrNotFound)
r=path.Length();
+
path.Set(path.Ptr(),r);
iPathPos+=r+1;
TFileName fileName=iFile.NameAndExt();
iFile.Set(fileName,&path,NULL);
+
if (iFile.FullName().Length()>=2 && iFile.FullName()[1]==KDriveDelimiter)
{
TInt r=DoFindInDir();
- if (r==KErrNone)
- return(KErrNone);
- if (r!=KErrNotFound)
- return(r);
+ if (r == KErrNotFound)
continue;
+
+ return(r);
}
+
iMode=EFindByDrivesInPath;
r=FindByDir(fileName,path);
- if (r==KErrNone)
- return(KErrNone);
- if (r!=KErrNotFound)
+
+ if (r == KErrNotFound)
+ continue;
+
return(r);
}
}
-TInt TFindFile::DoFindNextInDriveList()
+
//
// Look for aFileName in all available drives in order
//
+TInt TFindFile::DoFindNextInDriveList()
{
TInt found;
@@ -235,9 +246,12 @@
TPtrC path(iFile.Path());
fileName.Set(nameAndExt,&path,&drive);
iFile=fileName;
+
TInt r=DoFindInDir();
+
if (r==KErrNone)
return(KErrNone);
+
if (r!=KErrNotFound)
return(r);
}
@@ -246,15 +260,14 @@
-EXPORT_C TFindFile::TFindFile(RFs& aFs)
- : iFs(&aFs), iPathPos(0), iCurrentDrive(0), iMode(-1), iMatchMask(0)
/**
Constructor taking a file server session.
@param aFs File server session.
*/
+EXPORT_C TFindFile::TFindFile(RFs& aFs)
+ :iFs(&aFs), iPathPos(0), iCurrentDrive(0), iMode(-1), iDir(NULL), iMatchMask(0)
{
-
iFile.Set(_L(""),NULL,NULL);
}
@@ -274,29 +287,25 @@
TInt r=iFile.Set(aFileName,NULL,NULL);
if (r!=KErrNone)
return(r);
+
iPath=aPath;
iPathPos=0;
iMode=EFindByPath;
r=DoFindInDir();
-
- if (r==KErrNone)
- return(KErrNone);
- if (r!=KErrNotFound)
- return(r);
- if ((iPath==NULL) || (iPath->Length()==0))
- return(KErrNotFound);
-
-
+ // if it's not in the current dir and a search path was specified, look there.
+ if (r == KErrNotFound && iPath && iPath->Length())
r=DoFindNextInPath();
+
return(r);
}
-TInt TFindFile::DoFindByDir(const TDesC& aFileName,const TDesC& aDir)
+
//
// Look for aFileName in aDir on each connected drive
// Make initial check for aFileName in aDir on current drive
//
+TInt TFindFile::DoFindByDir(const TDesC& aFileName,const TDesC& aDir)
{
if (aFileName.Length() <= 0)
@@ -305,23 +314,24 @@
TInt r=iFs->Parse(aFileName,aDir,iFile);
if (r!=KErrNone)
return(r);
+
TInt searchResult=DoFindInDir();
- if(searchResult==KErrNoMemory)
+ if(searchResult == KErrNoMemory || searchResult == KErrPermissionDenied)
return(searchResult);
- if(searchResult==KErrPermissionDenied)
- return (KErrPermissionDenied);
-
r=iFs->DriveList(iDrvList,KDriveAttAll);
if (r!=KErrNone)
return(r);
+
TInt drive;
r=RFs::CharToDrive(iFile.Drive()[0],drive);
if (r!=KErrNone)
return(r);
+
iDrvList[drive]=0; // Drive 'drive' has already been searched
iCurrentDrive=EDriveY;
iMode=EFindByDrives;
+
if (searchResult==KErrNone)
return(KErrNone);
@@ -329,10 +339,21 @@
return(DoFindNextInDriveList());
}
+/**
+ internal helper method that deletes the (*iDir) object in the case of errors and assigns NULL to the client's pointer top it.
+*/
+TInt TFindFile::CallSafe(TInt aResult)
+ {
+ if (aResult != KErrNone && iDir)
+ {
+ delete *iDir;
+ *iDir = NULL;
+ iDir = NULL;
+ }
+ return aResult;
+ }
-
-EXPORT_C TInt TFindFile::FindByPath(const TDesC& aFileName,const TDesC* aPath)
/**
Searches for a file/directory in one or more directories in the path.
@@ -367,16 +388,16 @@
@see TFindFile::File
@see TFindFile::Find
*/
+EXPORT_C TInt TFindFile::FindByPath(const TDesC& aFileName,const TDesC* aPath)
{
iDir=NULL;
- return(DoFindByPath(aFileName,aPath));
+ return CallSafe(DoFindByPath(aFileName,aPath));
}
-EXPORT_C TInt TFindFile::FindByDir(const TDesC& aFileName,const TDesC& aDir)
/**
Searches for a file/directory in a directory on all available drives.
@@ -416,51 +437,50 @@
@see TFindFile::Find()
@see TFindFile::SetFindMask()
*/
+EXPORT_C TInt TFindFile::FindByDir(const TDesC& aFileName,const TDesC& aDir)
{
iDir=NULL;
- return(DoFindByDir(aFileName,aDir));
+ return CallSafe(DoFindByDir(aFileName,aDir));
}
-EXPORT_C TInt TFindFile::FindWildByPath(const TDesC& aFileName,const TDesC* aPath,CDir*& aDir)
+
/**
-Searches for one or more files/directories in the directories contained in a
-path list.
+Searches for one or more files/directories in the directories contained in a path list.
-Wildcard characters can be specified. The search ends when one or more
-filenames matching aFileName is found, or when every
-directory in the path list has been unsuccessfully searched.
-To begin searching again after a successful match has been made,
-use FindWild().
+Wildcard characters can be specified. The search ends when one or more filenames matching aFileName is found, or when every
+directory in the path list has been unsuccessfully searched. To begin searching again after a successful match has been made, use FindWild().
-Using function SetFindMask it is possible to specify a combination of
-attributes that the drives to be searched must match.
+Using function SetFindMask it is possible to specify a combination of attributes that the drives to be searched must match.
Notes:
-1. The caller of the function is responsible for deleting
- aDir after the function has returned.
+1. The function sets aDir to NULL, then allocates memory for it before appending entries to the list. Therefore,
+ aDir should have no memory allocated to it before this function is called, otherwise this memory will become orphaned.
-2. Calling TFindFile::File() after a successful search gets the drive letter
- and directory containing the file(s). The filenames can be retrieved via
- the array of TEntry::iName objects contained in aDir. If you want to
- retrieve the fully qualified path of a file, you need to parse the path and
- the filename.
+2. The caller of the function is responsible for deleting aDir after the function has returned. On error this pointer will be set NULL,
+ thus safe to delete.
+
+3. Calling TFindFile::File() after a successful search gets the drive letter and directory containing the file(s).
+ The filenames can be retrieved via the array of TEntry::iName objects contained in aDir. If you want to retrieve the fully
+ qualified path of a file, you need to parse the path and the filename.
-@param aFileName The filename to search for. May contain wildcards. If
- it specifies a directory as well as a filename, then that
+@param aFileName The filename to search for. May contain wildcards. If it specifies a directory as well as a filename, then that
directory is searched first.
-@param aPath List of directories to search. Paths in this list must be
- separated by a semicolon character, but a semicolon is not
- required after the final path. The directories are searched
- in the order in which they occur in the list.
- Directories must be fully qualified, including
- a drive letter, and the name must end with a backslash.
-@param aDir On return, contains the entries for all files matching
- aFileName in the first directory in which a match occurred.
+
+@param aPath List of directories to search. Paths in this list must be separated by a semicolon character, but a semicolon is not
+ required after the final path. The directories are searched in the order in which they occur in the list.
+ Directories must be fully qualified, including a drive letter, and the name must end with a backslash.
+
+@param aDir in: a reference to the pointer that will be modified by this method.
+
+ out: On success a pointer to the internally allocated by this method CDir object, which in turn contains the entries for
+ all files matching aFileName in the first directory in which a match occurred. In this case this API caller is responsible
+ for deleting aDir.
+ If some error occured (including KErrNotFound meaning that nothing found) this pointer will be set to NULL, which is also safe to delete.
@return KErrNone, if one or more matching files was found;
KErrNotFound, if no matching file was found in any of the directories.
@@ -471,79 +491,80 @@
@see TEntry::iName
@see TFindFile::SetFindMask()
*/
+EXPORT_C TInt TFindFile::FindWildByPath(const TDesC& aFileName,const TDesC* aPath,CDir*& aDir)
{
iDir=&aDir;
- return(DoFindByPath(aFileName,aPath));
+ *iDir=NULL;
+
+ return CallSafe(DoFindByPath(aFileName,aPath));
}
-EXPORT_C TInt TFindFile::FindWildByDir(const TDesC& aFileName,const TDesC& aDirPath,CDir*& aDir)
+
/**
-Searches, using wildcards, for one or more files/directories in a specified
-directory.
+Searches, using wildcards, for one or more files/directories in a specified directory.
-If no matching file is found in that directory, all available drives are
-searched in descending alphabetical order, from Y: to A:, and ending
-with the Z: drive.Using function SetFindMask it is possible to specify a
-combination of attributes that the drives to be searched must match.
+If no matching file is found in that directory, all available drives are searched in descending alphabetical order, from Y: to A:, and ending
+with the Z: drive.Using function SetFindMask it is possible to specify a combination of attributes that the drives to be searched must match.
-The search ends when one or more matching filenames are found, or when every
-available drive has been unsuccessfully searched. To begin searching again
-after a successful match has been made, use FindWild(). Wildcards may be
-specified in the filename.
+The search ends when one or more matching filenames are found, or when every available drive has been unsuccessfully searched.
+To begin searching again after a successful match has been made, use FindWild(). Wildcards may be specified in the filename.
Notes:
-1. A drive letter may be specified in aDirPath (or in aFileName). If a drive
- is specified, that drive is searched first, followed by the other available
- drives, in descending alphabetical order. If no drive is specified, the drive
- contained in the session path is searched first.
+1. A drive letter may be specified in aDirPath (or in aFileName). If a drive is specified, that drive is searched first,
+ followed by the other available drives, in descending alphabetical order. If no drive is specified, the drive contained in the session
+ path is searched first.
+
+2. The function sets aDir to NULL, then allocates memory for it before appending entries to the list. Therefore,
+ aDir should have no memory allocated to it before this function is called, otherwise this memory will become orphaned.
-2. The function sets aDir to NULL, then allocates memory for it before appending
- entries to the list. Therefore, aDir should have no memory allocated to it
- before this function is called, otherwise this memory will become orphaned.
+3. The caller of the function is responsible for deleting aDir after the function has returned. On error this pointer will be set NULL,
+ thus safe to delete.
-3. The caller of this function is responsible for deleting aDir after the function
- has returned.
-4. Calling TFindFile::File() after a successful search returns the drive letter
- and directory containing the file(s). Filenames may be retrieved via the array
- of TEntry::iNames contained in aDir. If you want to retrieve the fully
+4. Calling TFindFile::File() after a successful search returns the drive letter and directory containing the file(s).
+ Filenames may be retrieved via the array of TEntry::iNames contained in aDir. If you want to retrieve the fully
qualified path of a file, you will need to parse the path and the filename.
-@param aFileName The filename to search for. May contain wildcards. If a path
- is specified, it overrides the path specified in aDirPath.
- If no path is specified, the path contained in aDirPath is
- used in the search.
+@param aFileName The filename to search for. May contain wildcards. If a path is specified, it overrides the path specified in aDirPath.
+ If no path is specified, the path contained in aDirPath is used in the search.
+
@param aDirPath Path indicating a directory to search on each drive.
-@param aDir On return, contains the entries for all files
- matching aFileName.
+
+@param aDir in: a reference to the pointer that will be modified by this method.
+
+ out: On success a pointer to the internally allocated by this method CDir object, which in turn contains the entries for
+ all files matching aFileName in the first directory in which a match occurred. In this case this API caller is responsible
+ for deleting aDir.
+ If some error occured (including KErrNotFound meaning that nothing found) this pointer will be set to NULL, which is also safe to delete.
@return KErrNone if one or more matching files was found;
- KErrNotFound if no matching file was found in the directory on any
- of the drives.
+ KErrNotFound if no matching file was found in the directory on any of the drives.
KErrArgument, if the filename is empty.
@see TFindFile::FindWild
@see TFindFile::File
@see TFindFile::SetFindMask()
*/
+EXPORT_C TInt TFindFile::FindWildByDir(const TDesC& aFileName,const TDesC& aDirPath,CDir*& aDir)
{
-
iDir=&aDir;
- return(DoFindByDir(aFileName,aDirPath));
+ *iDir=NULL;
+
+ return CallSafe(DoFindByDir(aFileName,aDirPath));
}
-TInt TFindFile::DoFind()
//
// Find the next match
//
+TInt TFindFile::DoFind()
{
TInt ret=KErrNone;
@@ -565,7 +586,7 @@
-EXPORT_C TInt TFindFile::Find()
+
/**
Searches for the next file/directory.
@@ -589,6 +610,7 @@
@see TFindFile::SetFindMask()
*/
+EXPORT_C TInt TFindFile::Find()
{
// iDir=NULL;
@@ -598,7 +620,7 @@
-EXPORT_C TInt TFindFile::FindWild(CDir*& aDir)
+
/**
Searches for the next file/directory.
@@ -609,21 +631,25 @@
Notes:
-1. The caller of this function is responsible for deleting aDir after
- the function has returned
+1. The function sets aDir to NULL, then allocates memory for it before appending entries to the list. Therefore,
+ aDir should have no memory allocated to it before this function is called, otherwise this memory will become orphaned.
+
+2. The caller of the function is responsible for deleting aDir after the function has returned. On error this pointer will be set NULL,
+ thus safe to delete.
+
+3. Calling TFindFile::File() after a successful search, will return the drive letter and the directory containing the file(s).
+ The filenames may be retrieved via the array of TEntry::iName objects contained in aDir. If you want to retrieve the fully qualified
+ path of a file, you will need to parse the path and the filename using the TParse class or derived classes.
-2. Calling TFindFile::File() after a successful search, will return
- the drive letter and the directory containing the file(s).
- The filenames may be retrieved via the array of TEntry::iName objects
- contained in aDir. If you want to retrieve the fully qualified
- path of a file, you will need to parse the path and the filename using
- the TParse class or derived classes.
-
-@param aDir On return, contains the entries for all matching files found in
- the next directory.
+@param aDir in: a reference to the pointer that will be modified by this method.
+
+ out: On success a pointer to the internally allocated by this method CDir object, which in turn contains the entries for
+ all files matching aFileName in the first directory in which a match occurred. In this case this API caller is responsible
+ for deleting aDir.
+ If some error occured (including KErrNotFound meaning that nothing found) this pointer will be set to NULL, which is also safe to delete.
-@return KErrNone, if further occurrences were found;
- KErrNotFound, if no more matching files were found.
+@return KErrNone if further occurrences were found;
+ KErrNotFound if no more matching files were found.
@see TParse
@@ -633,15 +659,18 @@
@see TFindFile::FindWildByDir
@see TFindFile::SetFindMask()
*/
+EXPORT_C TInt TFindFile::FindWild(CDir*& aDir)
{
iDir=&aDir;
- return(DoFind());
+ *iDir=NULL;
+
+ return CallSafe(DoFind());
}
-EXPORT_C TInt TFindFile::SetFindMask(TUint aMask)
+
/**
Can be used in order to specify a combination of drive attributes that the drives
to be searched must match. When searching without specifying a mask, all drives, except the
@@ -653,6 +682,7 @@
KErrArgument, if the mask supplied is invalid.
*/
+EXPORT_C TInt TFindFile::SetFindMask(TUint aMask)
{
TInt r =ValidateMatchMask(aMask);
if(r!=KErrNone)
@@ -667,8 +697,5 @@
return KErrNone;
}
-
-
-
}
--- a/userlibandfileserver/fileserver/smassstorage/inc/scsiprot.h Sat Feb 20 00:10:51 2010 +0200
+++ b/userlibandfileserver/fileserver/smassstorage/inc/scsiprot.h Fri Mar 12 15:50:11 2010 +0200
@@ -1,4 +1,4 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2004-2010 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"
@@ -135,7 +135,8 @@
}
-const TUint KModeSenseCommandLength = 4;
+const TUint KModeSense6CommandLength = 4;
+const TUint KModeSense10CommandLength = 8;
const TUint KReadCapacityCommandLength = 8;
const TUint KReadFormatCapacitiesCommandLength = 12;
const TUint KRequestSenseCommandLength = 18;
@@ -156,7 +157,7 @@
ETestUnitReady = 0x00,
ERequestSense = 0x03,
EInquiry = 0x12,
- EModeSense = 0x1A,
+ EModeSense6 = 0x1A,
EStartStopUnit = 0x1B,
EPreventMediaRemoval = 0x1E,
EReadFormatCapacities = 0x23,
@@ -164,6 +165,7 @@
ERead10 = 0x28,
EWrite10 = 0x2A,
EVerify10 = 0x2f,
+ EModeSense10 = 0x5A,
EUndefinedCommand = 0xFF
};
@@ -197,7 +199,8 @@
TBool HandleRead10(TPtrC8& aData, TUint aLun);
TBool HandleWrite10(TPtrC8& aData, TUint aLun);
TBool HandleVerify10(TPtrC8& aData, TUint aLun);
- TBool HandleModeSense(TPtrC8& aData, TUint aLun);
+ TBool HandleModeSense6(TPtrC8& aData, TUint aLun);
+ TBool HandleModeSense10(TPtrC8& aData, TUint aLun);
TBool HandleReadFormatCapacities(TUint aLun);
private:
--- a/userlibandfileserver/fileserver/smassstorage/scsiprot.cpp Sat Feb 20 00:10:51 2010 +0200
+++ b/userlibandfileserver/fileserver/smassstorage/scsiprot.cpp Fri Mar 12 15:50:11 2010 +0200
@@ -1,4 +1,4 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2004-2010 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"
@@ -243,10 +243,14 @@
HandleInquiry(aData, aLun);
break;
- case EModeSense:
- HandleModeSense(aData, aLun);
+ case EModeSense6:
+ HandleModeSense6(aData, aLun);
break;
+ case EModeSense10:
+ HandleModeSense10(aData, aLun);
+ break;
+
case EStartStopUnit:
HandleStartStopUnit(aData, aLun);
break;
@@ -1224,15 +1228,13 @@
@return ETrue if successful.
*/
-TBool CScsiProtocol::HandleModeSense(TPtrC8& aData, TUint aLun)
+TBool CScsiProtocol::HandleModeSense6(TPtrC8& aData, TUint aLun)
{
- __FNLOG("CScsiProtocol::HandleModeSense");
+ __FNLOG("CScsiProtocol::HandleModeSense6");
TInt pageCode = aData[3] & 0x3F;
TUint8 pageControl= static_cast<TUint8>(aData[3] >>6);
- // reserve 4 bytes for Length, Media type, Device-specific parameter and Block descriptor length
-
if (pageCode != KAllPages || pageControl == KChangeableValues)
{
__PRINT(_L("TSenseInfo::EIllegalRequest,TSenseInfo::EInvalidFieldInCdb"));
@@ -1240,9 +1242,10 @@
return EFalse;
}
+ // reserve 4 bytes for Length, Media type, Device-specific parameter and Block descriptor length
TPtr8 writeBuf(NULL, 0);
- iTransport->GetCommandBufPtr(writeBuf, KModeSenseCommandLength);
- writeBuf.FillZ(KModeSenseCommandLength);
+ iTransport->GetCommandBufPtr(writeBuf, KModeSense6CommandLength);
+ writeBuf.FillZ(KModeSense6CommandLength);
if (pageControl != KDefaultValues)
{
@@ -1279,3 +1282,63 @@
}
+/**
+Command Parser for the MODE SENSE(10) command (0x5A)
+
+@return ETrue if successful.
+*/
+TBool CScsiProtocol::HandleModeSense10(TPtrC8& aData, TUint aLun)
+ {
+ __FNLOG("CScsiProtocol::HandleModeSense10");
+
+ TInt pageCode = aData[3] & 0x3F;
+ TUint8 pageControl= static_cast<TUint8>(aData[3] >>6);
+
+ if (pageCode != KAllPages || pageControl == KChangeableValues)
+ {
+ __PRINT(_L("TSenseInfo::EIllegalRequest,TSenseInfo::EInvalidFieldInCdb"));
+ iSenseInfo.SetSense(TSenseInfo::EIllegalRequest,TSenseInfo::EInvalidFieldInCdb);
+ return EFalse;
+ }
+
+ // reserve 8 bytes for Length, Media type, Device-specific parameter and Block descriptor length
+ TPtr8 writeBuf(NULL, 0);
+ iTransport->GetCommandBufPtr(writeBuf, KModeSense10CommandLength);
+ writeBuf.FillZ(KModeSense10CommandLength);
+
+ if (pageControl != KDefaultValues)
+ {
+ //check if drive write protected
+ CMassStorageDrive* drive=GetCheckDrive(aLun);
+ if (drive == NULL)
+ {
+ __PRINT(_L("drive == null"));
+ return EFalse;
+ }
+
+ TLocalDriveCapsV4 driveInfo;
+ TInt err = drive->Caps(driveInfo);
+ if (err != KErrNone)
+ {
+ __PRINT(_L("TSenseInfo::ENotReady"));
+ iSenseInfo.SetSense(TSenseInfo::ENotReady, TSenseInfo::EMediaNotPresent);
+ return EFalse ;
+ }
+
+ if (driveInfo.iMediaAtt & KMediaAttWriteProtected)
+ {
+ writeBuf[3] = 1<<7; // set SWP bit at the Device Specific parameters
+ }
+ }
+
+ writeBuf[1]=6; //Sending only Mode parameter header
+
+ TPtrC8 writeBuf1 = writeBuf;
+
+ iTransport->SetupWriteData(writeBuf1);
+
+ return (iSenseInfo.SenseOk());
+ }
+
+
+