sl@0: // Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // f32\sfsrv\cl_plugin.cpp sl@0: // sl@0: // sl@0: sl@0: #include "cl_std.h" sl@0: sl@0: sl@0: EXPORT_C TInt RFs::AddPlugin(const TDesC& aFileName) const sl@0: /** sl@0: @internalTechnology sl@0: sl@0: Loads a specified Plugin. sl@0: sl@0: @param aFileName The file name of the plugin sl@0: sl@0: @return KErrNone, if successful; otherwise one of the other system wide error codes. sl@0: sl@0: @capability DiskAdmin sl@0: */ sl@0: { sl@0: TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsAddPlugin, MODULEUID, Handle(), aFileName); sl@0: sl@0: RLoader loader; sl@0: TInt r = loader.Connect(); sl@0: if (r==KErrNone) sl@0: { sl@0: r = loader.SendReceive(ELoadFSPlugin, TIpcArgs(0, &aFileName, 0)); sl@0: loader.Close(); sl@0: } sl@0: sl@0: TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsAddPluginReturn, MODULEUID, r); sl@0: return r; sl@0: } sl@0: sl@0: EXPORT_C TInt RFs::RemovePlugin(const TDesC& aPluginName) const sl@0: /** sl@0: @internalTechnology sl@0: sl@0: Removes the specified plugin. sl@0: sl@0: @param aPluginName The full name of the plugin to be removed. sl@0: sl@0: @return KErrNone, if successful; sl@0: KErrNotFound, if aPluginName is not found; sl@0: otrherwise one of the other system-wide error codes. sl@0: sl@0: @capability DiskAdmin sl@0: */ sl@0: { sl@0: TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsRemovePlugin, MODULEUID, Handle(), aPluginName); sl@0: sl@0: TInt r = SendReceive(EFsRemovePlugin,TIpcArgs(&aPluginName)); sl@0: sl@0: TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsRemovePluginReturn, MODULEUID, r); sl@0: return r; sl@0: } sl@0: sl@0: EXPORT_C TInt RFs::MountPlugin(const TDesC& aPluginName) const sl@0: /** sl@0: @internalTechnology sl@0: sl@0: Mounts a specified plugin. sl@0: sl@0: Note that this API uses unique position of the plugin. sl@0: sl@0: This overload passes KPluginAutoAttach for the drive parameter sl@0: which mounts on all of the drives specified as supported by the plugin. sl@0: sl@0: Note - Plugins cannot be mounted on demand paged drives. sl@0: KErrNone is returned so long as it has been able to mount on sl@0: at least one drive; otherwise KErrNotSupported. sl@0: sl@0: @param aPluginName The fullname of the plugin, as returned from sl@0: a call to PluginName(). sl@0: sl@0: @return KErrNone if successful; sl@0: KErrNotFound, if the plugin cannot be found; sl@0: otherwise one of the other system-wide error codes. sl@0: sl@0: @see RFs::PluginName sl@0: sl@0: @capability DiskAdmin sl@0: */ sl@0: { sl@0: TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsMountPlugin1, MODULEUID, Handle(), aPluginName); sl@0: sl@0: TInt r = SendReceive(EFsMountPlugin,TIpcArgs(&aPluginName,KPluginAutoAttach,KPluginAutoLocate)); sl@0: sl@0: TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsMountPlugin1Return, MODULEUID, r); sl@0: return r; sl@0: } sl@0: sl@0: EXPORT_C TInt RFs::MountPlugin(const TDesC& aPluginName,TInt aDrive) const sl@0: /** sl@0: @internalTechnology sl@0: sl@0: Mounts a specified plugin specifying the drive plugin will support. sl@0: sl@0: @param aPluginName The fullname of the plugin, as returned from sl@0: a call to PluginName(). sl@0: sl@0: @param aDrive If the mounted plugin is a version2 plugin, then in order to sl@0: mount on drive z, KPluginMountDriveZ should be passed as a parameter. sl@0: For all other drive letters use values 0 to 24 for A to Y. sl@0: Version1 plugins cannot mount on Z drive. sl@0: To let the plugin decide on which drives to mount, use KPluginAutoAttach. sl@0: sl@0: Plugins cannot be mounted on demand paged drives. If KPluginAutoAttach is passed sl@0: in, it will return KErrNone so long as it has been able to mount on at sl@0: least one drive; otherwise KErrNotSupported. sl@0: sl@0: @return KErrNone if successful; sl@0: KErrNotFound, if the plugin cannot be found; sl@0: otherwise one of the other system-wide error codes. sl@0: sl@0: @see RFs::PluginName sl@0: sl@0: @capability DiskAdmin sl@0: */ sl@0: { sl@0: TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFsMountPlugin2, MODULEUID, Handle(), aPluginName, aDrive); sl@0: sl@0: TInt r = SendReceive(EFsMountPlugin,TIpcArgs(&aPluginName,aDrive,KPluginAutoLocate)); sl@0: sl@0: TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsMountPlugin2Return, MODULEUID, r); sl@0: return r; sl@0: } sl@0: sl@0: EXPORT_C TInt RFs::MountPlugin(const TDesC& aPluginName,TInt aDrive, TInt aPos) const sl@0: /** sl@0: @internalTechnology sl@0: sl@0: Mounts a specified plugin using absolute position and a specific drive sl@0: sl@0: @param aPluginName The fullname of the plugin, as returned from sl@0: a call to PluginName(). sl@0: sl@0: @param aDrive If the mounted plugin is a version2 plugin, then in order to sl@0: mount on drive z, KPluginMountDriveZ should be passed as a parameter. sl@0: For all other drive letters use values 0 to 24 for A to Y. sl@0: Version1 plugins cannot mount on Z drive. sl@0: To let the plugin decide on which drives to mount, use KPluginAutoAttach. sl@0: sl@0: Plugins cannot be mounted on demand paged drives. If KPluginAutoAttach is passed sl@0: in, it will return KErrNone so long as it has been able to mount on at sl@0: least one drive; otherwise KErrNotSupported. sl@0: sl@0: @param aPos The position at which the plugin is to be mounted within the internal array of plugins. sl@0: sl@0: Plugins wishing to be mounted using their CFsPlugin::iUniquePos sl@0: should use MountPlugin(TDesC&,TInt) or MountPlugin(TDesC&) sl@0: sl@0: If there is already a plugin at aPos then this plugin is inserted sl@0: into aPos and other plugins are shifted downwards. sl@0: sl@0: @return KErrNone if successful; sl@0: KErrNotFound, if the plugin cannot be found; sl@0: otherwise one of the other system-wide error codes. sl@0: sl@0: @see RFs::PluginName sl@0: @see RFs::MountPlugin(const TDesC& aPluginName,TInt aDrive) sl@0: @capability DiskAdmin sl@0: */ sl@0: { sl@0: TRACEMULT4(UTF::EBorder, UTraceModuleEfsrv::EFsMountPlugin3, MODULEUID, Handle(), aPluginName, aDrive, aPos); sl@0: sl@0: TInt r = SendReceive(EFsMountPlugin,TIpcArgs(&aPluginName,aDrive,aPos)); sl@0: sl@0: TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsMountPlugin3Return, MODULEUID, r); sl@0: return r; sl@0: } sl@0: sl@0: EXPORT_C TInt RFs::DismountPlugin(const TDesC& aPluginName) const sl@0: /** sl@0: @internalTechnology sl@0: sl@0: Dismounts the specified plugin from all drives on which it is mounted. sl@0: sl@0: @param aPluginName The fullname of the plugin, as returned from sl@0: a call to PluginName(). sl@0: sl@0: @return KErrNone if successful; sl@0: KErrNotFound, if the plugin cannot be found; sl@0: otherwise one of the other system-wide error codes. sl@0: sl@0: @see RFs::PluginName sl@0: @capability DiskAdmin sl@0: */ sl@0: { sl@0: TRACEMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsDismountPlugin1, MODULEUID, Handle(), aPluginName); sl@0: sl@0: TInt r = SendReceive(EFsDismountPlugin,TIpcArgs(&aPluginName,KPluginAutoAttach,KPluginAutoLocate)); sl@0: sl@0: TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsDismountPlugin1Return, MODULEUID, r); sl@0: return r; sl@0: } sl@0: sl@0: sl@0: EXPORT_C TInt RFs::DismountPlugin(const TDesC& aPluginName,TInt aDrive) const sl@0: /** sl@0: @internalTechnology sl@0: sl@0: Dismounts the specified plugin. sl@0: sl@0: @param aPluginName The fullname of the plugin, as returned from sl@0: a call to PluginName(). sl@0: sl@0: @param aDrive The drive on which the plugin is to be dismounted; sl@0: If the mounted plugin is a version2 plugin, then in order to sl@0: dismount drive z, KPluginMountDriveZ should be passed as a parameter. sl@0: For all other drive letters use values 0 to 24 for A to Y. sl@0: Version1 plugins cannot mount on Z drive. sl@0: sl@0: sl@0: @return KErrNone if successful; sl@0: KErrNotFound, if the plugin cannot be found; sl@0: otherwise one of the other system-wide error codes. sl@0: sl@0: @see RFs::PluginName sl@0: @capability DiskAdmin sl@0: */ sl@0: { sl@0: TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFsDismountPlugin2, MODULEUID, Handle(), aPluginName, aDrive); sl@0: sl@0: TInt r = SendReceive(EFsDismountPlugin,TIpcArgs(&aPluginName,aDrive,KPluginAutoLocate)); sl@0: sl@0: TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsDismountPlugin2Return, MODULEUID, r); sl@0: return r; sl@0: } sl@0: sl@0: EXPORT_C TInt RFs::DismountPlugin(const TDesC& aPluginName,TInt aDrive,TInt aPos) const sl@0: /** sl@0: @internalTechnology sl@0: sl@0: Dismounts the specified plugin. sl@0: sl@0: @param aPluginName The fullname of the plugin, as returned from sl@0: a call to PluginName(). sl@0: sl@0: @param aDrive If the mounted plugin is a version2 plugin, then in order to sl@0: dismount drive z, KPluginMountDriveZ should be passed as a parameter. sl@0: For all other drive letters use values 0 to 24 for A to Y. sl@0: Version1 plugins cannot mount on Z drive. sl@0: sl@0: @param aPos The position at which the plugin is located in the internal sl@0: array of plugins. sl@0: To automatically locate the position of the plugin use sl@0: DismountPlugin::(TDesC&,TInt) or sl@0: DismountPlugin::(TDesC&) sl@0: sl@0: @return KErrNone if successful; sl@0: KErrNotFound, if the plugin cannot be found; sl@0: otherwise one of the other system-wide error codes. sl@0: sl@0: @see RFs::PluginName sl@0: @capability DiskAdmin sl@0: */ sl@0: { sl@0: TRACEMULT4(UTF::EBorder, UTraceModuleEfsrv::EFsDismountPlugin3, MODULEUID, Handle(), aPluginName, aDrive, aPos); sl@0: sl@0: TInt r = SendReceive(EFsDismountPlugin,TIpcArgs(&aPluginName,aDrive,aPos)); sl@0: sl@0: TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFsDismountPlugin3Return, MODULEUID, r); sl@0: return r; sl@0: } sl@0: sl@0: sl@0: EXPORT_C TInt RFs::PluginName(TDes& aPluginName,TInt aDrive,TInt aPos) sl@0: /** sl@0: @internalTechnology sl@0: sl@0: Gets the name of the plugin on the specified drive at the specified position sl@0: in the plugin hierarchy. sl@0: sl@0: @param aPluginName On successful return, contains the name of the plugin. sl@0: @param aDrive The drive for which the plugin name is required. sl@0: @param aPos The position of the plugin in the plugin hierarchy. sl@0: sl@0: @return KErrNone, if successful; sl@0: KErrNotFound if the plugin name is not found; sl@0: */ sl@0: { sl@0: TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFsPluginName, MODULEUID, Handle(), aDrive, aPos); sl@0: sl@0: TInt r = SendReceive(EFsPluginName,TIpcArgs(&aPluginName,aDrive,aPos)); sl@0: sl@0: TRACERETMULT2(UTF::EBorder, UTraceModuleEfsrv::EFsPluginName, MODULEUID, r, aPluginName); sl@0: return r; sl@0: } sl@0: sl@0: EXPORT_C TInt RPlugin::Open(RFs& aFs, TInt aPos) sl@0: /** sl@0: @internalTechnology sl@0: sl@0: Opens a plugin for userside engine conn sl@0: sl@0: @param aFs: File server session sl@0: @prama aPos: Unique position of the plugin sl@0: @return KErrNotFound if it didn't find the plugin, else KErrNone sl@0: sl@0: */ sl@0: { sl@0: TRACE2(UTF::EBorder, UTraceModuleEfsrv::EPluginOpen, MODULEUID, aFs.Handle(), aPos); sl@0: sl@0: TInt r = CreateSubSession(aFs,EFsPluginOpen,TIpcArgs(aPos,0,0)); sl@0: sl@0: TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EPluginOpenReturn, MODULEUID, r, SubSessionHandle()); sl@0: return r; sl@0: } sl@0: sl@0: EXPORT_C void RPlugin::Close() sl@0: /** sl@0: @internalTechnology sl@0: sl@0: Closes a plugin sl@0: */ sl@0: { sl@0: TRACE2(UTF::EBorder, UTraceModuleEfsrv::EPluginClose, MODULEUID, Session().Handle(), SubSessionHandle()); sl@0: sl@0: CloseSubSession(EFsPluginSubClose); sl@0: sl@0: TRACE0(UTF::EBorder, UTraceModuleEfsrv::EPluginCloseReturn, MODULEUID); sl@0: } sl@0: sl@0: EXPORT_C void RPlugin::DoRequest(TInt aReqNo, TRequestStatus& aStatus) const sl@0: /** sl@0: @internalTechnology sl@0: sl@0: Client requests a asynchronous operation sl@0: sl@0: @param aReqNo: Number of the request sl@0: @param aStatus: status of the request sl@0: */ sl@0: { sl@0: TRACE4(UTF::EBorder, UTraceModuleEfsrv::EPluginDoRequest1, MODULEUID, Session().Handle(), SubSessionHandle(), aReqNo, &aStatus); sl@0: sl@0: aStatus=KRequestPending; sl@0: SendReceive(EFsPluginDoRequest, TIpcArgs(aReqNo, NULL, NULL), aStatus); sl@0: sl@0: TRACE0(UTF::EBorder, UTraceModuleEfsrv::EPluginDoRequest1Return, MODULEUID); sl@0: } sl@0: sl@0: EXPORT_C void RPlugin::DoRequest(TInt aReqNo, TRequestStatus& aStatus, TDes8& a1) const sl@0: /** sl@0: @internalTechnology sl@0: sl@0: Client requests a asynchronous operation sl@0: sl@0: @param aReqNo: Number of the request sl@0: @param aStatus: status of the request sl@0: @param a1: returning value from plugin sl@0: */ sl@0: { sl@0: TRACE5(UTF::EBorder, UTraceModuleEfsrv::EPluginDoRequest2, MODULEUID, Session().Handle(), SubSessionHandle(), aReqNo, &aStatus, &a1); sl@0: sl@0: aStatus=KRequestPending; sl@0: SendReceive(EFsPluginDoRequest, TIpcArgs(aReqNo, &a1, NULL), aStatus); sl@0: sl@0: TRACE0(UTF::EBorder, UTraceModuleEfsrv::EPluginDoRequest2Return, MODULEUID); sl@0: } sl@0: sl@0: EXPORT_C void RPlugin::DoRequest(TInt aReqNo, TRequestStatus& aStatus, TDes8& a1, TDes8& a2) const sl@0: /** sl@0: @internalTechnology sl@0: sl@0: @param aReqNo: Number of the request sl@0: @param aStatus: status of the request sl@0: @param a1: returning value from plugin sl@0: @param a2: 2nd returning value from plugin sl@0: */ sl@0: { sl@0: TRACE6(UTF::EBorder, UTraceModuleEfsrv::EPluginDoRequest3, MODULEUID, Session().Handle(), SubSessionHandle(), aReqNo, &aStatus, &a1, &a2); sl@0: sl@0: aStatus=KRequestPending; sl@0: SendReceive(EFsPluginDoRequest, TIpcArgs(aReqNo, &a1, &a2), aStatus); sl@0: sl@0: TRACE0(UTF::EBorder, UTraceModuleEfsrv::EPluginDoRequest3Return, MODULEUID); sl@0: } sl@0: sl@0: EXPORT_C TInt RPlugin::DoControl(TInt aFunction) const sl@0: /** sl@0: @internalTechnology sl@0: sl@0: Client requests a synchronous operation sl@0: sl@0: @param aFunction: The operation to be handled sl@0: */ sl@0: { sl@0: TRACE3(UTF::EBorder, UTraceModuleEfsrv::EPluginDoControl1, MODULEUID, Session().Handle(), SubSessionHandle(), aFunction); sl@0: sl@0: TInt r = SendReceive(EFsPluginDoControl,TIpcArgs(aFunction,0,0)); sl@0: sl@0: TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EPluginDoControl1Return, MODULEUID, r); sl@0: return r; sl@0: } sl@0: sl@0: EXPORT_C TInt RPlugin::DoControl(TInt aFunction, TDes8& a1) const sl@0: /** sl@0: @internalTechnology sl@0: sl@0: Client requests a synchronous operation sl@0: sl@0: @param aFunction: The operation to be handled sl@0: @param a1: returned buffer from plugin on completion of the request sl@0: */ sl@0: { sl@0: TRACE4(UTF::EBorder, UTraceModuleEfsrv::EPluginDoControl2, MODULEUID, Session().Handle(), SubSessionHandle(), aFunction, &a1); sl@0: sl@0: TInt r = SendReceive(EFsPluginDoControl,TIpcArgs(aFunction,&a1,0)); sl@0: sl@0: TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EPluginDoControl2Return, MODULEUID, r); sl@0: return r; sl@0: } sl@0: sl@0: EXPORT_C TInt RPlugin::DoControl(TInt aFunction, TDes8& a1, TDes8& a2) const sl@0: /** sl@0: @internalTechnology sl@0: sl@0: Client requests a synchronous operation sl@0: sl@0: @param aFunction: The operation to be handled sl@0: @param a1: returned buffer from plugin on completion of the request sl@0: @param a2: 2nd returned buffer from plugin on completion of the request sl@0: */ sl@0: { sl@0: TRACE5(UTF::EBorder, UTraceModuleEfsrv::EPluginDoControl3, MODULEUID, Session().Handle(), SubSessionHandle(), aFunction, &a1, &a2); sl@0: sl@0: TInt r = SendReceive(EFsPluginDoControl,TIpcArgs(aFunction,&a1,&a2)); sl@0: sl@0: TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EPluginDoControl3Return, MODULEUID, r); sl@0: return r; sl@0: } sl@0: sl@0: EXPORT_C void RPlugin::DoCancel(TUint aReqMask) const sl@0: /** sl@0: @internalTechnology sl@0: sl@0: Cancels a request sl@0: sl@0: @param aReqMask: the bit mask for the operation to be cancelled sl@0: */ sl@0: { sl@0: TRACE3(UTF::EBorder, UTraceModuleEfsrv::EPluginDoCancel, MODULEUID, Session().Handle(), SubSessionHandle(), aReqMask); sl@0: sl@0: SendReceive(EFsPluginDoCancel,TIpcArgs(KMaxTInt,aReqMask,0)); sl@0: sl@0: TRACE0(UTF::EBorder, UTraceModuleEfsrv::EPluginDoCancelReturn, MODULEUID); sl@0: } sl@0: