Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

128 lines
3.3 KiB

  1. #ifndef _FSATRUNC_
  2. #define _FSATRUNC_
  3. /*++
  4. 1998 Seagate Software, Inc. All rights reserved.
  5. Module Name:
  6. fsatrunc.h
  7. Abstract:
  8. This class handles the automatic truncation of files that have already been premigrated.
  9. Author:
  10. Chuck Bardeen [cbardeen] 20-Feb-1997
  11. Revision History:
  12. --*/
  13. #include "resource.h" // main symbols
  14. #include "fsa.h"
  15. #define FSA_REGISTRY_TRUNCATOR_INTERVAL OLESTR("TruncatorInterval")
  16. #define FSA_REGISTRY_TRUNCATOR_FILES OLESTR("TruncatorFiles")
  17. extern DWORD FsaStartTruncator(void* pVoid);
  18. /*++
  19. Class Name:
  20. CFsaTruncator
  21. Class Description:
  22. This class handles the automatic truncation of files that have already been premigrated.
  23. --*/
  24. class CFsaTruncator :
  25. public CWsbPersistStream,
  26. public IHsmSessionSinkEveryEvent,
  27. public IFsaTruncator,
  28. public CComCoClass<CFsaTruncator, &CLSID_CFsaTruncatorNTFS>
  29. {
  30. public:
  31. CFsaTruncator() {}
  32. BEGIN_COM_MAP(CFsaTruncator)
  33. COM_INTERFACE_ENTRY(IFsaTruncator)
  34. COM_INTERFACE_ENTRY(IHsmSessionSinkEveryEvent)
  35. COM_INTERFACE_ENTRY(IPersist)
  36. COM_INTERFACE_ENTRY(IPersistStream)
  37. END_COM_MAP()
  38. //DECLARE_NO_REGISTRY()
  39. DECLARE_REGISTRY_RESOURCEID(IDR_FsaTruncator)
  40. // CComObjectRoot
  41. public:
  42. STDMETHOD(FinalConstruct)(void);
  43. STDMETHOD(FinalRelease)(void);
  44. // IPersist
  45. public:
  46. STDMETHOD(GetClassID)(LPCLSID pClsid);
  47. // IPersistStream
  48. public:
  49. STDMETHOD(GetSizeMax)(ULARGE_INTEGER* pSize);
  50. STDMETHOD(Load)(IStream* pStream);
  51. STDMETHOD(Save)(IStream* pStream, BOOL clearDirty);
  52. // CFsaTruncator
  53. STDMETHOD(Cancel)(HSM_JOB_EVENT event);
  54. STDMETHOD(LowerPriority)(void);
  55. STDMETHOD(Pause)(void);
  56. STDMETHOD(RaisePriority)(void);
  57. STDMETHOD(Resume)(void);
  58. STDMETHOD(SetState)(HSM_JOB_STATE state);
  59. STDMETHOD(StartScan)(void);
  60. // IHsmSessionSinkEveryEvent
  61. STDMETHOD(ProcessSessionEvent)(IHsmSession* pSession, HSM_JOB_PHASE phase, HSM_JOB_EVENT event);
  62. // IHsmSystemState
  63. STDMETHOD( ChangeSysState )( HSM_SYSTEM_STATE* pSysState );
  64. // IFsaTruncator
  65. public:
  66. STDMETHOD(GetKeepRecallTime)(FILETIME* pTime);
  67. STDMETHOD(GetMaxFilesPerRun)(LONGLONG* pMaxFiles);
  68. STDMETHOD(GetPremigratedSortOrder)(FSA_PREMIGRATED_SORT_ORDER* pSortOrder);
  69. STDMETHOD(GetRunInterval)(ULONG* pMilliseconds);
  70. STDMETHOD(GetSession)(IHsmSession** ppSession);
  71. STDMETHOD(SetKeepRecallTime)(FILETIME time);
  72. STDMETHOD(SetMaxFilesPerRun)(LONGLONG maxFiles);
  73. STDMETHOD(SetPremigratedSortOrder)(FSA_PREMIGRATED_SORT_ORDER SortOrder);
  74. STDMETHOD(SetRunInterval)(ULONG milliseconds);
  75. STDMETHOD(Start)(IFsaResource* pResource);
  76. STDMETHOD(KickStart)(void);
  77. protected:
  78. HSM_JOB_STATE m_state;
  79. HSM_JOB_PRIORITY m_priority;
  80. HANDLE m_threadHandle;
  81. DWORD m_threadId;
  82. HRESULT m_threadHr;
  83. CComPtr<IHsmSession> m_pSession;
  84. LONGLONG m_maxFiles;
  85. ULONG m_runInterval;
  86. ULONG m_runId;
  87. FSA_PREMIGRATED_SORT_ORDER m_SortOrder;
  88. ULONG m_subRunId;
  89. CWsbStringPtr m_currentPath;
  90. FILETIME m_keepRecallTime;
  91. DWORD m_cookie;
  92. HANDLE m_event;
  93. };
  94. #endif // _FSATRUNC_