home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / lvmtlk12.zip / include / lvm_type.h < prev   
C/C++ Source or Header  |  2002-04-02  |  11KB  |  263 lines

  1. /*
  2. *
  3. *   Copyright (c) International Business Machines  Corp., 2000
  4. *
  5. *   This program is free software;  you can redistribute it and/or modify
  6. *   it under the terms of the GNU General Public License as published by
  7. *   the Free Software Foundation; either version 2 of the License, or
  8. *   (at your option) any later version.
  9. *
  10. *   This program is distributed in the hope that it will be useful,
  11. *   but WITHOUT ANY WARRANTY;  without even the implied warranty of
  12. *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
  13. *   the GNU General Public License for more details.
  14. *
  15. *   You should have received a copy of the GNU General Public License
  16. *   along with this program;  if not, write to the Free Software
  17. *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  18. *
  19. * Module: Bad_Block_Relocation_Feature.h
  20. */
  21.  
  22. /*
  23. * Change History:
  24. *
  25. */
  26.  
  27. /*
  28. * Description:  This module defines basic types used in the declaration of
  29. *               disk structures.
  30. *
  31. */
  32.  
  33. #ifndef LVM_TYPES_H_INCLUDED
  34.  
  35. #define LVM_TYPES_H_INCLUDED 1
  36.  
  37. #include "LVM_Gbls.h"       /* INTEGER16, INTEGER32, INTEGER, CARDINAL16, CARDINAL32,
  38. CARDINAL, REAL32, REAL64, BYTE, BOOLEAN, TRUE, FALSE, ADDRESS */
  39.  
  40. #if defined(__IBMCPP__) || defined(__IBMC__)
  41. #else
  42. #define _System
  43. #endif
  44.  
  45. #include "lvm_list.h"
  46.  
  47. /* The following types are used in the declaration of disk structures.  Disk structures
  48. have a defined size and internal structure which must be matched exactly.              */
  49.  
  50. /* 8 bytes. */
  51. #ifdef LONG_LONG_SUPPORTED
  52.  
  53. typedef long long QuadWord;
  54.  
  55. #else
  56.  
  57. typedef struct _QuadWord {
  58. unsigned long  High32Bits;
  59. unsigned long  Low32Bits;
  60. } QuadWord;
  61.  
  62. #endif
  63.  
  64. /* 4 bytes */
  65. typedef unsigned long DoubleWord;
  66.  
  67. /* 2 bytes */
  68. typedef short unsigned int Word;
  69.  
  70. /* 1 byte */
  71. typedef unsigned char Byte;
  72.  
  73. /* The following types are used internally by LVM.  */
  74.  
  75. /* Define a Partition Sector Number.  A Partition Sector Number is relative to the start of a partition.
  76. The first sector in a partition is PSN 0. */
  77. typedef unsigned long PSN;
  78.  
  79. /* Define a Logical Sector Number.  A Logical Sector Number is relative to the start of a volume.
  80. The first sector in a volume is LSN 0. */
  81. typedef unsigned long LSN;
  82.  
  83. /* Define a Logical Block Address.  A Logical Block Address is relative to the start of a
  84. physical device - a disk drive.  The first sector on a disk drive is LBA 0. */
  85. typedef unsigned long LBA;
  86.  
  87. /* XLATOFF */
  88.  
  89. /* The following define sets the maximum number of LVM classes for which structures and storage will be reserved. */
  90. #define MAXIMUM_LVM_CLASSES   3
  91.  
  92. /* The following enum defines the various LVM classes to which a "feature" may belong.
  93. An LVM Plugin is used to implement a "feature", so "plugin" and "feature" are really synonyms. */
  94. typedef enum _LVM_Classes {
  95. Partition_Class,           /* For "features" which must operate on a partition level - i.e. Bad Block Relocation. */
  96. Aggregate_Class,           /* For "features" which combine partitions into a single logical entity - i.e. Drive Linking. */
  97. Volume_Class              /* For "features" which operate best on a volume level - i.e. encryption, mirroring etc. */
  98. } LVM_Classes;
  99.  
  100. /* An LVM plugin may belong to one or more classes.  For each class to which it belongs, certain attributes must be defined.
  101. This structure tracks those attributes for a class.                                                                        */
  102. typedef struct _LVM_Class_Attributes{
  103. BOOLEAN      ClassMember;      /* TRUE if a member of this class, FALSE otherwise. */
  104. BOOLEAN      GlobalExclusive;  /* TRUE if this plugin can not work with any other plugin - i.e. it
  105. must be the only "feature" on the volume, besides the built in feature of BBR. */
  106. BOOLEAN      TopExclusive;     /* TRUE if this plugin must be the topmost plugin in this class. */
  107. BOOLEAN      BottomExclusive;  /* TRUE if this plugin must be the bottommost plugin in this class. */
  108. BOOLEAN      ClassExclusive;   /* TRUE if this plugin will not work with any other plugin in this class. */
  109. CARDINAL32   Weight_Factor;    /* A value between 1 and 100 which is used to guide the LVM interfaces when attempting to
  110. establish a default ordering for plugins within this class.  A value of 1
  111. indicates that this plugin wants to be as close to the bottom of the plugins
  112. in this class as possible.  A value of 100 means that this plugin wants to
  113. be as close to being the topmost plugin in this class as possible.  This value
  114. is only used if none of the "exclusive" flags are set.                                    */
  115. } LVM_Class_Attributes;
  116.  
  117. /* The following enum specifies the interface types that LVM supports, and hence any plugin must support. */
  118. typedef enum _LVM_Interface_Types{
  119. PM_Interface,
  120. VIO_Interface,           /* LVM.EXE is a VIO app. since it is used during install, and during recovery scenarios where PM/Java may not be available. */
  121. Java_Interface          /* The LVM GUI is written in Java. */
  122. } LVM_Interface_Types;
  123.  
  124. #define MAXIMUM_LVM_INTERFACE_TYPES  3
  125.  
  126. /* The following structures define what functions must be supported for each interface type. */
  127. typedef struct _LVM_OS2_Native_Support{
  128. void (* _System Create_and_Configure) ( CARDINAL32 ID, ADDRESS InputBuffer, CARDINAL32 InputBufferSize, ADDRESS * OutputBuffer, CARDINAL32 * OutputBufferSize, CARDINAL32 * Error_Code);    /* Native OS/2 */
  129. void (* _System Display_Status) ( ADDRESS Volume_Handle, CARDINAL32 * Error_Code );              /* Native OS/2 */
  130. void (* _System Control_Panel) (ADDRESS Volume_Handle, CARDINAL32 * Error_Code );                /* Native OS/2 */
  131. void (* _System Help_Panel) (CARDINAL32 Help_Index, CARDINAL32 * Error_Code);                    /* Native OS/2 */
  132. } LVM_OS2_Native_Support;
  133.  
  134. typedef struct _LVM_Interface_Support {
  135. BOOLEAN  Interface_Supported;
  136. union {
  137. char *                   Java_Interface_Class;        /* Java */
  138. LVM_OS2_Native_Support   VIO_PM_Calls;                      /* VIO/PM */
  139. };
  140. } LVM_Interface_Support;
  141.  
  142. /* The following define the default help indicies which must be supported by the Help_Panel function.  NOTE:  Index
  143. values from 0 to 100 are reserved by LVM.  The Plugin may, for its own use, use any values above 100.               */
  144. #define HELP_PLUGIN_DESCRIPTION    0
  145.  
  146. /* The following define the maximum length of the names which can be used to represent a feature in LVM.  The
  147. maximum name length for a feature is 30 characters plus the trailing NULL character.  For command line parsing,
  148. though, a shorter name is preferable!  Thus, the "short" name for a feature will be limited to 10 characters
  149. plus the trailing NULL character.  The "short" name will be used for command line purposes, while the regular
  150. name will be used by all other interfaces.                                                                        */
  151. #define MAX_FEATURE_NAME_LENGTH        31
  152. #define MAX_FEATURE_SHORT_NAME_LENGTH  11
  153. #define MAX_OEM_INFO_LENGTH           255
  154.  
  155. /* The following definitions are used to control and access the various "features" available through the LVM Engine, such as Drive Linking and BBR. */
  156. typedef struct _Feature_ID_Data {
  157. char         Name[MAX_FEATURE_NAME_LENGTH];             /* Feature Name, for use in menus and command line parsing. */
  158. char         Short_Name[MAX_FEATURE_SHORT_NAME_LENGTH]; /* The name/code used to represent this feature during command line parsing. */
  159. char         OEM_Info[MAX_OEM_INFO_LENGTH];             /* Name and copyright info. of the manufacturer, i.e. IBM, Vinca, etc. */
  160. CARDINAL32   ID;                                        /* Numeric Feature ID. */
  161. CARDINAL32   Major_Version_Number;                      /* The version number of this feature. */
  162. CARDINAL32   Minor_Version_Number;                      /* The version number of this feature. */
  163. CARDINAL32   LVM_Major_Version_Number;                  /* The version of LVM that this feature was designed to work with. */
  164. CARDINAL32   LVM_Minor_Version_Number;                  /* The version of LVM that this feature was designed to work with. */
  165. LVM_Classes  Preferred_Class;                           /* The class from which this "feature" prefers to be chosen.  Encryption can be performed
  166. at the partition level or the volume level, and may therefore belong to both the
  167. Partition_Class and the Volume_Class.  However, it is preferrable for it to be used
  168. on the volume level instead of at the partition level.  Thus, its perferred class would
  169. be the Volume_Class, but it would still be a member of both the Volume_Class and the
  170. Partition_Class.                                                                              */
  171. LVM_Class_Attributes   ClassData[MAXIMUM_LVM_CLASSES];  /* The attributes for each of the LVM classes that this "feature" is in. */
  172. LVM_Interface_Support  Interface_Support[MAXIMUM_LVM_INTERFACE_TYPES];  /* The functions and classes for each of the video modes that LVM can run it. */
  173. } Feature_ID_Data;
  174.  
  175. /* The following defines the TAG value used to identify an item of type Feature_ID_Data in a DLIST. */
  176. #define FEATURE_ID_DATA_TAG 354385972
  177.  
  178. /* The following definitions are used for command line processing.  As the command line is processed,
  179. the command line is first broken up into tokens.  Each token has a "characterization", which indicates
  180. what the token is thought to be.                                                                        */
  181.  
  182. typedef enum {
  183. LVM_AcceptableCharsStr,
  184. LVM_All,
  185. LVM_BestFit,
  186. LVM_BootDOS,
  187. LVM_BootOS2,
  188. LVM_Bootable,
  189. LVM_CR,
  190. LVM_CRI,
  191. LVM_Compatibility,
  192. LVM_Drive,
  193. LVM_Existing,
  194. LVM_Expand,
  195. LVM_FS,
  196. LVM_FirstFit,
  197. LVM_Freespace,
  198. LVM_FromEnd,
  199. LVM_FromLargest,
  200. LVM_FromSmallest,
  201. LVM_FromStart,
  202. LVM_LVM,
  203. LVM_LastFit,
  204. LVM_Logical,
  205. LVM_New,
  206. LVM_NoBoot,
  207. LVM_NonBootable,
  208. LVM_NotBootable,
  209. LVM_Partition,
  210. LVM_Primary,
  211. LVM_RB,
  212. LVM_Size,
  213. LVM_Unusable,
  214. LVM_Unused,
  215. LVM_Volume,
  216. LVM_Volumes,
  217. LVM_Comma,
  218. LVM_Number,
  219. LVM_Colon,
  220. LVM_Space,
  221. LVM_Tab,
  222. LVM_MultiSpace,
  223. LVM_MultiTab,
  224. LVM_String,
  225. LVM_FileNameStr,
  226. LVM_SemiColon,
  227. LVM_Eof,
  228. LVM_Separator,
  229. LVM_Open_Paren,                    /* ( */
  230. LVM_Close_Paren,                   /* ) */
  231. LVM_Open_Bracket,                  /* [ */
  232. LVM_Close_Bracket,                 /* ] */
  233. LVM_Open_Brace,                    /* { */
  234. LVM_Close_Brace,                   /* } */
  235. LVM_EQ_Sign,                       /* = */
  236. LVM_Bootmgr,
  237. LVM_Create,
  238. LVM_Delete,
  239. LVM_DriveLetter,
  240. LVM_File,
  241. LVM_Hide,
  242. LVM_Install,
  243. LVM_NewMBR,
  244. LVM_Query,
  245. LVM_RediscoverPRM,
  246. LVM_SetName,
  247. LVM_SetStartable,
  248. LVM_SI,
  249. LVM_SlashSize,
  250. LVM_StartLog
  251. } Token_Characterizations;
  252.  
  253. typedef struct _LVM_Token{
  254. char *                   TokenText;  /* The actual text of the token. */
  255. Token_Characterizations  TokenType;  /* What the token is thought to be. */
  256. CARDINAL32               Position;   /* The position of the first character of the token on the command line. */
  257. } LVM_Token;
  258.  
  259. #define LVM_TOKEN_TAG    28387473
  260. /* XLATON */
  261.  
  262. #endif
  263.