First public contribution.
1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // f32test\fsstress\t_remfil.cpp
25 #define WIN32_LEAN_AND_MEAN
26 #pragma warning( disable : 4201 ) // nonstandard extension used : nameless struct/union
28 #pragma warning( default : 4201 ) // nonstandard extension used : nameless struct/union
41 //////////////////////////////////////////////////////////////////////////
43 //////////////////////////////////////////////////////////////////////////
45 CRemoteFileCB::CRemoteFileCB()
52 // iAttPending=EFalse;
54 __DECLARE_NAME(_S("CRemoteFileCB"));
57 CRemoteFileCB::~CRemoteFileCB()
63 if (iAtt&KEntryAttModified)
65 TRAP_IGNORE(FlushDataL());
66 // if (ret!=KErrNone) // Can fail if floppy disk is removed
67 // Panic(EFileClose); // Ignore error
69 // if (iWinHandle!=NULL && CloseHandle(iWinHandle)==FALSE)
73 TBool CRemoteFileCB::IsRomDrive() const
75 // Returns ETrue if the drive number == EDriveZ
78 return(((CRemoteFileCB*)this)->Mount().Drive().DriveNumber()==EDriveZ);
82 void CRemoteFileCB::CheckPos(TInt /*aPos*/)
84 // Check that the file is positioned correctly.
85 // Dummy implementation
90 void CRemoteFileCB::ReadL(TInt /*aPos*/,TInt& /*aLength*/,const TAny* /*aDes*/,const RMessagePtr2& /*aMessage*/)
93 // Dummy implementation of a pure virtual function
96 User::After(200000); // Wait 0.2 seconds
100 void CRemoteFileCB::WriteL(TInt /*aPos*/,TInt& /*aLength*/,const TAny* /*aDes*/,const RMessagePtr2& /*aMessage*/)
105 User::After(200000); // Wait 0.2 seconds
109 User::Leave(KErrAccessDenied);
116 TInt s=Min(len,buf.MaxLength());
117 thread.ReadL(aDes,buf,pos);
118 // Reading from client thread descriptor to fileserver thread
120 // printf(iConsole,_L("%S\n"),&buf);
126 iCurrentPos=aPos+pos;
130 TInt CRemoteFileCB::Address(TInt& /*aPos*/) const
132 // If ROM file, do a memory map and return the address
133 // Dummy implementation
139 void CRemoteFileCB::SetSizeL(TInt /*aSize*/)
142 // Dummy implementation of a pure virtual function
145 User::After(200000); // Wait 0.2 seconds
148 void CRemoteFileCB::SetEntryL(const TTime& /*aTime*/,TUint /*aSetAttMask*/,TUint /*aClearAttMask*/)
150 // Set the entry's attributes and modified time
151 // Dummy implementation of a pure virtual function
154 User::After(200000); // Wait 0.2 seconds
158 void CRemoteFileCB::FlushAllL()
160 // Commit any buffered date to the media.
168 void CRemoteFileCB::FlushDataL()
170 // Commit any buffered date to the media
171 // Dummy implementation of a pure virtual function
175 void CRemoteFileCB::RenameL(const TDesC& /*aNewName*/)
177 // Rename the file while open
178 // Dummy implementation of a pure virtual function
181 User::After(200000); // Wait 0.2 seconds
185 LOCAL_C void printf(RConsole& aConsole, TRefByValue<const TDesC> aFmt,...)
187 // Print to the console
191 if (aConsole.Handle()==KNullHandle)
193 TInt r=aConsole.Init(_L("RemoteFSys"),TSize(KDefaultConsWidth,KDefaultConsHeight));
194 __ASSERT_ALWAYS(r==KErrNone,User::Panic(_L("Open-Console"),0));
195 r=aConsole.Control(_L("+Maximize +NewLine -Lock -Wrap"));
196 __ASSERT_ALWAYS(r==KErrNone,User::Panic(_L("Config-Console"),0));
201 aBuf.AppendFormatList(aFmt,list);
202 TInt r=aConsole.Write(aBuf);
203 __ASSERT_ALWAYS(r==KErrNone,User::Panic(_L("Write-Console"),0));