diff -r 345b1ca54e88 -r 039a3e647356 kernel/eka/include/drivers/locmedia.h --- a/kernel/eka/include/drivers/locmedia.h Wed Sep 15 13:42:27 2010 +0300 +++ b/kernel/eka/include/drivers/locmedia.h Wed Oct 13 16:04:24 2010 +0300 @@ -166,46 +166,6 @@ class TLocDrvRequest; class DPrimaryMediaBase; -/* -TCallBackLink - -@internalComponent - -Internal class which allows a list of callbacks to be linked together. -*/ - -NONSHARABLE_CLASS(TCallBackLink) - { -public: - enum TObjectType - { - EDLocalDriveObject, // object containing this TCallBackLink is a DLocalDrive - ETLocDrvObject, // object containing this TCallBackLink is a TLocDrv - }; - -public: - TCallBackLink(); - TCallBackLink(TInt (*aFunction)(TAny* aPtr, TInt aParam),TAny* aPtr, TObjectType aObjectType); - TInt CallBack(TInt aParam) const; -public: - /** - A pointer to the callback function. - */ - TInt (*iFunction)(TAny* aPtr, TInt aParam); - - - /** - A pointer that is passed to the callback function when - the function is called. - */ - TAny* iPtr; - - TObjectType iObjectType; - - SDblQueLink iLink; - }; - - /** @publishedPartner @released @@ -315,22 +275,19 @@ Query device */ EQueryDevice=32, + }; public: DLocalDrive(); ~DLocalDrive(); - +public: virtual TInt DoCreate(TInt aUnit, const TDesC8* anInfo, const TVersion& aVer); /**< @internalComponent */ virtual TInt Request(TInt aFunction, TAny* a1, TAny* a2); /**< @internalComponent */ - - void NotifyChange(); - +public: + void NotifyChange(DPrimaryMediaBase& aPrimaryMedia, TBool aMediaChange); +public: inline void Deque(); /**< @internalComponent */ - static TInt MediaChangeCallback(TAny* aLocalDrive, TInt aNotifyType); /**< @internalComponent */ - - IMPORT_C static TInt Caps(TInt aDriveNumber, TDes8& aCaps); - private: #ifdef __DEMAND_PAGING__ TInt LockMountInfo(DPrimaryMediaBase& aPrimaryMedia, TLocDrvRequest& aReq); @@ -339,10 +296,10 @@ TInt ReadPasswordData(TLocDrvRequest& aReq, TLocalDrivePasswordData& aPswData, TMediaPassword& aOldPasswd, TMediaPassword& aNewPasswd); public: - TLocDrv* iDrive; /**< @internalComponent */ - TCallBackLink iMediaChangeObserver; /**< @internalComponent */ + TLocDrv* iDrive; /**< @internalComponent */ + SDblQueLink iLink; /**< @internalComponent */ TClientDataRequest* iNotifyChangeRequest; /**< @internalComponent */ - TLocalDriveCleanup iCleanup; /**< @internalComponent */ + TLocalDriveCleanup iCleanup; /**< @internalComponent */ }; /** @@ -384,7 +341,7 @@ ECodePaging=0x20, // a code paging request EDataPaging=0x40, // a data paging request ETClientBuffer=0x80, // RemoteDes() points to a TClientBuffer - EKernelBuffer=0x100, // RemoteDes() points to a kernel-side buffer : set for all paging requests and media extension requests + EKernelBuffer=0x100, // RemoteDes() points to a kernel-side buffer EPhysAddrOnly=0x200, // No virtual address is available. Data Paging requests Only. }; public: @@ -537,7 +494,7 @@ @internalComponent */ inline void DLocalDrive::Deque() - { iMediaChangeObserver.iLink.Deque(); } + { iLink.Deque(); } @@ -691,7 +648,6 @@ inline TInt Connect(DLocalDrive* aLocalDrive); inline void Disconnect(DLocalDrive* aLocalDrive); inline TInt Request(TLocDrvRequest& aRequest); - static TInt MediaChangeCallback(TAny* aLocDrv, TInt aNotifyType); public: TInt iDriveNumber; DMedia* iMedia; @@ -706,14 +662,6 @@ TUint8 iSpare3; #endif DDmaHelper* iDmaHelper; - - // Media extension stuff: - - /** ptr to the next TLocDrv object in the chain. Null if not a media extension */ - TLocDrv* iNextDrive; - - /** media change callback - called when the next media in the chain has a media change */ - TCallBackLink iMediaChangeObserver; }; /** @@ -880,7 +828,7 @@ public: IMPORT_C DPrimaryMediaBase(); - +public: // provided by implementation IMPORT_C virtual TInt Create(TMediaDevice aDevice, TInt aMediaId, TInt aLastMediaId); IMPORT_C virtual TInt Connect(DLocalDrive* aLocalDrive); @@ -894,7 +842,7 @@ IMPORT_C virtual void DeltaCurrentConsumption(TInt aCurrent); IMPORT_C virtual void DefaultDriveCaps(TLocalDriveCapsV2& aCaps); IMPORT_C virtual TBool IsRemovableDevice(TInt& aSocketNum); - +public: // used by implementation IMPORT_C void NotifyMediaChange(); IMPORT_C void NotifyPowerDown(); @@ -902,7 +850,7 @@ IMPORT_C void NotifyPsuFault(TInt anError); IMPORT_C void NotifyMediaPresent(); IMPORT_C void PowerUpComplete(TInt anError); - +public: IMPORT_C virtual void HandleMsg(TLocDrvRequest& aRequest); IMPORT_C virtual TInt DoRequest(TLocDrvRequest& aRequest); TInt OpenMediaDriver(); @@ -915,10 +863,7 @@ void CompleteRequest(TLocDrvRequest& aMsg, TInt aResult); IMPORT_C void RunDeferred(); void SetClosed(TInt anError); - - enum TNotifyType {EMediaChange, EMediaPresent}; - void NotifyClients(TNotifyType aNotifyType, TLocDrv* aLocDrv=NULL); - + void NotifyClients(TBool aMediaChange,TLocDrv* aLocDrv=NULL); TInt InCritical(); void EndInCritical(); void UpdatePartitionInfo(); @@ -938,13 +883,6 @@ void RequestCountDec(); #endif - // called by LocDrv::RegisterMediaDevice() for media extensions - TInt Connect(TLocDrv* aLocDrv); - - void MediaChange(); - TInt HandleMediaNotPresent(TLocDrvRequest& aReq); - - public: TInt iLastMediaId; /**< @internalComponent */ TMessageQue iMsgQ; @@ -1217,7 +1155,6 @@ virtual void NotifyEmergencyPowerDown()=0; public: IMPORT_C void SetTotalSizeInBytes(Int64 aTotalSizeInBytes, TLocDrv* aLocDrv=NULL); - IMPORT_C void SetTotalSizeInBytes(TLocalDriveCapsV4& aCaps); IMPORT_C Int64 TotalSizeInBytes(); IMPORT_C void SetCurrentConsumption(TInt aValue); IMPORT_C TInt InCritical(); @@ -1235,74 +1172,6 @@ }; -/** -@internalTechnology -@prototype - -An abstract base class for media driver 'extensions' within the local media subsystem -*/ -class DMediaDriverExtension : public DMediaDriver - { -public: - IMPORT_C DMediaDriverExtension(TInt aMediaId); - IMPORT_C virtual ~DMediaDriverExtension(); - IMPORT_C virtual void Close(); - - virtual TInt Request(TLocDrvRequest& aRequest) = 0; - - virtual TInt PartitionInfo(TPartitionInfo &anInfo) = 0; - - IMPORT_C virtual void NotifyPowerDown(); - - IMPORT_C virtual void NotifyEmergencyPowerDown(); - - /** - Retrieve partition info from all the attached drives - */ - IMPORT_C TInt DoDrivePartitionInfo(TPartitionInfo &anInfo); - /** - Forward a request to the next attached drive - */ - IMPORT_C TInt ForwardRequest(TLocDrvRequest& aRequest); - - /** - Read from the specified attached drive - */ - IMPORT_C TInt Read(TInt aDriveNumber, TInt64 aPos, TLinAddr aData, TUint aLen); - - /** - Write to the specified attached drive - */ - IMPORT_C TInt Write(TInt aDriveNumber, TInt64 aPos, TLinAddr aData, TUint aLen); - - /** - Get the Caps from the specified attached drive - */ - IMPORT_C TInt Caps(TInt aDriveNumber, TDes8& aCaps); - - /** - Return whether the media is busy i.e. if it has any pending requests or DFCs - */ - IMPORT_C TBool MediaBusy(TInt aDriveNumber); - -#ifdef __DEMAND_PAGING__ - /** - Send a paging read request to the specified attached drive - */ - IMPORT_C TInt ReadPaged(TInt aDriveNumber, TInt64 aPos, TLinAddr aData, TUint aLen); - - /** - Send a paging write request to the specified attached drive - */ - IMPORT_C TInt WritePaged(TInt aDriveNumber, TInt64 aPos, TLinAddr aData, TUint aLen); -#endif - -private: - TInt SendRequest(TInt aReqId, TBool aPagingRequest, TInt aDriveNumber, TInt64 aPos, TLinAddr aData, TUint aLen); - - }; - - /**