|
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". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // f32test\fsstress\t_remfsy.cpp |
|
15 // |
|
16 // |
|
17 |
|
18 #if defined(_UNICODE) |
|
19 #if !defined(UNICODE) |
|
20 #define UNICODE |
|
21 #endif |
|
22 #endif |
|
23 |
|
24 /* |
|
25 #define WIN32_LEAN_AND_MEAN |
|
26 #pragma warning( disable : 4201 ) // nonstandard extension used : nameless struct/union |
|
27 #include <windows.h> |
|
28 #pragma warning( default : 4201 ) // nonstandard extension used : nameless struct/union |
|
29 #include <stdlib.h> |
|
30 */ |
|
31 #include <f32file.h> |
|
32 #include <f32fsys.h> |
|
33 #include <f32ver.h> |
|
34 #include <e32twin.h> |
|
35 #include <e32uid.h> |
|
36 |
|
37 #include "t_remfsy.h" |
|
38 |
|
39 const TInt KMajorVersionNumber=1; |
|
40 const TInt KMinorVersionNumber=0; |
|
41 // |
|
42 //const TInt KKiloBytes=0x400; |
|
43 //const TBuf<4> KUidName=_L(":UID"); |
|
44 //const TInt KUidNameLength=4; |
|
45 // |
|
46 //LOCAL_D TBuf8<0x1000> buf; |
|
47 //LOCAL_D RConsole theConsole; |
|
48 |
|
49 |
|
50 ////////////////////////////////////////////////////////////////////////// |
|
51 // CRemote // |
|
52 ////////////////////////////////////////////////////////////////////////// |
|
53 |
|
54 |
|
55 CRemote::CRemote() |
|
56 // |
|
57 // Constructor |
|
58 // |
|
59 { |
|
60 __DECLARE_NAME(_S("CRemote")); |
|
61 } |
|
62 |
|
63 |
|
64 |
|
65 TInt CRemote::Install() |
|
66 // |
|
67 // Install the file system. |
|
68 // |
|
69 { |
|
70 |
|
71 // SetErrorMode(SEM_FAILCRITICALERRORS); |
|
72 RDebug::Print(_L("BASH in CRemote::Install")); |
|
73 iVersion=TVersion(KMajorVersionNumber,KMinorVersionNumber,KF32BuildVersionNumber); |
|
74 TPtrC name=_L("T_REMFSY"); |
|
75 return(SetName(&name)); |
|
76 } |
|
77 |
|
78 |
|
79 //???JCS: Removed all aSession parameters to get the code to compile |
|
80 |
|
81 |
|
82 |
|
83 CMountCB* CRemote::NewMountL(/*CSessionFs* aSession*/) const |
|
84 // |
|
85 // Create a new mount control block. |
|
86 // |
|
87 { |
|
88 |
|
89 return(new(ELeave) CRemoteMountCB); |
|
90 } |
|
91 |
|
92 CFileCB* CRemote::NewFileL(/*CSessionFs* aSession*/) const |
|
93 // |
|
94 // Create a new file. |
|
95 // |
|
96 { |
|
97 |
|
98 return(new(ELeave) CRemoteFileCB); |
|
99 } |
|
100 |
|
101 CDirCB* CRemote::NewDirL(/*CSessionFs* aSession*/) const |
|
102 // |
|
103 // Create a new directory lister. |
|
104 // |
|
105 { |
|
106 |
|
107 return(new(ELeave) CRemoteDirCB(/*aSession*/)); |
|
108 } |
|
109 |
|
110 CFormatCB* CRemote::NewFormatL(/*CSessionFs* aSession*/) const |
|
111 // |
|
112 // Create a new media formatter. |
|
113 // |
|
114 { |
|
115 |
|
116 return(new(ELeave) CRemoteFormatCB(/*aSession*/)); |
|
117 } |
|
118 |
|
119 TInt CRemote::DefaultPath(TDes& aPath) const |
|
120 // |
|
121 // Return the initial default path. |
|
122 // |
|
123 { |
|
124 |
|
125 aPath=_L("Q:\\"); |
|
126 return(KErrNone); |
|
127 } |
|
128 |
|
129 |
|
130 CFileSystem* CRemote::NewL() |
|
131 // |
|
132 // JCS |
|
133 // |
|
134 { |
|
135 CFileSystem* remoteFsy=new(ELeave) CRemote(); |
|
136 return remoteFsy; |
|
137 } |
|
138 |
|
139 |
|
140 void CRemote::DriveInfo(TDriveInfo& anInfo,TInt aDriveNumber) const |
|
141 // |
|
142 // Return the drive info iDriveAtt && iBatteryState already set |
|
143 // |
|
144 { |
|
145 |
|
146 TFileName d; |
|
147 d.Format(_L("%c:\\"),aDriveNumber+'A'); |
|
148 if (MapDriveInfo(anInfo,aDriveNumber)) |
|
149 { |
|
150 if (MapDriveAttributes(anInfo.iDriveAtt,aDriveNumber)) |
|
151 { |
|
152 return; |
|
153 } |
|
154 } |
|
155 |
|
156 // UINT r=GetDriveType((_STRC)d.PtrZ()); |
|
157 TMediaType t; |
|
158 anInfo.iMediaAtt=0; |
|
159 /* |
|
160 switch (r) |
|
161 { |
|
162 case DRIVE_REMOVABLE: |
|
163 anInfo.iMediaAtt|=KMediaAttDualDensity; |
|
164 t=EMediaFloppy; |
|
165 break; |
|
166 case DRIVE_NO_ROOT_DIR: t=EMediaNotPresent; break; |
|
167 case DRIVE_FIXED: t=EMediaHardDisk; break; |
|
168 case DRIVE_REMOTE: t=EMediaRemote; break; |
|
169 case DRIVE_CDROM: t=EMediaCdRom; break; |
|
170 case DRIVE_RAMDISK: t=EMediaRam; break; |
|
171 case DRIVE_UNKNOWN: |
|
172 default: |
|
173 t=EMediaUnknown; |
|
174 } |
|
175 */ |
|
176 t=EMediaRemote; |
|
177 anInfo.iType=t; |
|
178 } |
|
179 |
|
180 |
|
181 extern "C" { |
|
182 |
|
183 EXPORT_C CFileSystem* CreateFileSystem() |
|
184 // |
|
185 // Create a new file system |
|
186 // |
|
187 { |
|
188 return(CRemote::NewL()); |
|
189 // return(new CRemote); |
|
190 } |
|
191 } |
|
192 |
|
193 |