1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/kernelhwsrv/userlibandfileserver/fileserver/inc/F32plugin.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,751 @@
1.4 +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of the License "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// f32\inc\f32plugin.h
1.18 +//
1.19 +// WARNING: This file contains some APIs which are internal and are subject
1.20 +// to change without notice. Such APIs should therefore not be used
1.21 +// outside the Kernel and Hardware Services package.
1.22 +//
1.23 +
1.24 +/**
1.25 + @file
1.26 + @internalTechnology
1.27 +*/
1.28 +
1.29 +
1.30 +#if !defined(__F32PLUGIN_H__)
1.31 +#define __F32PLUGIN_H__
1.32 +
1.33 +#include <f32file.h>
1.34 +#include <f32file_private.h>
1.35 +#include <f32fsys.h>
1.36 +
1.37 +const TInt KPluginMessageForward = 1; ///< Returned from ::Dispatch() to indicate that a request has been processed synchronously and should be passed down the stack.
1.38 +const TInt KPluginMessageComplete = 2; ///< Returned from ::Dispatch() to indicate that a request has been processed synchronously and should be passed back up the stack.
1.39 +
1.40 +const TInt KCountNeeded=KMinTInt;
1.41 +
1.42 +/**
1.43 +List of file server operations
1.44 +*/
1.45 +enum TFsMessage
1.46 + {
1.47 + EFsAddFileSystem, ///< Adds a file system
1.48 + EFsRemoveFileSystem, ///< Removes a file system
1.49 + EFsMountFileSystem, ///< Mounts a file system
1.50 + EFsNotifyChange, ///< Notifies file and/or directory change
1.51 + EFsNotifyChangeCancel, ///< Cancels change notification
1.52 + EFsDriveList, ///< Gets a list of the available drive
1.53 + EFsDrive, ///< Gets information about a drive and the medium mounted on it
1.54 + EFsVolume, ///< Gets volume information for a formatted device
1.55 + EFsSetVolume, ///< Sets the label for a volume
1.56 + EFsSubst, ///< Gets the path assigned to a drive letter
1.57 + EFsSetSubst, ///< -- 10, Assigns a path to a drive letter
1.58 + EFsRealName, ///< Gets the real name of a file
1.59 + EFsDefaultPath, ///< Gets the system default path
1.60 + EFsSetDefaultPath, ///< Sets the system default path
1.61 + EFsSessionPath, ///< Gets the session path
1.62 + EFsSetSessionPath, ///< Sets the session path for the current file server client
1.63 + EFsMkDir, ///< Makes directory
1.64 + EFsRmDir, ///< Removes a directory
1.65 + EFsParse, ///< Parses a filename specification
1.66 + EFsDelete, ///< Deletes file
1.67 + EFsRename, ///< -- 20 Renames a single file or directory
1.68 + EFsReplace, ///< Replaces a single file with another
1.69 + EFsEntry, ///< Gets a file's attributes
1.70 + EFsSetEntry, ///< Sets both the attributes and the last modified date and time for a file or directory
1.71 + EFsGetDriveName, ///< Gets the name of a drive
1.72 + EFsSetDriveName, ///< Sets the name of a drive
1.73 + EFsFormatSubClose, ///< Closes the Format subsession
1.74 + EFsDirSubClose, ///< Closes the directory.
1.75 + EFsFileSubClose, ///< Closes the file
1.76 + EFsRawSubClose, ///< Closes the direct access channel to the disk
1.77 + EFsFileOpen, ///< -- 30 Opens file
1.78 + EFsFileCreate, ///< Creates and opens a new file
1.79 + EFsFileReplace, ///< Replaces a file of the same name or creates a new file
1.80 + EFsFileTemp, ///< Creates and opens a temporary file
1.81 + EFsFileRead, ///< Reads from the file
1.82 + EFsFileWrite, ///< Writes to the file
1.83 + EFsFileLock, ///< Locks a region within the file
1.84 + EFsFileUnLock, ///< Unlocks a region within the file
1.85 + EFsFileSeek, ///< Sets the the current file position
1.86 + EFsFileFlush, ///< Commits data to the storage device
1.87 + EFsFileSize, ///< -- 40 Gets the current file size
1.88 + EFsFileSetSize, ///< Sets the file size
1.89 + EFsFileAtt, ///< Gets the file's attributes
1.90 + EFsFileSetAtt, ///< Sets or clears file attributes
1.91 + EFsFileModified, ///< Gets local date and time the file was last modified
1.92 + EFsFileSetModified, ///< Sets the date and time the file was last modified
1.93 + EFsFileSet, ///< Sets the file’s attributes, last modification date/time
1.94 + EFsFileChangeMode, ///< Switches an open file's access mode
1.95 + EFsFileRename, ///< Renames a file
1.96 + EFsDirOpen, ///< Opens a directory
1.97 + EFsDirReadOne, ///< -- 50 Reads a single directory entry
1.98 + EFsDirReadPacked, ///< Reads all filtered directory entries
1.99 + EFsFormatOpen, ///< Opens a device for formatting
1.100 + EFsFormatNext, ///< Executes the next format step
1.101 + EFsRawDiskOpen, ///< Opens a direct access channel to the disk */
1.102 + EFsRawDiskRead, ///< Reads directly from the disk
1.103 + EFsRawDiskWrite, ///< Writes directly to the disk
1.104 + EFsResourceCountMarkStart, ///< Marks the start of resource count checking
1.105 + EFsResourceCountMarkEnd, ///< Ends resource count checking
1.106 + EFsResourceCount, ///< Gets the number of currently open resources
1.107 + EFsCheckDisk, ///< -- 60 Checks the integrity of the disk on the specified drive
1.108 + EFsGetShortName, ///< Gets the short filename
1.109 + EFsGetLongName, ///< Gets the long filename
1.110 + EFsIsFileOpen, ///< Tests whether a file is open
1.111 + EFsListOpenFiles, ///< get a list of open files */
1.112 + EFsGetNotifyUser, ///< Tests user notification of file access failure is in effect
1.113 + EFsSetNotifyUser, ///< Sets if the user should be notified of file access failure
1.114 + EFsIsFileInRom, ///< Gets a pointer to the specified file, if it is in ROM
1.115 + EFsIsValidName, ///< Tests whether a filename and path are syntactically correct
1.116 + EFsDebugFunction, ///< Different debugging info
1.117 + EFsReadFileSection, ///< -- 70 Reads data from a file without opening it
1.118 + EFsNotifyChangeEx, ///< Requests a notification of change to files or directories
1.119 + EFsNotifyChangeCancelEx, ///< Cancels all outstanding requests for notification of change
1.120 + EFsDismountFileSystem, ///< Dismounts the file system from the specified drive
1.121 + EFsFileSystemName, ///< Gets the name of the file system mounted on the specified drive
1.122 + EFsScanDrive, ///< Checks the specified drive for specific errors and corrects them
1.123 + EFsControlIo, ///< General purpose test interface
1.124 + EFsLockDrive, ///< Locks a MultiMedia card in the specified drive
1.125 + EFsUnlockDrive, ///< Unlocks the MultiMedia card in the specified drive
1.126 + EFsClearPassword, ///< Clears the password from the locked MultiMedia card
1.127 + EFsNotifyDiskSpace, ///< -- 80 Disk space change notification
1.128 + EFsNotifyDiskSpaceCancel, ///< Cancels a specific outstanding notification
1.129 + EFsFileDrive, ///< Gets drive information on which this file resides
1.130 + EFsRemountDrive, ///< Forces a remount of the specified drive
1.131 + EFsMountFileSystemScan, ///< Mounts a file system and performs a scan on a drive
1.132 + EFsSessionToPrivate, ///< Sets the session path to point to the private path
1.133 + EFsPrivatePath, ///< Creates the text defining the private path
1.134 + EFsCreatePrivatePath, ///< Creates the private path for a process
1.135 + EFsAddExtension, ///< Adds the specified extension
1.136 + EFsMountExtension, ///< Mounts the the specified extension
1.137 + EFsDismountExtension, ///< -- 90 Dismounts the specified extension
1.138 + EFsRemoveExtension, ///< Removes the specified extension
1.139 + EFsExtensionName, ///< Gets the name of the extension on the specified drive
1.140 + EFsStartupInitComplete, ///< Noifies the file server of startup initialisation completion
1.141 + EFsSetLocalDriveMapping, ///< Set the local drive mapping
1.142 + EFsFinaliseDrive, ///< Finalise a specific drive
1.143 + EFsFileDuplicate, ///< Makes a duplicate of this file handle
1.144 + EFsFileAdopt, ///< Adopts an already open file
1.145 + EFsSwapFileSystem, ///< Swaps file systems
1.146 + EFsErasePassword, ///< Erase the password from the locked MultiMedia card
1.147 + EFsReserveDriveSpace, ///< -- 100 Reserves an area of a drive
1.148 + EFsGetReserveAccess, ///< Get exclusive access to reserved area
1.149 + EFsReleaseReserveAccess, ///< Release exclusive access to reserved area
1.150 + EFsFileName, ///< Gets the final part of a filename
1.151 + EFsGetMediaSerialNumber, ///< Gets the serial number of media
1.152 + EFsFileFullName, ///< Gets the full filename
1.153 + EFsAddPlugin, ///< Adds the specified plugin
1.154 + EFsRemovePlugin, ///< Removes the specified plugin
1.155 + EFsMountPlugin, ///< Mounts the specified plugin
1.156 + EFsDismountPlugin, ///< Dismounts the specified plugin
1.157 + EFsPluginName, ///<-- 110 Gets a plugin's name in specific position and drive
1.158 + EFsPluginOpen, ///< Opens the plugin
1.159 + EFsPluginSubClose, ///< Closes the plugin
1.160 + EFsPluginDoRequest, ///< Issues an asynchronous plugin request
1.161 + EFsPluginDoControl, ///< Issues a synchronous plugin request
1.162 + EFsPluginDoCancel, ///< Cancels an synchronous plugin request
1.163 + EFsNotifyDismount, ///< Issues a request to asynchronously dismount the file system
1.164 + EFsNotifyDismountCancel, ///< Cancels a request to asynchronously dismount the file system
1.165 + EFsAllowDismount, ///< Notifies that it is safe to dismount the file system
1.166 + EFsSetStartupConfiguration, ///< Configures file server at startup
1.167 + EFsFileReadCancel, ///< -- 120 Cancels an outstanding asynchronous read request
1.168 + EFsAddCompositeMount, ///< Add a mount to the composite file system
1.169 + EFsSetSessionFlags, ///< Set/Clear session specific flags
1.170 + EFsSetSystemDrive, ///< Set SystemDrive
1.171 + EFsBlockMap, ///< Fetches the BlockMap of a file
1.172 + EFsUnclamp, ///< Re-enable modification of a specified file in storage media
1.173 + EFsFileClamp, ///< Disable modification of a specified file in storage media
1.174 + EFsQueryVolumeInfoExt, ///< Query interface to retrieve extended volume information
1.175 + EFsInitialisePropertiesFile,///< Read in the F32 properties file provided by ESTART
1.176 + EFsFileWriteDirty, ///< Writes dirty data to disk. Used when write caching enabled
1.177 + EFsSynchroniseDriveThread, ///< -- 130 Synchronises the asynchronous operation which executes in driver thread
1.178 + EFsAddProxyDrive, ///< Loads a proxy drive
1.179 + EFsRemoveProxyDrive, ///< Unloads a proxy drive
1.180 + EFsMountProxyDrive, ///< Mounts a proxy drive
1.181 + EFsDismountProxyDrive, ///< Dismounts a proxy drive
1.182 + EFsNotificationOpen, ///< Opens the notification
1.183 + EFsNotificationBuffer, ///< Communicates buffer to file server
1.184 + EFsNotificationRequest, ///< Sends the notification request
1.185 + EFsNotificationCancel, ///< Cancels the notification request
1.186 + EFsNotificationSubClose, ///< Closes the notification
1.187 + EFsNotificationAdd, ///< -- 140 Adds filter to the server, comprising a path and notification type
1.188 + EFsNotificationRemove, ///< Removes filters from Server-Side
1.189 + EFsLoadCodePage, ///< Loads a code page library
1.190 + EMaxClientOperations ///< This must always be the last operation insert above
1.191 + };
1.192 +
1.193 +class CFsRequest;
1.194 +
1.195 +/**
1.196 +Request wrapper for plugins
1.197 +*/
1.198 +class TFsPluginRequest
1.199 + {
1.200 +public:
1.201 +
1.202 + /**
1.203 + @publishedPartner
1.204 + @released
1.205 +
1.206 + Used for getting parameters from
1.207 + a CFsRequest by a F32 plugin.
1.208 + */
1.209 + enum TF32ArgType
1.210 + {
1.211 + EPosition,
1.212 + ELength,
1.213 + EData,
1.214 + ESize,
1.215 + EName,
1.216 + ENewName,
1.217 + EEntry,
1.218 + ETime,
1.219 + ESetAtt,
1.220 + EClearAtt,
1.221 + EMode,
1.222 + EAtt,
1.223 + EAttMask,
1.224 + EUid,
1.225 + EEntryArray,
1.226 + ENewPosition,
1.227 + EVolumeInfo
1.228 + };
1.229 +
1.230 + IMPORT_C TFsPluginRequest(CFsRequest* aRequest);
1.231 +
1.232 + /**
1.233 + @publishedPartner
1.234 + @released
1.235 +
1.236 + Get the current Function number, as defined in TFsMessage
1.237 + */
1.238 + IMPORT_C TInt Function() const;
1.239 +
1.240 + /**
1.241 + @publishedPartner
1.242 + @released
1.243 +
1.244 + Returns the drive number of the current request
1.245 + */
1.246 + IMPORT_C TInt DriveNumber() const;
1.247 + IMPORT_C TParse& Src() const;
1.248 + IMPORT_C TParse& Dest() const;
1.249 + IMPORT_C TDrive* Drive() const;
1.250 + IMPORT_C TDrive* SubstedDrive() const;
1.251 + IMPORT_C const RMessage2& Message() const;
1.252 + IMPORT_C CFsRequest* Request() const;
1.253 + IMPORT_C TUint ScratchValue() const;
1.254 + IMPORT_C TInt64 ScratchValue64() const;
1.255 + IMPORT_C TBool IsPostOperation() const;
1.256 +
1.257 + /**
1.258 + @publishedPartner
1.259 + @released
1.260 +
1.261 + Utility function for returning a TInt type of TF32ArgType value from the current request.
1.262 + i.e. ELength.
1.263 +
1.264 + To obtain EPosition, authors should use ::Read(TF32ArgType,TInt64&)
1.265 + */
1.266 + IMPORT_C TInt Read(TF32ArgType aType, TInt& aVal);
1.267 +
1.268 + /**
1.269 + @publishedPartner
1.270 + @released
1.271 +
1.272 + Utility function for returning a TUint type of TF32ArgType value from the current request.
1.273 +
1.274 + To obtain EPosition, authors should use ::Read(TF32ArgType,TInt64&)
1.275 + */
1.276 + IMPORT_C TInt Read(TF32ArgType aType, TUint& aVal);
1.277 +
1.278 + /**
1.279 + @publishedPartner
1.280 + @released
1.281 +
1.282 + Utility function for returning a TInt64 type of TF32ArgType value from the current request.
1.283 + i.e. EPosition.
1.284 + */
1.285 + IMPORT_C TInt Read(TF32ArgType aType, TInt64& aVal);
1.286 +
1.287 + /**
1.288 + @publishedPartner
1.289 + @released
1.290 +
1.291 + Utility function for receving descriptor or packaged paramters of the current request.
1.292 + For non-descriptor types such a TEntry, plugin authors should pass an object of type TPckg<TEntry> in to aDes.
1.293 + */
1.294 + IMPORT_C TInt Read(TF32ArgType aType, TDes8& aDes, TInt aOffset = 0);
1.295 +
1.296 + /**
1.297 + @publishedPartner
1.298 + @released
1.299 +
1.300 + Utility function for receving descriptor or packaged paramters of the current request.
1.301 + For non-descriptor types such a TEntry, plugin authors should pass an object of type TPckg<TEntry> in to aDes.
1.302 + */
1.303 + IMPORT_C TInt Read(TF32ArgType aType, TDes16& aDes, TInt aOffset = 0);
1.304 +
1.305 + /**
1.306 + @publishedPartner
1.307 + @released
1.308 +
1.309 + Utilty function for writing data back to the request.
1.310 + Non-descriptor values should be packaged i.e TPckg<TUidType>
1.311 + */
1.312 + IMPORT_C TInt Write(TF32ArgType aType, const TDesC8& aDes, TInt aOffset = 0);
1.313 +
1.314 + /**
1.315 + @publishedPartner
1.316 + @released
1.317 +
1.318 + Utilty function for writing data back to the request.
1.319 + Non-descriptor values should be packaged i.e TPckg<TUidType>
1.320 + */
1.321 + IMPORT_C TInt Write(TF32ArgType aType, const TDesC16& aDes, TInt aOffset = 0);
1.322 +
1.323 + /**
1.324 + @publishedPartner
1.325 + @released
1.326 + */
1.327 + IMPORT_C TInt FileName(TDes& aName);
1.328 +
1.329 + /**
1.330 + @publishedPartner
1.331 + @released
1.332 +
1.333 + When plugin authors perform early completion of read or write requests, then SetSharePos should be called in order to
1.334 + update the share position to the client.
1.335 + */
1.336 + IMPORT_C TInt SetSharePos(TInt64& aPos);
1.337 +
1.338 +private:
1.339 + TInt ClientSubSessionHandle(TInt& aHandle);
1.340 + TInt ShareFromClientHandle(CFileShare*& aShare);
1.341 +
1.342 + void NameFromShare(CFileShare& aFileShare, TDes& aName);
1.343 +
1.344 +private:
1.345 + CFsRequest* iFsRequest;
1.346 +
1.347 + friend class RFilePlugin;
1.348 + };
1.349 +
1.350 +/**
1.351 +@publishedPartner
1.352 +@released
1.353 +
1.354 +Helper class for plugins to use to access TEntryArray data
1.355 +*/
1.356 +class TRawEntryArray : public TEntryArray
1.357 + {
1.358 +public:
1.359 + IMPORT_C TDes8& Buf();
1.360 + IMPORT_C void SetBuf(TDes8& aBuf);
1.361 + IMPORT_C TInt EntrySize(TInt aIdx);
1.362 + };
1.363 +
1.364 +class CFsPlugin;
1.365 +class CPluginThread;
1.366 +class CFsPluginConn;
1.367 +
1.368 +/**
1.369 +Plugin factory class. It is created when RFs::AddPlugin is called.
1.370 +*/
1.371 +class CFsPluginFactory : public CFsObject
1.372 + {
1.373 +public:
1.374 + IMPORT_C CFsPluginFactory();
1.375 + IMPORT_C ~CFsPluginFactory();
1.376 + IMPORT_C virtual TInt Remove();
1.377 + IMPORT_C void SetLibrary(RLibrary aLib);
1.378 + IMPORT_C RLibrary Library() const;
1.379 +public:
1.380 + /**
1.381 + @internalTechnology
1.382 + Installs the plugin factory
1.383 + @return KErrNone or one of the system wide errors
1.384 + */
1.385 + virtual TInt Install()=0;
1.386 + /**
1.387 + @internalTechnology
1.388 + Creates a new plugin
1.389 + @return plugin object
1.390 + */
1.391 + virtual CFsPlugin* NewPluginL()=0;
1.392 + /**
1.393 + @internalTechnology
1.394 + Returns unique position of the plugin
1.395 + @return unique position of the plugin
1.396 + */
1.397 + virtual TInt UniquePosition()=0;
1.398 +public:
1.399 + TBool IsDriveSupported(TInt aDrive);
1.400 + inline TInt MountedPlugins();
1.401 + inline TInt SupportedDrives(); //aSupportedDrives is a bit mask
1.402 +private:
1.403 + inline void IncrementMounted();
1.404 + inline void DecrementMounted();
1.405 +protected:
1.406 + TInt iSupportedDrives;
1.407 + inline void SetSupportedDrives(TInt aSupportedDrives); //aSupportedDrives is a bit mask
1.408 +private:
1.409 + TInt iMountedPlugins;
1.410 + TInt iUniquePos;
1.411 + RLibrary iLibrary;
1.412 + friend class FsPluginManager;
1.413 + };
1.414 +
1.415 +/**
1.416 + A base class for File Server Plugins
1.417 +*/
1.418 +class CFsPlugin : public CFsObject
1.419 + {
1.420 +protected:
1.421 +
1.422 + /** Intercept attribute to specify the order of request handling */
1.423 + enum TInterceptAtts
1.424 + {
1.425 + EPreIntercept = 0x01, ///< handles the request before the next plugin in chain
1.426 + EPostIntercept = 0x02, ///< handles the request after the next plugin in chain
1.427 + EPrePostIntercept = EPreIntercept | EPostIntercept ///< covers both pre and post intercept
1.428 + };
1.429 +public:
1.430 + IMPORT_C CFsPlugin();
1.431 + IMPORT_C ~CFsPlugin();
1.432 + inline TInt Drive();
1.433 + inline void SetDrive(TInt aDrive);
1.434 + inline virtual TInt SessionDisconnect(CSessionFs* aSession);
1.435 +protected:
1.436 + IMPORT_C virtual void InitialiseL();
1.437 + IMPORT_C virtual TInt Deliver(TFsPluginRequest& aRequest);
1.438 + virtual TInt DoRequestL(TFsPluginRequest& aRequest) = 0;
1.439 +
1.440 + IMPORT_C virtual CFsPluginConn* NewPluginConnL();
1.441 +
1.442 + IMPORT_C TInt RegisterIntercept(TInt aMessage, TInterceptAtts aInterceptAtts);
1.443 + IMPORT_C TInt UnregisterIntercept(TInt aMessage, TInterceptAtts aInterceptAtts);
1.444 +
1.445 + /** @prototype */
1.446 + IMPORT_C TInt FileRead(TFsPluginRequest& aRequest, TDes8& aDes, TInt64 aPos);
1.447 + IMPORT_C TInt FileWrite(TFsPluginRequest& aRequest, const TDesC8& aDes, TInt64 aPos);
1.448 + IMPORT_C static TInt ClientRead(TFsPluginRequest& aRequest, TDes8& aDes,TInt aOffset=0);
1.449 + IMPORT_C static TInt ClientWrite(TFsPluginRequest& aRequest, const TDesC8& aDes,TInt aOffset=0);
1.450 +
1.451 + //Overloaded function - checks all types of TInterceptAtts
1.452 + TBool IsRegistered(TInt aMessage);
1.453 + TBool IsRegistered(TInt aMessage, TInterceptAtts aInterceptAtts);
1.454 + TBool IsPluginThread(CFsRequest& aMessage);
1.455 + TBool IsMounted(TInt aDrive);
1.456 +
1.457 +private:
1.458 + TInt DispatchOperation(TFsPluginRequest& aRequest, TDes8& aDes, TInt64 aPos, TInt aFunction);
1.459 + static TInt Complete(CFsRequest* aRequest, TInt aError);
1.460 + static TInt Complete(CFsRequest* aRequest);
1.461 + TInt WaitForRequest();
1.462 +
1.463 +protected:
1.464 + TThreadId iThreadId;
1.465 +private:
1.466 + CPluginThread* iThreadP;
1.467 + TInt iDrive;
1.468 +
1.469 + /**
1.470 + The remaining space in this base class in release 9.1 is defined as follows:
1.471 + TUint8 iRegisteredIntercepts[EMaxClientOperations << 1]; 244 bytes
1.472 + TInt iUniquePos; 4 bytes
1.473 + TOTAL 248 bytes
1.474 + where EMaxClientOperations = 122.
1.475 +
1.476 + Unfortunately, the remaining space in release 9.2+ WAS defined as follows:
1.477 + enum {KIntcArrSize = 123*2};
1.478 + TUint8 iRegisteredIntercepts[KIntcArrSize]; 246 bytes
1.479 + 2 bytes (padding)
1.480 + TInt iUniquePos; 4 bytes
1.481 + TOTAL: 252 bytes
1.482 +
1.483 + This meant that a 9.1-compiled plugin running on 9.2+ would have its first data
1.484 + member overwritten when the base class (CFsPlugin) wrote to iUniquePos.
1.485 +
1.486 + To maintain Binary Compatibility (BC), we need to preserve both the (smaller) 9.1
1.487 + and (larger) 9.2+ class sizes.
1.488 + To allow 9.1 plugins to work unchanged on 9.2+ iUniquePos has been moved to BEFORE
1.489 + the iRegisteredIntercepts byte array
1.490 +
1.491 + N.B. - the iRegisteredIntercepts array uses only 2 bits per function, so the
1.492 + array size only needs to be >= EMaxClientOperations/4.
1.493 + */
1.494 + enum {KIntcArrSize = 132};
1.495 + TInt iUniquePos; // 4 bytes
1.496 + TUint8 iRegisteredIntercepts[KIntcArrSize]; // 132 bytes
1.497 + TInt iLastError; // 4 bytes
1.498 + TInt iMountedOn; //bitmask // 4 bytes
1.499 + TUint iSpare[26]; // 104 bytes
1.500 + // extra 4 bytes to preserve BC with 9.1 plugins. Don't move !
1.501 + const TUint iReadOnly; // 4 bytes
1.502 + // TOTAL: 252
1.503 + friend class FsPluginManager;
1.504 + friend class CFsRequest;
1.505 + friend class CFsMessageRequest;
1.506 + friend class CFsInternalRequest;
1.507 + friend class CPluginThread;
1.508 + friend class TFsDismountPlugin;
1.509 + friend class TPluginSessionHelper;
1.510 + friend class TFsDirOpen; //For access to TInterceptAtts
1.511 + };
1.512 +
1.513 +class TPluginSessionHelper
1.514 + {
1.515 +public:
1.516 + TPluginSessionHelper();
1.517 + TPluginSessionHelper(TFsPluginRequest* aRequest, TBool aDirectToDrive);
1.518 + TInt CreateSubSession(const RSessionBase& aSession,TInt aFunction,const TIpcArgs& aArgs, TInt* aReply);
1.519 + TInt SendReceive(TInt aFunction, const TIpcArgs& aArgs) const;
1.520 + TInt SendReceive(TInt aFunction, const TIpcArgs& aArgs, TInt aSubSessionHandle) const;
1.521 + inline TFsPluginRequest* Request();
1.522 +private:
1.523 + TInt Dispatch(TInt aFunction, TIpcArgs& aArgs) const;
1.524 +private:
1.525 + CFsPlugin* iPlugin; // owner; used for setting iCurrentPlugin in CFsMessageRequest
1.526 + CSessionFs* iSession;
1.527 + RLocalMessage iMessage;
1.528 + TBool iDirectToDrive;
1.529 + TFsPluginRequest* iRequest;
1.530 + TUint iSpare[4];
1.531 + };
1.532 +
1.533 +/**
1.534 +A class for making file server request internally from within a
1.535 +file server plugin.
1.536 +
1.537 +See also RFilePlugin and RDirPlugin.
1.538 +
1.539 +@publishedPartner
1.540 +@released
1.541 +*/
1.542 +class RFsPlugin : private RFs
1.543 + {
1.544 +public:
1.545 + IMPORT_C RFsPlugin(TFsPluginRequest& aRequest, TBool aDirectToDrive = EFalse);
1.546 + IMPORT_C ~RFsPlugin();
1.547 +
1.548 + IMPORT_C TInt Connect();
1.549 + IMPORT_C void Close();
1.550 +
1.551 + IMPORT_C TInt Delete(const TDesC& aName);
1.552 + IMPORT_C TInt Rename(const TDesC& anOldName,const TDesC& aNewName);
1.553 + IMPORT_C TInt Replace(const TDesC& anOldName,const TDesC& aNewName);
1.554 + IMPORT_C TInt Entry(const TDesC& aName,TEntry& anEntry) const;
1.555 + IMPORT_C TInt SetEntry(const TDesC& aName,const TTime& aTime,TUint aSetAttMask,TUint aClearAttMask);
1.556 + IMPORT_C TInt ReadFileSection(const TDesC& aName,TInt64 aPos,TDes8& aDes,TInt aLength) const;
1.557 + IMPORT_C TInt Volume(TVolumeInfo &aVol,TInt aDrive=KDefaultDrive) const;
1.558 +
1.559 +protected:
1.560 + TInt SendReceive(TInt aFunction,const TIpcArgs& aArgs) const;
1.561 +
1.562 +private:
1.563 + RFsPlugin();
1.564 + RFsPlugin(const RFsPlugin&);
1.565 + RFsPlugin& operator=(const RFsPlugin&);
1.566 + void SetHandle(TInt aHandle);
1.567 +
1.568 +private:
1.569 + TPluginSessionHelper iSessionHelper;
1.570 + friend class RFs;
1.571 + };
1.572 +
1.573 +/**
1.574 +@publishedPartner
1.575 +@released
1.576 +*/
1.577 +#ifndef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
1.578 +class RFilePlugin : private RFile
1.579 +#else
1.580 +class RFilePlugin : private RFile64
1.581 +#endif
1.582 + {
1.583 +public:
1.584 + IMPORT_C RFilePlugin(TFsPluginRequest& aRequest, TBool aDirectToDrive = EFalse);
1.585 + IMPORT_C ~RFilePlugin();
1.586 +
1.587 + // open a NEW file using same session as passed request
1.588 + IMPORT_C TInt Open(const TDesC& aName,TUint aMode);
1.589 + IMPORT_C TInt Create(const TDesC& aName,TUint aFileMode);
1.590 + IMPORT_C TInt Replace(const TDesC& aName,TUint aFileMode);
1.591 + IMPORT_C TInt Temp(const TDesC& aPath,TFileName& aName,TUint aFileMode);
1.592 +
1.593 + // re-open SAME file as client's request
1.594 + IMPORT_C TInt AdoptFromClient();
1.595 +
1.596 + // Transfer the plugin's open file to the client
1.597 + IMPORT_C TInt TransferToClient();
1.598 +
1.599 + IMPORT_C void Close();
1.600 +
1.601 + // RFile overloads
1.602 + IMPORT_C TInt Read(TInt64 aPos,TDes8& aDes) const;
1.603 + IMPORT_C TInt Read(TInt64 aPos,TDes8& aDes,TInt aLength) const;
1.604 + IMPORT_C TInt Write(TInt64 aPos,const TDesC8& aDes);
1.605 + IMPORT_C TInt Write(TInt64 aPos,const TDesC8& aDes,TInt aLength);
1.606 + IMPORT_C TInt Lock(TInt64 aPos,TInt64 aLength) const;
1.607 + IMPORT_C TInt UnLock(TInt64 aPos,TInt64 aLength) const;
1.608 + IMPORT_C TInt Seek(TSeek aMode,TInt64& aPos) const;
1.609 + IMPORT_C TInt Flush();
1.610 + IMPORT_C TInt Size(TInt64& aSize) const;
1.611 + IMPORT_C TInt SetSize(TInt64 aSize);
1.612 + IMPORT_C TInt Att(TUint& aAttValue) const;
1.613 + IMPORT_C TInt SetAtt(TUint aSetAttMask,TUint aClearAttMask);
1.614 + IMPORT_C TInt Modified(TTime& aTime) const;
1.615 + IMPORT_C TInt SetModified(const TTime& aTime);
1.616 + IMPORT_C TInt Set(const TTime& aTime,TUint aSetAttMask,TUint aClearAttMask);
1.617 + IMPORT_C TInt ChangeMode(TFileMode aNewMode);
1.618 + IMPORT_C TInt Rename(const TDesC& aNewName);
1.619 +
1.620 +protected:
1.621 + // RSubSessionBase overrides
1.622 + TInt CreateSubSession(const RSessionBase& aSession,TInt aFunction,const TIpcArgs& aArgs);
1.623 + TInt SendReceive(TInt aFunction,const TIpcArgs& aArgs) const;
1.624 + void CloseSubSession(TInt aFunction);
1.625 +
1.626 +private:
1.627 + RFilePlugin();
1.628 + RFilePlugin(const RFilePlugin&);
1.629 + RFilePlugin& operator=(const RFilePlugin&);
1.630 +
1.631 + void SetHandle(TInt aHandle);
1.632 + void SetSubSessionHandle(TInt aHandle);
1.633 +
1.634 +private:
1.635 + TPluginSessionHelper iSessionHelper;
1.636 + friend class RFile;
1.637 +#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
1.638 + friend class RFile64;
1.639 +#endif
1.640 + };
1.641 +
1.642 +/**
1.643 +@publishedPartner
1.644 +@released
1.645 +*/
1.646 +class RDirPlugin : private RDir
1.647 + {
1.648 +public:
1.649 + IMPORT_C RDirPlugin(TFsPluginRequest& aRequest, TBool aDirectToDrive = EFalse);
1.650 + IMPORT_C ~RDirPlugin();
1.651 +
1.652 + IMPORT_C TInt Open(const TDesC& aMatchName,const TUidType& aUidType);
1.653 + IMPORT_C TInt Open(const TDesC& aMatchName,TUint anAttMask);
1.654 + IMPORT_C void Close();
1.655 +
1.656 + /**
1.657 + Plugin authors should pass in a TRawEntryArray if their intent is to modify the data.
1.658 + */
1.659 + IMPORT_C TInt Read(TEntryArray& aArray);
1.660 + IMPORT_C TInt Read(TEntry& aEntry);
1.661 +
1.662 +protected:
1.663 + // RSubSessionBase overrides
1.664 + TInt CreateSubSession(const RSessionBase& aSession,TInt aFunction,const TIpcArgs& aArgs);
1.665 + TInt SendReceive(TInt aFunction,const TIpcArgs& aArgs) const;
1.666 + void CloseSubSession(TInt aFunction);
1.667 +
1.668 +private:
1.669 + RDirPlugin();
1.670 + RDirPlugin(const RDirPlugin&);
1.671 + RDirPlugin& operator=(const RDirPlugin&);
1.672 +
1.673 + void SetHandle(TInt aHandle);
1.674 + void SetSubSessionHandle(TInt aHandle);
1.675 +
1.676 +private:
1.677 + TPluginSessionHelper iSessionHelper;
1.678 + friend class RDir;
1.679 + };
1.680 +
1.681 +
1.682 +class CFsRequest;
1.683 +class CFsPluginConnRequest : public CBase
1.684 + {
1.685 +public:
1.686 + CFsPluginConnRequest(CFsPluginConn* aPluginConn);
1.687 +public:
1.688 + inline TInt Function() const;
1.689 + inline TDes8* Param1() const;
1.690 + inline TDes8* Param2() const;
1.691 + inline void WriteParam1L(const TDesC8& aDes) const;
1.692 + inline void WriteParam2L(const TDesC8& aDes) const;
1.693 + inline void ReadParam1L(TDes8& aDes) const;
1.694 + inline void ReadParam2L(TDes8& aDes) const;
1.695 + inline const RMessagePtr2& Message() const;
1.696 +public:
1.697 + TInt DoControl();
1.698 + void DoRequest();
1.699 + inline void Complete(TInt aError);
1.700 +public:
1.701 + TInt InitControl(CFsRequest* aRequest);
1.702 + TInt InitRequest(CFsRequest* aRequest);
1.703 +private:
1.704 + TDblQueLink iLink;
1.705 + CFsPluginConn& iPluginConn;
1.706 + TInt iFunction;
1.707 + TDes8* iParam1;
1.708 + TDes8* iParam2;
1.709 +public:
1.710 + RMessagePtr2 iMessage;
1.711 +
1.712 + friend class TPluginConnRequestQue;
1.713 + friend class CFsPluginConn;
1.714 + };
1.715 +
1.716 +class TPluginConnRequestQue
1.717 + {
1.718 +public:
1.719 + TPluginConnRequestQue();
1.720 + ~TPluginConnRequestQue();
1.721 + void DoAddRequest(CFsPluginConnRequest* aRequest);
1.722 + IMPORT_C void DoCancelAll(TInt aCompletionCode);
1.723 +protected:
1.724 + TDblQue<CFsPluginConnRequest> iHeader;
1.725 + };
1.726 +
1.727 +/**
1.728 +Plugin connection object
1.729 +*/
1.730 +class CFsPluginConn : public CFsObject
1.731 + {
1.732 +public:
1.733 + IMPORT_C CFsPluginConn();
1.734 + IMPORT_C ~CFsPluginConn();
1.735 +
1.736 + virtual TInt DoControl(CFsPluginConnRequest& aRequest) = 0;
1.737 + virtual void DoRequest(CFsPluginConnRequest& aRequest) = 0;
1.738 + virtual void DoCancel(TInt aReqMask) = 0;
1.739 +
1.740 + inline CFsPlugin* Plugin() const;
1.741 + inline TThreadId ClientId() const;
1.742 +private:
1.743 + IMPORT_C void Close();
1.744 + CFsPlugin* iPluginP;
1.745 + TThreadId iClientId;
1.746 +public:
1.747 + TPluginConnRequestQue iRequestQue;
1.748 + friend class FsPluginManager;
1.749 + };
1.750 +
1.751 +#include <f32plugin.inl>
1.752 +
1.753 +#endif // __F32PLUGIN_H
1.754 +