author | hgs |
Fri, 23 Apr 2010 22:26:35 +0100 | |
changeset 124 | 5802e2ce68ed |
parent 36 | 538db54a451d |
child 243 | c7a0ce20c48c |
permissions | -rw-r--r-- |
0 | 1 |
// Copyright (c) 2006-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 |
// f32\inc\f32plugin.h |
|
15 |
// |
|
16 |
// WARNING: This file contains some APIs which are internal and are subject |
|
17 |
// to change without notice. Such APIs should therefore not be used |
|
18 |
// outside the Kernel and Hardware Services package. |
|
19 |
// |
|
20 |
||
21 |
/** |
|
22 |
@file |
|
23 |
@internalTechnology |
|
24 |
*/ |
|
25 |
||
26 |
||
27 |
#if !defined(__F32PLUGIN_H__) |
|
28 |
#define __F32PLUGIN_H__ |
|
29 |
||
30 |
#include <f32file.h> |
|
31 |
#include <f32file_private.h> |
|
32 |
#include <f32fsys.h> |
|
33 |
||
34 |
const TInt KPluginMessageForward = 1; ///< Returned from ::Dispatch() to indicate that a request has been processed synchronously and should be passed down the stack. |
|
35 |
const TInt KPluginMessageComplete = 2; ///< Returned from ::Dispatch() to indicate that a request has been processed synchronously and should be passed back up the stack. |
|
36 |
||
37 |
const TInt KCountNeeded=KMinTInt; |
|
38 |
||
39 |
/** |
|
36
538db54a451d
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
40 |
List of file server operations |
0 | 41 |
*/ |
42 |
enum TFsMessage |
|
43 |
{ |
|
44 |
EFsAddFileSystem, ///< Adds a file system |
|
45 |
EFsRemoveFileSystem, ///< Removes a file system |
|
46 |
EFsMountFileSystem, ///< Mounts a file system |
|
47 |
EFsNotifyChange, ///< Notifies file and/or directory change |
|
48 |
EFsNotifyChangeCancel, ///< Cancels change notification |
|
49 |
EFsDriveList, ///< Gets a list of the available drive |
|
50 |
EFsDrive, ///< Gets information about a drive and the medium mounted on it |
|
51 |
EFsVolume, ///< Gets volume information for a formatted device |
|
52 |
EFsSetVolume, ///< Sets the label for a volume |
|
53 |
EFsSubst, ///< Gets the path assigned to a drive letter |
|
54 |
EFsSetSubst, ///< -- 10, Assigns a path to a drive letter |
|
55 |
EFsRealName, ///< Gets the real name of a file |
|
56 |
EFsDefaultPath, ///< Gets the system default path |
|
57 |
EFsSetDefaultPath, ///< Sets the system default path |
|
58 |
EFsSessionPath, ///< Gets the session path |
|
59 |
EFsSetSessionPath, ///< Sets the session path for the current file server client |
|
60 |
EFsMkDir, ///< Makes directory |
|
61 |
EFsRmDir, ///< Removes a directory |
|
62 |
EFsParse, ///< Parses a filename specification |
|
63 |
EFsDelete, ///< Deletes file |
|
64 |
EFsRename, ///< -- 20 Renames a single file or directory |
|
65 |
EFsReplace, ///< Replaces a single file with another |
|
66 |
EFsEntry, ///< Gets a file's attributes |
|
67 |
EFsSetEntry, ///< Sets both the attributes and the last modified date and time for a file or directory |
|
68 |
EFsGetDriveName, ///< Gets the name of a drive |
|
69 |
EFsSetDriveName, ///< Sets the name of a drive |
|
70 |
EFsFormatSubClose, ///< Closes the Format subsession |
|
71 |
EFsDirSubClose, ///< Closes the directory. |
|
72 |
EFsFileSubClose, ///< Closes the file |
|
36
538db54a451d
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
73 |
EFsRawSubClose, ///< Closes the direct access channel to the disk |
0 | 74 |
EFsFileOpen, ///< -- 30 Opens file |
75 |
EFsFileCreate, ///< Creates and opens a new file |
|
76 |
EFsFileReplace, ///< Replaces a file of the same name or creates a new file |
|
77 |
EFsFileTemp, ///< Creates and opens a temporary file |
|
78 |
EFsFileRead, ///< Reads from the file |
|
79 |
EFsFileWrite, ///< Writes to the file |
|
80 |
EFsFileLock, ///< Locks a region within the file |
|
81 |
EFsFileUnLock, ///< Unlocks a region within the file |
|
82 |
EFsFileSeek, ///< Sets the the current file position |
|
83 |
EFsFileFlush, ///< Commits data to the storage device |
|
84 |
EFsFileSize, ///< -- 40 Gets the current file size |
|
85 |
EFsFileSetSize, ///< Sets the file size |
|
86 |
EFsFileAtt, ///< Gets the file's attributes |
|
87 |
EFsFileSetAtt, ///< Sets or clears file attributes |
|
88 |
EFsFileModified, ///< Gets local date and time the file was last modified |
|
89 |
EFsFileSetModified, ///< Sets the date and time the file was last modified |
|
90 |
EFsFileSet, ///< Sets the file’s attributes, last modification date/time |
|
91 |
EFsFileChangeMode, ///< Switches an open file's access mode |
|
92 |
EFsFileRename, ///< Renames a file |
|
93 |
EFsDirOpen, ///< Opens a directory |
|
94 |
EFsDirReadOne, ///< -- 50 Reads a single directory entry |
|
95 |
EFsDirReadPacked, ///< Reads all filtered directory entries |
|
96 |
EFsFormatOpen, ///< Opens a device for formatting |
|
97 |
EFsFormatNext, ///< Executes the next format step |
|
98 |
EFsRawDiskOpen, ///< Opens a direct access channel to the disk */ |
|
99 |
EFsRawDiskRead, ///< Reads directly from the disk |
|
100 |
EFsRawDiskWrite, ///< Writes directly to the disk |
|
101 |
EFsResourceCountMarkStart, ///< Marks the start of resource count checking |
|
102 |
EFsResourceCountMarkEnd, ///< Ends resource count checking |
|
103 |
EFsResourceCount, ///< Gets the number of currently open resources |
|
104 |
EFsCheckDisk, ///< -- 60 Checks the integrity of the disk on the specified drive |
|
105 |
EFsGetShortName, ///< Gets the short filename |
|
106 |
EFsGetLongName, ///< Gets the long filename |
|
107 |
EFsIsFileOpen, ///< Tests whether a file is open |
|
108 |
EFsListOpenFiles, ///< get a list of open files */ |
|
109 |
EFsGetNotifyUser, ///< Tests user notification of file access failure is in effect |
|
110 |
EFsSetNotifyUser, ///< Sets if the user should be notified of file access failure |
|
111 |
EFsIsFileInRom, ///< Gets a pointer to the specified file, if it is in ROM |
|
112 |
EFsIsValidName, ///< Tests whether a filename and path are syntactically correct |
|
113 |
EFsDebugFunction, ///< Different debugging info |
|
114 |
EFsReadFileSection, ///< -- 70 Reads data from a file without opening it |
|
115 |
EFsNotifyChangeEx, ///< Requests a notification of change to files or directories |
|
116 |
EFsNotifyChangeCancelEx, ///< Cancels all outstanding requests for notification of change |
|
117 |
EFsDismountFileSystem, ///< Dismounts the file system from the specified drive |
|
118 |
EFsFileSystemName, ///< Gets the name of the file system mounted on the specified drive |
|
119 |
EFsScanDrive, ///< Checks the specified drive for specific errors and corrects them |
|
120 |
EFsControlIo, ///< General purpose test interface |
|
121 |
EFsLockDrive, ///< Locks a MultiMedia card in the specified drive |
|
122 |
EFsUnlockDrive, ///< Unlocks the MultiMedia card in the specified drive |
|
123 |
EFsClearPassword, ///< Clears the password from the locked MultiMedia card |
|
124 |
EFsNotifyDiskSpace, ///< -- 80 Disk space change notification |
|
125 |
EFsNotifyDiskSpaceCancel, ///< Cancels a specific outstanding notification |
|
126 |
EFsFileDrive, ///< Gets drive information on which this file resides |
|
127 |
EFsRemountDrive, ///< Forces a remount of the specified drive |
|
128 |
EFsMountFileSystemScan, ///< Mounts a file system and performs a scan on a drive |
|
129 |
EFsSessionToPrivate, ///< Sets the session path to point to the private path |
|
130 |
EFsPrivatePath, ///< Creates the text defining the private path |
|
131 |
EFsCreatePrivatePath, ///< Creates the private path for a process |
|
132 |
EFsAddExtension, ///< Adds the specified extension |
|
133 |
EFsMountExtension, ///< Mounts the the specified extension |
|
134 |
EFsDismountExtension, ///< -- 90 Dismounts the specified extension |
|
135 |
EFsRemoveExtension, ///< Removes the specified extension |
|
136 |
EFsExtensionName, ///< Gets the name of the extension on the specified drive |
|
137 |
EFsStartupInitComplete, ///< Noifies the file server of startup initialisation completion |
|
138 |
EFsSetLocalDriveMapping, ///< Set the local drive mapping |
|
139 |
EFsFinaliseDrive, ///< Finalise a specific drive |
|
140 |
EFsFileDuplicate, ///< Makes a duplicate of this file handle |
|
141 |
EFsFileAdopt, ///< Adopts an already open file |
|
142 |
EFsSwapFileSystem, ///< Swaps file systems |
|
143 |
EFsErasePassword, ///< Erase the password from the locked MultiMedia card |
|
144 |
EFsReserveDriveSpace, ///< -- 100 Reserves an area of a drive |
|
36
538db54a451d
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
145 |
EFsGetReserveAccess, ///< Get exclusive access to reserved area |
0 | 146 |
EFsReleaseReserveAccess, ///< Release exclusive access to reserved area |
147 |
EFsFileName, ///< Gets the final part of a filename |
|
148 |
EFsGetMediaSerialNumber, ///< Gets the serial number of media |
|
149 |
EFsFileFullName, ///< Gets the full filename |
|
150 |
EFsAddPlugin, ///< Adds the specified plugin |
|
151 |
EFsRemovePlugin, ///< Removes the specified plugin |
|
152 |
EFsMountPlugin, ///< Mounts the specified plugin |
|
153 |
EFsDismountPlugin, ///< Dismounts the specified plugin |
|
36
538db54a451d
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
154 |
EFsPluginName, ///<-- 110 Gets a plugin's name in specific position and drive |
0 | 155 |
EFsPluginOpen, ///< Opens the plugin |
156 |
EFsPluginSubClose, ///< Closes the plugin |
|
157 |
EFsPluginDoRequest, ///< Issues an asynchronous plugin request |
|
158 |
EFsPluginDoControl, ///< Issues a synchronous plugin request |
|
159 |
EFsPluginDoCancel, ///< Cancels an synchronous plugin request |
|
160 |
EFsNotifyDismount, ///< Issues a request to asynchronously dismount the file system |
|
161 |
EFsNotifyDismountCancel, ///< Cancels a request to asynchronously dismount the file system |
|
162 |
EFsAllowDismount, ///< Notifies that it is safe to dismount the file system |
|
163 |
EFsSetStartupConfiguration, ///< Configures file server at startup |
|
164 |
EFsFileReadCancel, ///< -- 120 Cancels an outstanding asynchronous read request |
|
165 |
EFsAddCompositeMount, ///< Add a mount to the composite file system |
|
166 |
EFsSetSessionFlags, ///< Set/Clear session specific flags |
|
167 |
EFsSetSystemDrive, ///< Set SystemDrive |
|
168 |
EFsBlockMap, ///< Fetches the BlockMap of a file |
|
169 |
EFsUnclamp, ///< Re-enable modification of a specified file in storage media |
|
170 |
EFsFileClamp, ///< Disable modification of a specified file in storage media |
|
171 |
EFsQueryVolumeInfoExt, ///< Query interface to retrieve extended volume information |
|
172 |
EFsInitialisePropertiesFile,///< Read in the F32 properties file provided by ESTART |
|
173 |
EFsFileWriteDirty, ///< Writes dirty data to disk. Used when write caching enabled |
|
174 |
EFsSynchroniseDriveThread, ///< -- 130 Synchronises the asynchronous operation which executes in driver thread |
|
175 |
EFsAddProxyDrive, ///< Loads a proxy drive |
|
176 |
EFsRemoveProxyDrive, ///< Unloads a proxy drive |
|
177 |
EFsMountProxyDrive, ///< Mounts a proxy drive |
|
178 |
EFsDismountProxyDrive, ///< Dismounts a proxy drive |
|
179 |
EFsNotificationOpen, ///< Opens the notification |
|
180 |
EFsNotificationBuffer, ///< Communicates buffer to file server |
|
36
538db54a451d
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
181 |
EFsNotificationRequest, ///< Sends the notification request |
538db54a451d
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
182 |
EFsNotificationCancel, ///< Cancels the notification request |
538db54a451d
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
183 |
EFsNotificationSubClose, ///< Closes the notification |
538db54a451d
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
184 |
EFsNotificationAdd, ///< -- 140 Adds filter to the server, comprising a path and notification type |
0 | 185 |
EFsNotificationRemove, ///< Removes filters from Server-Side |
186 |
EFsLoadCodePage, ///< Loads a code page library |
|
187 |
EMaxClientOperations ///< This must always be the last operation insert above |
|
188 |
}; |
|
189 |
||
190 |
class CFsRequest; |
|
191 |
||
192 |
/** |
|
36
538db54a451d
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
193 |
Request wrapper for plugins |
0 | 194 |
*/ |
195 |
class TFsPluginRequest |
|
196 |
{ |
|
197 |
public: |
|
198 |
||
199 |
/** |
|
200 |
@publishedPartner |
|
201 |
@released |
|
202 |
||
203 |
Used for getting parameters from |
|
204 |
a CFsRequest by a F32 plugin. |
|
205 |
*/ |
|
206 |
enum TF32ArgType |
|
207 |
{ |
|
208 |
EPosition, |
|
209 |
ELength, |
|
210 |
EData, |
|
211 |
ESize, |
|
212 |
EName, |
|
213 |
ENewName, |
|
214 |
EEntry, |
|
215 |
ETime, |
|
216 |
ESetAtt, |
|
217 |
EClearAtt, |
|
218 |
EMode, |
|
219 |
EAtt, |
|
220 |
EAttMask, |
|
221 |
EUid, |
|
222 |
EEntryArray, |
|
223 |
ENewPosition, |
|
36
538db54a451d
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
224 |
EVolumeInfo |
0 | 225 |
}; |
226 |
||
227 |
IMPORT_C TFsPluginRequest(CFsRequest* aRequest); |
|
228 |
||
229 |
/** |
|
230 |
@publishedPartner |
|
231 |
@released |
|
232 |
||
233 |
Get the current Function number, as defined in TFsMessage |
|
234 |
*/ |
|
235 |
IMPORT_C TInt Function() const; |
|
236 |
||
237 |
/** |
|
238 |
@publishedPartner |
|
239 |
@released |
|
240 |
||
241 |
Returns the drive number of the current request |
|
242 |
*/ |
|
243 |
IMPORT_C TInt DriveNumber() const; |
|
244 |
IMPORT_C TParse& Src() const; |
|
245 |
IMPORT_C TParse& Dest() const; |
|
246 |
IMPORT_C TDrive* Drive() const; |
|
247 |
IMPORT_C TDrive* SubstedDrive() const; |
|
248 |
IMPORT_C const RMessage2& Message() const; |
|
249 |
IMPORT_C CFsRequest* Request() const; |
|
250 |
IMPORT_C TUint ScratchValue() const; |
|
251 |
IMPORT_C TInt64 ScratchValue64() const; |
|
252 |
IMPORT_C TBool IsPostOperation() const; |
|
253 |
||
254 |
/** |
|
255 |
@publishedPartner |
|
256 |
@released |
|
257 |
||
258 |
Utility function for returning a TInt type of TF32ArgType value from the current request. |
|
259 |
i.e. ELength. |
|
260 |
||
261 |
To obtain EPosition, authors should use ::Read(TF32ArgType,TInt64&) |
|
262 |
*/ |
|
263 |
IMPORT_C TInt Read(TF32ArgType aType, TInt& aVal); |
|
264 |
||
265 |
/** |
|
266 |
@publishedPartner |
|
267 |
@released |
|
268 |
||
269 |
Utility function for returning a TUint type of TF32ArgType value from the current request. |
|
270 |
||
271 |
To obtain EPosition, authors should use ::Read(TF32ArgType,TInt64&) |
|
272 |
*/ |
|
273 |
IMPORT_C TInt Read(TF32ArgType aType, TUint& aVal); |
|
274 |
||
275 |
/** |
|
276 |
@publishedPartner |
|
277 |
@released |
|
278 |
||
279 |
Utility function for returning a TInt64 type of TF32ArgType value from the current request. |
|
280 |
i.e. EPosition. |
|
281 |
*/ |
|
282 |
IMPORT_C TInt Read(TF32ArgType aType, TInt64& aVal); |
|
283 |
||
284 |
/** |
|
285 |
@publishedPartner |
|
286 |
@released |
|
287 |
||
288 |
Utility function for receving descriptor or packaged paramters of the current request. |
|
289 |
For non-descriptor types such a TEntry, plugin authors should pass an object of type TPckg<TEntry> in to aDes. |
|
290 |
*/ |
|
291 |
IMPORT_C TInt Read(TF32ArgType aType, TDes8& aDes, TInt aOffset = 0); |
|
292 |
||
293 |
/** |
|
294 |
@publishedPartner |
|
295 |
@released |
|
296 |
||
297 |
Utility function for receving descriptor or packaged paramters of the current request. |
|
298 |
For non-descriptor types such a TEntry, plugin authors should pass an object of type TPckg<TEntry> in to aDes. |
|
299 |
*/ |
|
300 |
IMPORT_C TInt Read(TF32ArgType aType, TDes16& aDes, TInt aOffset = 0); |
|
301 |
||
302 |
/** |
|
303 |
@publishedPartner |
|
304 |
@released |
|
305 |
||
306 |
Utilty function for writing data back to the request. |
|
307 |
Non-descriptor values should be packaged i.e TPckg<TUidType> |
|
308 |
*/ |
|
309 |
IMPORT_C TInt Write(TF32ArgType aType, const TDesC8& aDes, TInt aOffset = 0); |
|
310 |
||
311 |
/** |
|
312 |
@publishedPartner |
|
313 |
@released |
|
314 |
||
315 |
Utilty function for writing data back to the request. |
|
316 |
Non-descriptor values should be packaged i.e TPckg<TUidType> |
|
317 |
*/ |
|
318 |
IMPORT_C TInt Write(TF32ArgType aType, const TDesC16& aDes, TInt aOffset = 0); |
|
319 |
||
320 |
/** |
|
321 |
@publishedPartner |
|
322 |
@released |
|
323 |
*/ |
|
324 |
IMPORT_C TInt FileName(TDes& aName); |
|
325 |
||
326 |
/** |
|
327 |
@publishedPartner |
|
328 |
@released |
|
329 |
||
330 |
When plugin authors perform early completion of read or write requests, then SetSharePos should be called in order to |
|
331 |
update the share position to the client. |
|
332 |
*/ |
|
333 |
IMPORT_C TInt SetSharePos(TInt64& aPos); |
|
334 |
||
335 |
private: |
|
336 |
TInt ClientSubSessionHandle(TInt& aHandle); |
|
337 |
TInt ShareFromClientHandle(CFileShare*& aShare); |
|
338 |
||
339 |
void NameFromShare(CFileShare& aFileShare, TDes& aName); |
|
340 |
||
341 |
private: |
|
342 |
CFsRequest* iFsRequest; |
|
343 |
||
344 |
friend class RFilePlugin; |
|
345 |
}; |
|
346 |
||
347 |
/** |
|
348 |
@publishedPartner |
|
349 |
@released |
|
350 |
||
351 |
Helper class for plugins to use to access TEntryArray data |
|
352 |
*/ |
|
353 |
class TRawEntryArray : public TEntryArray |
|
354 |
{ |
|
355 |
public: |
|
356 |
IMPORT_C TDes8& Buf(); |
|
357 |
IMPORT_C void SetBuf(TDes8& aBuf); |
|
358 |
IMPORT_C TInt EntrySize(TInt aIdx); |
|
359 |
}; |
|
360 |
||
361 |
class CFsPlugin; |
|
362 |
class CPluginThread; |
|
363 |
class CFsPluginConn; |
|
364 |
||
365 |
/** |
|
366 |
Plugin factory class. It is created when RFs::AddPlugin is called. |
|
367 |
*/ |
|
368 |
class CFsPluginFactory : public CFsObject |
|
369 |
{ |
|
370 |
public: |
|
371 |
IMPORT_C CFsPluginFactory(); |
|
372 |
IMPORT_C ~CFsPluginFactory(); |
|
373 |
IMPORT_C virtual TInt Remove(); |
|
374 |
IMPORT_C void SetLibrary(RLibrary aLib); |
|
375 |
IMPORT_C RLibrary Library() const; |
|
376 |
public: |
|
377 |
/** |
|
36
538db54a451d
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
378 |
@internalTechnology |
538db54a451d
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
379 |
Installs the plugin factory |
0 | 380 |
@return KErrNone or one of the system wide errors |
381 |
*/ |
|
382 |
virtual TInt Install()=0; |
|
36
538db54a451d
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
383 |
/** |
0 | 384 |
@internalTechnology |
36
538db54a451d
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
385 |
Creates a new plugin |
0 | 386 |
@return plugin object |
387 |
*/ |
|
388 |
virtual CFsPlugin* NewPluginL()=0; |
|
36
538db54a451d
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
389 |
/** |
0 | 390 |
@internalTechnology |
391 |
Returns unique position of the plugin |
|
392 |
@return unique position of the plugin |
|
393 |
*/ |
|
394 |
virtual TInt UniquePosition()=0; |
|
395 |
public: |
|
396 |
TBool IsDriveSupported(TInt aDrive); |
|
397 |
inline TInt MountedPlugins(); |
|
398 |
inline TInt SupportedDrives(); //aSupportedDrives is a bit mask |
|
399 |
private: |
|
400 |
inline void IncrementMounted(); |
|
401 |
inline void DecrementMounted(); |
|
402 |
protected: |
|
403 |
TInt iSupportedDrives; |
|
404 |
inline void SetSupportedDrives(TInt aSupportedDrives); //aSupportedDrives is a bit mask |
|
405 |
private: |
|
406 |
TInt iMountedPlugins; |
|
407 |
TInt iUniquePos; |
|
408 |
RLibrary iLibrary; |
|
409 |
friend class FsPluginManager; |
|
410 |
}; |
|
411 |
||
412 |
/** |
|
413 |
A base class for File Server Plugins |
|
414 |
*/ |
|
415 |
class CFsPlugin : public CFsObject |
|
416 |
{ |
|
417 |
protected: |
|
418 |
||
419 |
/** Intercept attribute to specify the order of request handling */ |
|
420 |
enum TInterceptAtts |
|
421 |
{ |
|
422 |
EPreIntercept = 0x01, ///< handles the request before the next plugin in chain |
|
423 |
EPostIntercept = 0x02, ///< handles the request after the next plugin in chain |
|
424 |
EPrePostIntercept = EPreIntercept | EPostIntercept ///< covers both pre and post intercept |
|
425 |
}; |
|
426 |
public: |
|
427 |
IMPORT_C CFsPlugin(); |
|
428 |
IMPORT_C ~CFsPlugin(); |
|
429 |
inline TInt Drive(); |
|
430 |
inline void SetDrive(TInt aDrive); |
|
431 |
inline virtual TInt SessionDisconnect(CSessionFs* aSession); |
|
432 |
protected: |
|
433 |
IMPORT_C virtual void InitialiseL(); |
|
36
538db54a451d
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
434 |
IMPORT_C virtual TInt Deliver(TFsPluginRequest& aRequest); |
0 | 435 |
virtual TInt DoRequestL(TFsPluginRequest& aRequest) = 0; |
436 |
||
437 |
IMPORT_C virtual CFsPluginConn* NewPluginConnL(); |
|
438 |
||
439 |
IMPORT_C TInt RegisterIntercept(TInt aMessage, TInterceptAtts aInterceptAtts); |
|
440 |
IMPORT_C TInt UnregisterIntercept(TInt aMessage, TInterceptAtts aInterceptAtts); |
|
441 |
||
442 |
/** @prototype */ |
|
443 |
IMPORT_C TInt FileRead(TFsPluginRequest& aRequest, TDes8& aDes, TInt64 aPos); |
|
444 |
IMPORT_C TInt FileWrite(TFsPluginRequest& aRequest, const TDesC8& aDes, TInt64 aPos); |
|
445 |
IMPORT_C static TInt ClientRead(TFsPluginRequest& aRequest, TDes8& aDes,TInt aOffset=0); |
|
446 |
IMPORT_C static TInt ClientWrite(TFsPluginRequest& aRequest, const TDesC8& aDes,TInt aOffset=0); |
|
447 |
||
448 |
//Overloaded function - checks all types of TInterceptAtts |
|
449 |
TBool IsRegistered(TInt aMessage); |
|
450 |
TBool IsRegistered(TInt aMessage, TInterceptAtts aInterceptAtts); |
|
451 |
TBool IsPluginThread(CFsRequest& aMessage); |
|
452 |
TBool IsMounted(TInt aDrive); |
|
453 |
||
454 |
private: |
|
455 |
TInt DispatchOperation(TFsPluginRequest& aRequest, TDes8& aDes, TInt64 aPos, TInt aFunction); |
|
456 |
static TInt Complete(CFsRequest* aRequest, TInt aError); |
|
457 |
static TInt Complete(CFsRequest* aRequest); |
|
458 |
TInt WaitForRequest(); |
|
459 |
||
460 |
protected: |
|
461 |
TThreadId iThreadId; |
|
462 |
private: |
|
463 |
CPluginThread* iThreadP; |
|
464 |
TInt iDrive; |
|
465 |
||
466 |
/** |
|
467 |
The remaining space in this base class in release 9.1 is defined as follows: |
|
468 |
TUint8 iRegisteredIntercepts[EMaxClientOperations << 1]; 244 bytes |
|
469 |
TInt iUniquePos; 4 bytes |
|
36
538db54a451d
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
470 |
TOTAL 248 bytes |
0 | 471 |
where EMaxClientOperations = 122. |
472 |
||
473 |
Unfortunately, the remaining space in release 9.2+ WAS defined as follows: |
|
474 |
enum {KIntcArrSize = 123*2}; |
|
475 |
TUint8 iRegisteredIntercepts[KIntcArrSize]; 246 bytes |
|
476 |
2 bytes (padding) |
|
477 |
TInt iUniquePos; 4 bytes |
|
478 |
TOTAL: 252 bytes |
|
36
538db54a451d
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
479 |
|
538db54a451d
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
480 |
This meant that a 9.1-compiled plugin running on 9.2+ would have its first data |
0 | 481 |
member overwritten when the base class (CFsPlugin) wrote to iUniquePos. |
482 |
||
36
538db54a451d
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
483 |
To maintain Binary Compatibility (BC), we need to preserve both the (smaller) 9.1 |
538db54a451d
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
484 |
and (larger) 9.2+ class sizes. |
0 | 485 |
To allow 9.1 plugins to work unchanged on 9.2+ iUniquePos has been moved to BEFORE |
486 |
the iRegisteredIntercepts byte array |
|
487 |
||
36
538db54a451d
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
488 |
N.B. - the iRegisteredIntercepts array uses only 2 bits per function, so the |
538db54a451d
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
489 |
array size only needs to be >= EMaxClientOperations/4. |
0 | 490 |
*/ |
491 |
enum {KIntcArrSize = 132}; |
|
492 |
TInt iUniquePos; // 4 bytes |
|
493 |
TUint8 iRegisteredIntercepts[KIntcArrSize]; // 132 bytes |
|
494 |
TInt iLastError; // 4 bytes |
|
495 |
TInt iMountedOn; //bitmask // 4 bytes |
|
496 |
TUint iSpare[26]; // 104 bytes |
|
497 |
// extra 4 bytes to preserve BC with 9.1 plugins. Don't move ! |
|
498 |
const TUint iReadOnly; // 4 bytes |
|
499 |
// TOTAL: 252 |
|
500 |
friend class FsPluginManager; |
|
501 |
friend class CFsRequest; |
|
502 |
friend class CFsMessageRequest; |
|
503 |
friend class CFsInternalRequest; |
|
504 |
friend class CPluginThread; |
|
505 |
friend class TFsDismountPlugin; |
|
506 |
friend class TPluginSessionHelper; |
|
507 |
friend class TFsDirOpen; //For access to TInterceptAtts |
|
508 |
}; |
|
509 |
||
510 |
class TPluginSessionHelper |
|
511 |
{ |
|
512 |
public: |
|
513 |
TPluginSessionHelper(); |
|
514 |
TPluginSessionHelper(TFsPluginRequest* aRequest, TBool aDirectToDrive); |
|
515 |
TInt CreateSubSession(const RSessionBase& aSession,TInt aFunction,const TIpcArgs& aArgs, TInt* aReply); |
|
516 |
TInt SendReceive(TInt aFunction, const TIpcArgs& aArgs) const; |
|
517 |
TInt SendReceive(TInt aFunction, const TIpcArgs& aArgs, TInt aSubSessionHandle) const; |
|
518 |
inline TFsPluginRequest* Request(); |
|
519 |
private: |
|
520 |
TInt Dispatch(TInt aFunction, TIpcArgs& aArgs) const; |
|
521 |
private: |
|
522 |
CFsPlugin* iPlugin; // owner; used for setting iCurrentPlugin in CFsMessageRequest |
|
523 |
CSessionFs* iSession; |
|
524 |
RLocalMessage iMessage; |
|
525 |
TBool iDirectToDrive; |
|
526 |
TFsPluginRequest* iRequest; |
|
527 |
TUint iSpare[4]; |
|
528 |
}; |
|
529 |
||
530 |
/** |
|
36
538db54a451d
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
531 |
A class for making file server request internally from within a |
538db54a451d
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
532 |
file server plugin. |
538db54a451d
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
533 |
|
538db54a451d
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
534 |
See also RFilePlugin and RDirPlugin. |
538db54a451d
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
535 |
|
0 | 536 |
@publishedPartner |
537 |
@released |
|
538 |
*/ |
|
539 |
class RFsPlugin : private RFs |
|
540 |
{ |
|
541 |
public: |
|
542 |
IMPORT_C RFsPlugin(TFsPluginRequest& aRequest, TBool aDirectToDrive = EFalse); |
|
543 |
IMPORT_C ~RFsPlugin(); |
|
544 |
||
545 |
IMPORT_C TInt Connect(); |
|
546 |
IMPORT_C void Close(); |
|
547 |
||
548 |
IMPORT_C TInt Delete(const TDesC& aName); |
|
549 |
IMPORT_C TInt Rename(const TDesC& anOldName,const TDesC& aNewName); |
|
550 |
IMPORT_C TInt Replace(const TDesC& anOldName,const TDesC& aNewName); |
|
551 |
IMPORT_C TInt Entry(const TDesC& aName,TEntry& anEntry) const; |
|
552 |
IMPORT_C TInt SetEntry(const TDesC& aName,const TTime& aTime,TUint aSetAttMask,TUint aClearAttMask); |
|
553 |
IMPORT_C TInt ReadFileSection(const TDesC& aName,TInt64 aPos,TDes8& aDes,TInt aLength) const; |
|
36
538db54a451d
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
554 |
IMPORT_C TInt Volume(TVolumeInfo &aVol,TInt aDrive=KDefaultDrive) const; |
0 | 555 |
|
556 |
protected: |
|
557 |
TInt SendReceive(TInt aFunction,const TIpcArgs& aArgs) const; |
|
558 |
||
559 |
private: |
|
560 |
RFsPlugin(); |
|
561 |
RFsPlugin(const RFsPlugin&); |
|
562 |
RFsPlugin& operator=(const RFsPlugin&); |
|
563 |
void SetHandle(TInt aHandle); |
|
564 |
||
565 |
private: |
|
566 |
TPluginSessionHelper iSessionHelper; |
|
567 |
friend class RFs; |
|
568 |
}; |
|
569 |
||
570 |
/** |
|
571 |
@publishedPartner |
|
572 |
@released |
|
573 |
*/ |
|
574 |
#ifndef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
|
575 |
class RFilePlugin : private RFile |
|
576 |
#else |
|
577 |
class RFilePlugin : private RFile64 |
|
578 |
#endif |
|
579 |
{ |
|
580 |
public: |
|
581 |
IMPORT_C RFilePlugin(TFsPluginRequest& aRequest, TBool aDirectToDrive = EFalse); |
|
582 |
IMPORT_C ~RFilePlugin(); |
|
583 |
||
584 |
// open a NEW file using same session as passed request |
|
585 |
IMPORT_C TInt Open(const TDesC& aName,TUint aMode); |
|
586 |
IMPORT_C TInt Create(const TDesC& aName,TUint aFileMode); |
|
587 |
IMPORT_C TInt Replace(const TDesC& aName,TUint aFileMode); |
|
588 |
IMPORT_C TInt Temp(const TDesC& aPath,TFileName& aName,TUint aFileMode); |
|
36
538db54a451d
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
589 |
|
0 | 590 |
// re-open SAME file as client's request |
591 |
IMPORT_C TInt AdoptFromClient(); |
|
592 |
||
593 |
// Transfer the plugin's open file to the client |
|
594 |
IMPORT_C TInt TransferToClient(); |
|
36
538db54a451d
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
595 |
|
0 | 596 |
IMPORT_C void Close(); |
597 |
||
598 |
// RFile overloads |
|
599 |
IMPORT_C TInt Read(TInt64 aPos,TDes8& aDes) const; |
|
600 |
IMPORT_C TInt Read(TInt64 aPos,TDes8& aDes,TInt aLength) const; |
|
601 |
IMPORT_C TInt Write(TInt64 aPos,const TDesC8& aDes); |
|
602 |
IMPORT_C TInt Write(TInt64 aPos,const TDesC8& aDes,TInt aLength); |
|
603 |
IMPORT_C TInt Lock(TInt64 aPos,TInt64 aLength) const; |
|
604 |
IMPORT_C TInt UnLock(TInt64 aPos,TInt64 aLength) const; |
|
605 |
IMPORT_C TInt Seek(TSeek aMode,TInt64& aPos) const; |
|
606 |
IMPORT_C TInt Flush(); |
|
607 |
IMPORT_C TInt Size(TInt64& aSize) const; |
|
608 |
IMPORT_C TInt SetSize(TInt64 aSize); |
|
609 |
IMPORT_C TInt Att(TUint& aAttValue) const; |
|
610 |
IMPORT_C TInt SetAtt(TUint aSetAttMask,TUint aClearAttMask); |
|
611 |
IMPORT_C TInt Modified(TTime& aTime) const; |
|
612 |
IMPORT_C TInt SetModified(const TTime& aTime); |
|
613 |
IMPORT_C TInt Set(const TTime& aTime,TUint aSetAttMask,TUint aClearAttMask); |
|
614 |
IMPORT_C TInt ChangeMode(TFileMode aNewMode); |
|
615 |
IMPORT_C TInt Rename(const TDesC& aNewName); |
|
616 |
||
617 |
protected: |
|
618 |
// RSubSessionBase overrides |
|
619 |
TInt CreateSubSession(const RSessionBase& aSession,TInt aFunction,const TIpcArgs& aArgs); |
|
620 |
TInt SendReceive(TInt aFunction,const TIpcArgs& aArgs) const; |
|
621 |
void CloseSubSession(TInt aFunction); |
|
622 |
||
623 |
private: |
|
624 |
RFilePlugin(); |
|
625 |
RFilePlugin(const RFilePlugin&); |
|
626 |
RFilePlugin& operator=(const RFilePlugin&); |
|
627 |
||
628 |
void SetHandle(TInt aHandle); |
|
629 |
void SetSubSessionHandle(TInt aHandle); |
|
630 |
||
631 |
private: |
|
632 |
TPluginSessionHelper iSessionHelper; |
|
633 |
friend class RFile; |
|
634 |
#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
|
635 |
friend class RFile64; |
|
636 |
#endif |
|
637 |
}; |
|
638 |
||
639 |
/** |
|
640 |
@publishedPartner |
|
641 |
@released |
|
642 |
*/ |
|
643 |
class RDirPlugin : private RDir |
|
644 |
{ |
|
645 |
public: |
|
646 |
IMPORT_C RDirPlugin(TFsPluginRequest& aRequest, TBool aDirectToDrive = EFalse); |
|
647 |
IMPORT_C ~RDirPlugin(); |
|
648 |
||
649 |
IMPORT_C TInt Open(const TDesC& aMatchName,const TUidType& aUidType); |
|
650 |
IMPORT_C TInt Open(const TDesC& aMatchName,TUint anAttMask); |
|
651 |
IMPORT_C void Close(); |
|
652 |
||
653 |
/** |
|
654 |
Plugin authors should pass in a TRawEntryArray if their intent is to modify the data. |
|
655 |
*/ |
|
656 |
IMPORT_C TInt Read(TEntryArray& aArray); |
|
657 |
IMPORT_C TInt Read(TEntry& aEntry); |
|
658 |
||
659 |
protected: |
|
660 |
// RSubSessionBase overrides |
|
661 |
TInt CreateSubSession(const RSessionBase& aSession,TInt aFunction,const TIpcArgs& aArgs); |
|
662 |
TInt SendReceive(TInt aFunction,const TIpcArgs& aArgs) const; |
|
663 |
void CloseSubSession(TInt aFunction); |
|
664 |
||
665 |
private: |
|
666 |
RDirPlugin(); |
|
667 |
RDirPlugin(const RDirPlugin&); |
|
668 |
RDirPlugin& operator=(const RDirPlugin&); |
|
669 |
||
670 |
void SetHandle(TInt aHandle); |
|
671 |
void SetSubSessionHandle(TInt aHandle); |
|
672 |
||
673 |
private: |
|
674 |
TPluginSessionHelper iSessionHelper; |
|
675 |
friend class RDir; |
|
676 |
}; |
|
677 |
||
678 |
||
679 |
class CFsRequest; |
|
680 |
class CFsPluginConnRequest : public CBase |
|
681 |
{ |
|
682 |
public: |
|
683 |
CFsPluginConnRequest(CFsPluginConn* aPluginConn); |
|
684 |
public: |
|
685 |
inline TInt Function() const; |
|
686 |
inline TDes8* Param1() const; |
|
687 |
inline TDes8* Param2() const; |
|
688 |
inline void WriteParam1L(const TDesC8& aDes) const; |
|
689 |
inline void WriteParam2L(const TDesC8& aDes) const; |
|
690 |
inline void ReadParam1L(TDes8& aDes) const; |
|
691 |
inline void ReadParam2L(TDes8& aDes) const; |
|
692 |
inline const RMessagePtr2& Message() const; |
|
693 |
public: |
|
694 |
TInt DoControl(); |
|
695 |
void DoRequest(); |
|
696 |
inline void Complete(TInt aError); |
|
697 |
public: |
|
698 |
TInt InitControl(CFsRequest* aRequest); |
|
699 |
TInt InitRequest(CFsRequest* aRequest); |
|
36
538db54a451d
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
700 |
private: |
0 | 701 |
TDblQueLink iLink; |
702 |
CFsPluginConn& iPluginConn; |
|
703 |
TInt iFunction; |
|
704 |
TDes8* iParam1; |
|
705 |
TDes8* iParam2; |
|
706 |
public: |
|
707 |
RMessagePtr2 iMessage; |
|
708 |
||
709 |
friend class TPluginConnRequestQue; |
|
710 |
friend class CFsPluginConn; |
|
711 |
}; |
|
712 |
||
713 |
class TPluginConnRequestQue |
|
714 |
{ |
|
715 |
public: |
|
716 |
TPluginConnRequestQue(); |
|
717 |
~TPluginConnRequestQue(); |
|
718 |
void DoAddRequest(CFsPluginConnRequest* aRequest); |
|
719 |
IMPORT_C void DoCancelAll(TInt aCompletionCode); |
|
720 |
protected: |
|
721 |
TDblQue<CFsPluginConnRequest> iHeader; |
|
722 |
}; |
|
723 |
||
724 |
/** |
|
725 |
Plugin connection object |
|
726 |
*/ |
|
727 |
class CFsPluginConn : public CFsObject |
|
728 |
{ |
|
729 |
public: |
|
730 |
IMPORT_C CFsPluginConn(); |
|
731 |
IMPORT_C ~CFsPluginConn(); |
|
732 |
||
733 |
virtual TInt DoControl(CFsPluginConnRequest& aRequest) = 0; |
|
734 |
virtual void DoRequest(CFsPluginConnRequest& aRequest) = 0; |
|
735 |
virtual void DoCancel(TInt aReqMask) = 0; |
|
736 |
||
737 |
inline CFsPlugin* Plugin() const; |
|
738 |
inline TThreadId ClientId() const; |
|
739 |
private: |
|
740 |
IMPORT_C void Close(); |
|
741 |
CFsPlugin* iPluginP; |
|
742 |
TThreadId iClientId; |
|
743 |
public: |
|
744 |
TPluginConnRequestQue iRequestQue; |
|
745 |
friend class FsPluginManager; |
|
746 |
}; |
|
747 |
||
748 |
#include <f32plugin.inl> |
|
749 |
||
750 |
#endif // __F32PLUGIN_H |
|
751 |