Leaked source code of windows server 2003
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.

252 lines
12 KiB

  1. /*++
  2. Copyright (c) 1998 Seagate Software, Inc. All rights reserved.
  3. Module Name:
  4. medinfo.h
  5. Abstract:
  6. Declaration of class CMedInfo
  7. Author:
  8. Revision History:
  9. --*/
  10. #include "resource.h" // main symbols
  11. #include "engine.h" // main symbols
  12. #include "Wsb.h" // Wsb Collectable Class
  13. #include "wsbdb.h"
  14. #include "metalib.h" // Meta database
  15. typedef struct _HSM_MEDIA_MASTER {
  16. GUID id; //HSM Engine Media ID
  17. GUID ntmsId; //HSM RMS/NTMS Media ID
  18. GUID storagePoolId; //Storage Pool ID
  19. CWsbStringPtr description; //Display name - RS generated
  20. CWsbStringPtr name; //Barcode on media or NTMS generated
  21. //name
  22. HSM_JOB_MEDIA_TYPE type; //Type of media (HSM)
  23. FILETIME lastUpdate; //Last update of copy
  24. HRESULT lastError; //S_OK or the last exception
  25. //..encountered when accessing
  26. //..the media
  27. BOOL recallOnly; //True if no more data is to
  28. //..be premigrated to the media
  29. //..Set by internal operations,
  30. //..may not be changed externally
  31. LONGLONG freeBytes; //Real free space on media
  32. LONGLONG capacity; //Total capacity of media
  33. SHORT nextRemoteDataSet; //Next remote data set
  34. } HSM_MEDIA_MASTER, *PHSM_MEDIA_MASTER;
  35. typedef struct _HSM_MEDIA_COPY {
  36. GUID id; //HSM RMS/NTMS Media ID of copy
  37. CWsbStringPtr description; //RS generated name of copy (display name)
  38. CWsbStringPtr name; //Barcode or NTMS generated name of copy
  39. FILETIME lastUpdate; //Last update of copy
  40. HRESULT lastError; //S_OK or the last exception
  41. //..encountered when accessing
  42. //..the media
  43. SHORT nextRemoteDataSet; //The next remote data set of the media
  44. //..master that was copied
  45. } HSM_MEDIA_COPY, *PHSM_MEDIA_COPY;
  46. /////////////////////////////////////////////////////////////////////////////
  47. // Task
  48. class CMediaInfo :
  49. public CWsbDbEntity,
  50. public IMediaInfo,
  51. public CComCoClass<CMediaInfo,&CLSID_CMediaInfo>
  52. {
  53. public:
  54. CMediaInfo() {}
  55. BEGIN_COM_MAP(CMediaInfo)
  56. COM_INTERFACE_ENTRY(IMediaInfo)
  57. COM_INTERFACE_ENTRY2(IWsbDbEntity, CWsbDbEntity)
  58. COM_INTERFACE_ENTRY(IWsbDbEntityPriv)
  59. COM_INTERFACE_ENTRY(IPersistStream)
  60. COM_INTERFACE_ENTRY(IWsbCollectable)
  61. // COM_INTERFACE_ENTRY(IWsbPersistable)
  62. COM_INTERFACE_ENTRY(IWsbTestable)
  63. END_COM_MAP()
  64. DECLARE_REGISTRY(CMediaInfo, _T("Task.MediaInfo.1"), _T("Task.MediaInfo"), IDS_MEDIAINFO_DESC, THREADFLAGS_BOTH)
  65. // IMediaInfo
  66. public:
  67. STDMETHOD(FinalConstruct)(void);
  68. void FinalRelease(void);
  69. // IWsbDbEntity
  70. public:
  71. STDMETHOD(Print)(IStream* pStream);
  72. STDMETHOD(UpdateKey)(IWsbDbKey *pKey);
  73. WSB_FROM_CWSBDBENTITY;
  74. // IPersist
  75. public:
  76. STDMETHOD(GetClassID)(LPCLSID pClsid);
  77. // IPersistStream
  78. public:
  79. STDMETHOD(GetSizeMax)(ULARGE_INTEGER* pSize);
  80. STDMETHOD(Load)(IStream* pStream);
  81. STDMETHOD(Save)(IStream* pStream, BOOL clearDirty);
  82. // IWsbTestable
  83. public:
  84. STDMETHOD(Test)(USHORT *pTestsPassed, USHORT* pTestsFailed);
  85. //*/
  86. // IMediaInfo
  87. public:
  88. STDMETHOD( GetCapacity )( LONGLONG *pCapacity );
  89. STDMETHOD( GetCopyDescription ) ( USHORT copyNumber, OLECHAR **pDescription,
  90. ULONG bufferSize);
  91. STDMETHOD( GetCopyInfo )( USHORT copyNumber,
  92. GUID *pMediaSubsystemId,
  93. OLECHAR **pDescription,
  94. ULONG descriptionBufferSize,
  95. OLECHAR **pName,
  96. ULONG nameBufferSize,
  97. FILETIME *pUpdate,
  98. HRESULT *pLastError,
  99. SHORT *pNextRemoteDataSet );
  100. STDMETHOD( GetCopyLastError )( USHORT copyNumber, HRESULT *pLastError );
  101. STDMETHOD( GetCopyMediaSubsystemId )( USHORT copyNumber, GUID *pMediaSubsystemId );
  102. STDMETHOD( GetCopyName )( USHORT copyNumber, OLECHAR **pName, ULONG bufferSize);
  103. STDMETHOD( GetCopyNextRemoteDataSet )( USHORT copyNumber, SHORT *pNextRemoteDataSet);
  104. STDMETHOD( GetCopyUpdate )( USHORT copyNumber, FILETIME *pUpdate );
  105. STDMETHOD( GetDescription )(OLECHAR **pDescription, ULONG buffsize );
  106. STDMETHOD( GetFreeBytes )( LONGLONG *pFreeBytes);
  107. STDMETHOD( GetId )( GUID *pId);
  108. STDMETHOD( GetLastError )( HRESULT *pLastError);
  109. STDMETHOD( GetLastKnownGoodMasterInfo )( GUID* pMediaId,
  110. GUID *pMediaSubsystemId,
  111. GUID *pStoragePoolId,
  112. LONGLONG *pFreeBytes,
  113. LONGLONG *pCapacity,
  114. HRESULT *pLastError,
  115. OLECHAR **pDescription,
  116. ULONG descriptionBufferSize,
  117. HSM_JOB_MEDIA_TYPE *pType,
  118. OLECHAR **pName,
  119. ULONG nameBufferSize,
  120. BOOL *pReadOnly,
  121. FILETIME *pUpdate,
  122. SHORT *pNextRemoteDataSet);
  123. STDMETHOD( GetLKGMasterNextRemoteDataSet )( SHORT *pNextRemoteDataSet );
  124. STDMETHOD( GetLogicalValidBytes )( LONGLONG *pLogicalValidBytes);
  125. STDMETHOD( GetMediaInfo )( GUID* pMediaId,
  126. GUID *pMediaSubsystemId,
  127. GUID *pStoragePoolId,
  128. LONGLONG *pFreeBytes,
  129. LONGLONG *pCapacity,
  130. HRESULT *pLastError,
  131. SHORT *pNextRemoteDataSet,
  132. OLECHAR **pDescription,
  133. ULONG descriptionBufferSize,
  134. HSM_JOB_MEDIA_TYPE *pType,
  135. OLECHAR **pName,
  136. ULONG nameBufferSize,
  137. BOOL *pReadOnly,
  138. FILETIME *pUpdate,
  139. LONGLONG *pLogicalValidBytes,
  140. BOOL *pRecreate);
  141. STDMETHOD( GetMediaSubsystemId )( GUID *pRmsMediaId );
  142. STDMETHOD( GetName )( OLECHAR **pName, ULONG bufferSize);
  143. STDMETHOD( GetNextRemoteDataSet )( SHORT *pNextRemoteDataSet );
  144. STDMETHOD( GetRecallOnlyStatus )( BOOL *pRecallOnlyStatus );
  145. STDMETHOD( GetRecreate )( BOOL *pRecreate );
  146. STDMETHOD( GetStoragePoolId )( GUID *pStoragePoolId );
  147. STDMETHOD( GetType )( HSM_JOB_MEDIA_TYPE *pType );
  148. STDMETHOD( GetUpdate)( FILETIME *pUpdate );
  149. STDMETHOD( SetCapacity )( LONGLONG capacity);
  150. STDMETHOD( SetCopyDescription ) ( USHORT copyNumber, OLECHAR *name);
  151. STDMETHOD( SetCopyInfo )( USHORT copyNumber,
  152. GUID mediaSubsystemId,
  153. OLECHAR *description,
  154. OLECHAR *name,
  155. FILETIME update,
  156. HRESULT lastError,
  157. SHORT nextRemoteDataSet );
  158. STDMETHOD( SetCopyLastError )( USHORT copyNumber, HRESULT lastError );
  159. STDMETHOD( SetCopyMediaSubsystemId )( USHORT copyNumber, GUID mediaSybsystemMediaId );
  160. STDMETHOD( SetCopyName )( USHORT copyNumber, OLECHAR *barCode);
  161. STDMETHOD( SetCopyNextRemoteDataSet )( USHORT copyNumber, SHORT nextRemoteDataSet);
  162. STDMETHOD( SetCopyUpdate )( USHORT copyNumber, FILETIME update );
  163. STDMETHOD( SetDescription )(OLECHAR *description);
  164. STDMETHOD( SetFreeBytes )( LONGLONG FreeBytes );
  165. STDMETHOD( SetId )( GUID id);
  166. STDMETHOD( SetLastError )( HRESULT lastError);
  167. STDMETHOD( SetLastKnownGoodMasterInfo )( GUID mediaId,
  168. GUID mediaSubsystemMediaId,
  169. GUID storagePoolId,
  170. LONGLONG FreeBytes,
  171. LONGLONG Capacity,
  172. HRESULT lastError,
  173. OLECHAR *description,
  174. HSM_JOB_MEDIA_TYPE type,
  175. OLECHAR *name,
  176. BOOL ReadOnly,
  177. FILETIME update,
  178. SHORT nextRemoteDataSet);
  179. STDMETHOD( SetLogicalValidBytes )( LONGLONG logicalValidBytes);
  180. STDMETHOD( SetMediaInfo )( GUID mediaId,
  181. GUID mediaSubsystemMediaId,
  182. GUID storagePoolId,
  183. LONGLONG FreeBytes,
  184. LONGLONG Capacity,
  185. HRESULT lastError,
  186. SHORT nextRemoteDataSet,
  187. OLECHAR *description,
  188. HSM_JOB_MEDIA_TYPE type,
  189. OLECHAR *name,
  190. BOOL ReadOnly,
  191. FILETIME update,
  192. LONGLONG logicalValidBytes,
  193. BOOL recreate);
  194. STDMETHOD( SetMediaSubsystemId )( GUID rmsMediaId );
  195. STDMETHOD( SetName )( OLECHAR *barCode);
  196. STDMETHOD( SetNextRemoteDataSet )( SHORT nextRemoteDataSet );
  197. STDMETHOD( SetRecallOnlyStatus )( BOOL readOnlyStatus );
  198. STDMETHOD( SetRecreate )( BOOL recreate );
  199. STDMETHOD( SetStoragePoolId )( GUID storagePoolId );
  200. STDMETHOD( SetType )( HSM_JOB_MEDIA_TYPE type );
  201. STDMETHOD( SetUpdate)( FILETIME update );
  202. STDMETHOD( DeleteCopy)( USHORT copyNumber );
  203. STDMETHOD( RecreateMaster )( void );
  204. STDMETHOD( UpdateLastKnownGoodMaster )( void );
  205. private:
  206. //
  207. // Helper functions
  208. //
  209. STDMETHOD( WriteToDatabase )( void );
  210. HSM_MEDIA_MASTER m_Master; //Media master information
  211. BOOL m_Recreate; //True if the master is to
  212. //..be recreated - no more
  213. //..data is migrated to
  214. //..media in this state.
  215. //..May be set through the
  216. //..UI and changed when
  217. //..master is recreated.
  218. LONGLONG m_LogicalValidBytes; //Amount of valid data if
  219. //..space reclamation were
  220. //..to occur.
  221. HSM_MEDIA_MASTER m_LastKnownGoodMaster; //Last known good media
  222. //..master information
  223. HSM_MEDIA_COPY m_Copy[HSM_MAX_NUMBER_MEDIA_COPIES]; //Media copy information
  224. };