userlibandfileserver/fileserver/sfile/sf_std.h
changeset 90 947f0dc9f7a8
parent 15 4122176ea935
child 102 ef2a444a7410
child 132 e4a7b1cbe40c
equal deleted inserted replaced
52:2d65c2f76d7b 90:947f0dc9f7a8
  1396 private:
  1396 private:
  1397 	TUint iThreadHandle;
  1397 	TUint iThreadHandle;
  1398 	TRequestStatus iStatus;
  1398 	TRequestStatus iStatus;
  1399 	TBool iIsAllocated;
  1399 	TBool iIsAllocated;
  1400 	};
  1400 	};
  1401 const TInt KMaxRequestAllocated		= 45;
  1401 
  1402 const TInt KMaxOperationAllocated	= KMaxRequestAllocated * 2;
  1402 // If the number of requests on the free queue reaches this value then completed requests 
  1403 const TInt KAllocReqBlock=15;
  1403 // are returned to the heap rather than being added to thefree queue
       
  1404 const TInt KFreeCountMax = 64;
  1404 
  1405 
  1405 class TParseCon
  1406 class TParseCon
  1406 	{
  1407 	{
  1407 public:
  1408 public:
  1408 	TParse iParse;
  1409 	TParse iParse;
  1411 
  1412 
  1412 
  1413 
  1413 class RequestAllocator
  1414 class RequestAllocator
  1414 	{
  1415 	{
  1415 public:
  1416 public:
       
  1417 	static TInt Initialise();
       
  1418 
  1416 	static TInt GetMessageRequest(const TOperation& aOperation,const RMessage2& aMessage,CFsClientMessageRequest* &aRequest);
  1419 	static TInt GetMessageRequest(const TOperation& aOperation,const RMessage2& aMessage,CFsClientMessageRequest* &aRequest);
  1417 	static void FreeRequest(CFsClientMessageRequest* aRequest); // Use the one from cache
  1420 	static void FreeRequest(CFsClientMessageRequest* aRequest);
  1418 	static void OpenSubFailed(CSessionFs* aSession); 
  1421 	static void OpenSubFailed(CSessionFs* aSession); 
  1419 	static TInt AllocRequest(TInt aNum);
  1422 
  1420 
  1423 #if defined(_USE_CONTROLIO) || defined(_DEBUG) || defined(_DEBUG_RELEASE)
  1421 	static TInt AllocOperation();
  1424 	inline static TInt RequestCount();
       
  1425 	inline static TInt RequestCountPeak();
       
  1426 	static TInt CloseCount();
       
  1427 	static TInt FreeCount();
       
  1428 #endif
       
  1429 
       
  1430 private:
       
  1431 	static CFsClientMessageRequest* GetRequest();
       
  1432 
       
  1433 private:
       
  1434 	static RFastLock iCacheLock;
       
  1435 	static CFsClientMessageRequest* iFreeHead;				
       
  1436 	static CFsClientMessageRequest* iCloseHead;
       
  1437 
       
  1438 	static TInt iRequestCount;			// current number of requests
       
  1439 	static TInt iFreeCount;				// current number of requests on free queue
       
  1440 	static TInt iRequestCountPeak;				// maximum value of requests reached
       
  1441 	};
       
  1442 
       
  1443 class OperationAllocator
       
  1444 	{
       
  1445 public:
       
  1446 	static TInt Initialise();
       
  1447 
  1422 	static TInt GetOperation(TMsgOperation* &aOperation);
  1448 	static TInt GetOperation(TMsgOperation* &aOperation);
  1423 	static void FreeOperation(TMsgOperation* aOperation);
  1449 	static void FreeOperation(TMsgOperation* aOperation);
  1424 
  1450 
  1425 
       
  1426 	static void Initialise();
       
  1427 #if defined(_USE_CONTROLIO) || defined(_DEBUG) || defined(_DEBUG_RELEASE)
  1451 #if defined(_USE_CONTROLIO) || defined(_DEBUG) || defined(_DEBUG_RELEASE)
  1428 	inline static TInt TotalCount();
  1452 	inline static TInt RequestCount();
  1429 	static TInt CloseCount();
  1453 	inline static TInt RequestCountPeak();
  1430 	static TInt FreeCount();
  1454 	inline static TInt FreeCount();
  1431 	inline static TInt AllocatedCount();
       
  1432 private:
       
  1433 	static TInt iAllocated;
       
  1434 #endif
  1455 #endif
  1435 public:
  1456 
       
  1457 private:
  1436 	static RFastLock iCacheLock;
  1458 	static RFastLock iCacheLock;
  1437 private:
  1459 	static TMsgOperation* iFreeHead;
  1438 	static TInt iAllocNum;
  1460 
  1439 	static CFsClientMessageRequest* iFreeHead;				
  1461 	static TInt iRequestCount;			// current number of requests
  1440 	static CFsClientMessageRequest* iCloseHead;
  1462 	static TInt iFreeCount;				// current number of requests on free queue
  1441 
  1463 	static TInt iRequestCountPeak;				// maximum value of requests reached
  1442 	static TInt iAllocNumOperation;
       
  1443 	static TMsgOperation* iFreeHeadSupOp;
       
  1444 	};
  1464 	};
  1445 
  1465 
  1446 
  1466 
  1447 NONSHARABLE_CLASS(CNotifyInfo) : public CBase
  1467 NONSHARABLE_CLASS(CNotifyInfo) : public CBase
  1448 	{
  1468 	{
  1509 	{
  1529 	{
  1510 public:
  1530 public:
  1511 	~CDismountNotifyInfo();
  1531 	~CDismountNotifyInfo();
  1512 	void Initialise(TNotifyDismountMode aMode, TInt aDriveNumber,TRequestStatus* iStatus,const RMessagePtr2& aMessage,CSessionFs* aSession);
  1532 	void Initialise(TNotifyDismountMode aMode, TInt aDriveNumber,TRequestStatus* iStatus,const RMessagePtr2& aMessage,CSessionFs* aSession);
  1513 	TBool IsMatching(TNotifyDismountMode aMode, TInt aDriveNumber, CSessionFs* aSession);
  1533 	TBool IsMatching(TNotifyDismountMode aMode, TInt aDriveNumber, CSessionFs* aSession);
       
  1534 	inline TInt DriveNumber() {return iDriveNumber;}
  1514 private:
  1535 private:
  1515 	TNotifyDismountMode iMode;
  1536 	TNotifyDismountMode iMode;
  1516 	TInt iDriveNumber;
  1537 	TInt iDriveNumber;
  1517 	};
  1538 	};
  1518 
  1539 
  1525 	TBaseQue();
  1546 	TBaseQue();
  1526 	~TBaseQue();
  1547 	~TBaseQue();
  1527 	void DoAddNotify(CNotifyInfo* aInfo);
  1548 	void DoAddNotify(CNotifyInfo* aInfo);
  1528 	TBool DoCancelSession(CSessionFs* aSession,TInt aCompletionCode,TRequestStatus* aStatus=NULL);
  1549 	TBool DoCancelSession(CSessionFs* aSession,TInt aCompletionCode,TRequestStatus* aStatus=NULL);
  1529 	void DoCancelAll(TInt aCompletionCode);
  1550 	void DoCancelAll(TInt aCompletionCode);
       
  1551 	CNotifyInfo* DoFindEntry(CSessionFs* aSession, TRequestStatus* aStatus=NULL);
  1530 	TBool IsEmpty();
  1552 	TBool IsEmpty();
  1531 protected:
  1553 protected:
  1532 	TDblQue<CNotifyInfo> iHeader;
  1554 	TDblQue<CNotifyInfo> iHeader;
  1533 	RFastLock iQLock;
  1555 	RFastLock iQLock;
  1534 	};
  1556 	};
  1595 	static void HandleDebug(TUint aFunction);
  1617 	static void HandleDebug(TUint aFunction);
  1596 	static void HandleDismount(TNotifyDismountMode aMode, TInt aDrive, TBool aRemove, TInt err);
  1618 	static void HandleDismount(TNotifyDismountMode aMode, TInt aDrive, TBool aRemove, TInt err);
  1597 	static void CancelChangeSession(CSessionFs* aSession,TRequestStatus* aStatus=NULL);
  1619 	static void CancelChangeSession(CSessionFs* aSession,TRequestStatus* aStatus=NULL);
  1598 	static void CancelDiskSpaceSession(CSessionFs* aSession,TRequestStatus* aStatus=NULL);
  1620 	static void CancelDiskSpaceSession(CSessionFs* aSession,TRequestStatus* aStatus=NULL);
  1599 	static void CancelDebugSession(CSessionFs* aSession, TRequestStatus* aStatus=NULL);
  1621 	static void CancelDebugSession(CSessionFs* aSession, TRequestStatus* aStatus=NULL);
  1600 	static void CancelDismountNotifySession(CSessionFs* aSession, TRequestStatus* aStatus=NULL);
  1622 	static TInt CancelDismountNotifySession(CSessionFs* aSession, TRequestStatus* aStatus=NULL);
  1601 	static void CancelSession(CSessionFs* aSession);
  1623 	static void CancelSession(CSessionFs* aSession);
  1602 	static TBool HandlePendingDismount(CSessionFs* aSession, TInt aDriveNumber);
  1624 	static TBool HandlePendingDismount(CSessionFs* aSession, TInt aDriveNumber);
  1603 	static TBool IsChangeQueEmpty(TInt aDrive);
  1625 	static TBool IsChangeQueEmpty(TInt aDrive);
  1604 	static TBool IsDiskSpaceQueEmpty(TInt aDrive);
  1626 	static TBool IsDiskSpaceQueEmpty(TInt aDrive);
  1605 private:
  1627 private:
  1801 extern TInt ErrorCount;
  1823 extern TInt ErrorCount;
  1802 extern TUint32 DebugReg;
  1824 extern TUint32 DebugReg;
  1803 extern TInt UserHeapAllocFailCount;
  1825 extern TInt UserHeapAllocFailCount;
  1804 extern TInt KernHeapAllocFailCount;
  1826 extern TInt KernHeapAllocFailCount;
  1805 extern TInt MessageCount;
  1827 extern TInt MessageCount;
       
  1828 extern TInt SessionCount;
       
  1829 extern TInt ObjectCount;
  1806 
  1830 
  1807 void PrintHeapSize(const TDesC& aMessage);
  1831 void PrintHeapSize(const TDesC& aMessage);
  1808 
  1832 
  1809 extern TCorruptNameRec* gCorruptFileNameList;
  1833 extern TCorruptNameRec* gCorruptFileNameList;
  1810 extern TCorruptLogRec* gCorruptLogRecordList;
  1834 extern TCorruptLogRec* gCorruptLogRecordList;