equal
deleted
inserted
replaced
551 Kern::Printf("SN: not supported"); |
551 Kern::Printf("SN: not supported"); |
552 } |
552 } |
553 #endif |
553 #endif |
554 |
554 |
555 /* |
555 /* |
|
556 Acquires ownership of the (already opened) client thread object stored in TheCurrentThread::iExtTempObj |
|
557 by retrieving and then clearing iExtTempObj |
|
558 |
|
559 On exit TheCurrentThread::iExtTempObj should be NULL |
|
560 |
|
561 @see EControlSetMountInfo |
|
562 */ |
|
563 DThread* AcquireRemoteThread() |
|
564 { |
|
565 NKern::ThreadEnterCS(); |
|
566 |
|
567 DThread& t = Kern::CurrentThread(); |
|
568 DThread* remoteThread = (DThread*)__e32_atomic_swp_ord_ptr(&t.iExtTempObj, 0); |
|
569 |
|
570 NKern::ThreadLeaveCS(); |
|
571 |
|
572 return remoteThread; |
|
573 } |
|
574 |
|
575 /* |
556 * Requests are passed in message as follows: |
576 * Requests are passed in message as follows: |
557 * iValue = request ID |
577 * iValue = request ID |
558 * iArg[0,1]= Position |
578 * iArg[0,1]= Position |
559 * iArg[2,3]= Length |
579 * iArg[2,3]= Length |
560 * iArg[4] = Pointer to remote thread (NULL if client) |
580 * iArg[4] = Pointer to remote thread (NULL if client) |
742 DPrimaryMediaBase* pM = drv->iPrimaryMedia; |
762 DPrimaryMediaBase* pM = drv->iPrimaryMedia; |
743 |
763 |
744 if(!pM || r!=KErrNone) |
764 if(!pM || r!=KErrNone) |
745 break; |
765 break; |
746 |
766 |
|
767 #ifdef __DEMAND_PAGING__ |
|
768 // Clear existing mount info |
|
769 UnlockMountInfo(*pM); |
|
770 #endif |
|
771 |
747 if (pM->iMountInfo.iThread) |
772 if (pM->iMountInfo.iThread) |
748 { |
773 { |
749 NKern::ThreadEnterCS(); |
774 NKern::ThreadEnterCS(); |
750 //Close original thread |
775 //Close original thread |
751 Kern::SafeClose((DObject*&) pM->iMountInfo.iThread,NULL); |
776 Kern::SafeClose((DObject*&) pM->iMountInfo.iThread,NULL); |
756 // lock the mount info if this is a data paging media - and keep it locked |
781 // lock the mount info if this is a data paging media - and keep it locked |
757 if ((DataPagingDfcQ(pM)) && ((r = LockMountInfo(*pM, m)) != KErrNone)) |
782 if ((DataPagingDfcQ(pM)) && ((r = LockMountInfo(*pM, m)) != KErrNone)) |
758 break; |
783 break; |
759 #endif |
784 #endif |
760 pM->iMountInfo.iInfo=(TDesC8*)m.RemoteDes(); |
785 pM->iMountInfo.iInfo=(TDesC8*)m.RemoteDes(); |
761 pM->iMountInfo.iThread=m.RemoteThread(); |
786 pM->iMountInfo.iThread = AcquireRemoteThread(); |
762 } |
787 } |
763 else |
788 else |
764 { |
789 { |
765 //Clear existing mount info and close setting thread |
790 // Close setting thread |
766 |
|
767 #ifdef __DEMAND_PAGING__ |
|
768 // unlock the mount info if this is a data paging media |
|
769 UnlockMountInfo(*pM); |
|
770 #endif |
|
771 |
|
772 pM->iMountInfo.iInfo=NULL; |
791 pM->iMountInfo.iInfo=NULL; |
773 pM->iMountInfo.iThread=NULL; |
792 pM->iMountInfo.iThread=NULL; |
774 m.CloseRemoteThread(); |
793 m.CloseRemoteThread(); |
775 } |
794 } |
776 NKern::ThreadLeaveCS(); |
795 NKern::ThreadLeaveCS(); |
792 if ((DataPagingDfcQ(pM)) && ((r = LockMountInfo(*pM, m)) != KErrNone)) |
811 if ((DataPagingDfcQ(pM)) && ((r = LockMountInfo(*pM, m)) != KErrNone)) |
793 break; |
812 break; |
794 #endif |
813 #endif |
795 |
814 |
796 pM->iMountInfo.iInfo=(TDesC8*)m.RemoteDes(); |
815 pM->iMountInfo.iInfo=(TDesC8*)m.RemoteDes(); |
797 pM->iMountInfo.iThread=m.RemoteThread(); |
816 pM->iMountInfo.iThread = AcquireRemoteThread(); |
|
817 |
798 NKern::ThreadLeaveCS(); |
818 NKern::ThreadLeaveCS(); |
799 r=KErrNone; |
819 r=KErrNone; |
800 } |
820 } |
801 break; |
821 break; |
802 } |
822 } |