PageRenderTime 78ms CodeModel.GetById 26ms RepoModel.GetById 0ms app.codeStats 2ms

/packages/os2units/src/lvm.pas

https://github.com/slibre/freepascal
Pascal | 5232 lines | 723 code | 189 blank | 4320 comment | 0 complexity | 28c7140800a34d5da5d8fd98da9400c0 MD5 | raw file
Possible License(s): LGPL-2.0, LGPL-2.1, LGPL-3.0
  1. {
  2. Copyright (c) International Business Machines Corp., 2000
  3. Copyright (c) 2003 Yuri Prokushev
  4. This module defines the interface to LVM.DLL, which is the
  5. engine that performs all of the disk partitioning/volume
  6. creation work.
  7. This program is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation; either version 2 of the License, or
  10. (at your option) any later version.
  11. This program is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
  14. the GNU General Public License for more details.
  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. Unit LVM;
  20. {$PACKRECORDS C}
  21. Interface
  22. {$ifdef os2}
  23. {$define lvm1}
  24. {$endif}
  25. {$ifdef linux}
  26. {$define lvm2}
  27. {$endif}
  28. // The number of bytes in a sector on the disk.
  29. const
  30. BYTES_PER_SECTOR=512;
  31. //The maximum number of cylinders, heads, and sectors that a partition table entry can accomodate.
  32. //Cylinders are numbered 0 - 1023, for a maximum of 1024 cylinders.
  33. //eads are numbered 0 - 255, for a maximum of 256 heads.
  34. //Sectors are numbered 1 - 63, for a maximum of 63 sectors per track.
  35. const
  36. MAX_CYLINDERS= 1024;
  37. MAX_HEADS = 256;
  38. MAX_SECTORS = 63;
  39. // The following define the values used to indicate that a partition table entry is for an EBR, not a partition.
  40. const
  41. EBR_BOOT_INDICATOR = 0;
  42. EBR_FORMAT_INDICATOR = 5;
  43. // The following define is used as the default Format_Indicator for new non-primary partitions.
  44. const
  45. NEW_LOGICAL_DRIVE_FORMAT_INDICATOR = $6;
  46. // The following define is used as the default Format_Indicator for a new non-active primary partitions.
  47. const
  48. NEW_PRIMARY_PARTITION_FORMAT_INDICATOR = $16;
  49. // The following define is used as the default Format_Indicator for a new active primary partition.
  50. const
  51. NEW_ACTIVE_PRIMARY_PARTITION_FORMAT_INDICATOR = $06;
  52. // The following define is used to hold the value of the Boot_Indicator for active partitions.
  53. const
  54. ACTIVE_PARTITION = $80;
  55. // Define the size of a Partition Name. Partition Names are user defined names given to a partition.
  56. const
  57. PARTITION_NAME_SIZE = 20;
  58. // Define the size of a volume name. Volume Names are user defined names given to a volume.
  59. const
  60. VOLUME_NAME_SIZE = 20;
  61. // Define the size of a disk name. Disk Names are user defined names given to physical disk drives in the system.
  62. const
  63. DISK_NAME_SIZE = 20;
  64. // The name of the filesystem in use on a partition. This name may be up to 12 ( + NULL terminator) characters long.
  65. const
  66. FILESYSTEM_NAME_SIZE = 20;
  67. // The comment field is reserved but is not currently used. This is for future expansion and use.
  68. const
  69. COMMENT_SIZE = 81;
  70. // Define the minimum number of sectors to reserve on the disk for Boot Manager.
  71. const
  72. BOOT_MANAGER_SIZE = 2048;
  73. // An INTEGER number is a whole number, either + or -.
  74. //The number appended to the INTEGER key word indicates the number of bits
  75. //used to represent an INTEGER of that type.
  76. type
  77. INTEGER16=SmallInt;
  78. INTEGER32=LongInt;
  79. INTEGER=LongInt;
  80. // A CARDINAL number is a positive integer >= 0.
  81. //The number appended to the CARDINAL key word indicates the number of bits
  82. //used to represent a CARDINAL of that type.
  83. type
  84. CARDINAL16=Word;
  85. CARDINAL32 = Cardinal;
  86. (*
  87. /* A REAL number is a floating point number. */
  88. typedef float REAL32;
  89. typedef double REAL64;
  90. *)
  91. REAL32 = double;
  92. REAL64 = double;
  93. // An ADDRESS variable is one which holds an address. The address can contain
  94. //anything, or even be invalid. It is just an address which is presumed to
  95. //hold some kind of data.
  96. Type
  97. ADDRESS=Pointer;
  98. Type
  99. pSTRING=PChar;
  100. // 4 bytes
  101. Type
  102. DoubleWord=Cardinal;
  103. //* The following types are used in the declaration of disk structures. Disk structures
  104. //have a defined size and internal structure which must be matched exactly. */
  105. //* 8 bytes. */
  106. type
  107. QuadWord=QWord;
  108. // The following types are used internally by LVM. */
  109. // Define a Partition Sector Number. A Partition Sector Number is relative to the start of a partition.
  110. //The first sector in a partition is PSN 0.
  111. type
  112. PSN=Cardinal;
  113. // Define a Logical Sector Number. A Logical Sector Number is relative to the start of a volume.
  114. //The first sector in a volume is LSN 0.
  115. type
  116. LSN=Cardinal;
  117. // Define a Logical Block Address. A Logical Block Address is relative to the start of a
  118. //physical device - a disk drive. The first sector on a disk drive is LBA 0.
  119. type
  120. LBA=Cardinal;
  121. // The following define sets the maximum number of LVM classes for which structures and storage will be reserved.
  122. const
  123. MAXIMUM_LVM_CLASSES = 3;
  124. // The following enum defines the various LVM classes to which a "feature" may belong.
  125. // An LVM Plugin is used to implement a "feature", so "plugin" and "feature" are really synonyms.
  126. type
  127. _LVM_Classes = (
  128. Partition_Class, // For "features" which must operate on a partition level - i.e. Bad Block Relocation.
  129. Aggregate_Class, // For "features" which combine partitions into a single logical entity - i.e. Drive Linking.
  130. Volume_Class // For "features" which operate best on a volume level - i.e. encryption, mirroring etc.
  131. );
  132. LVM_Classes = _LVM_Classes;
  133. // An LVM plugin may belong to one or more classes. For each class to which it belongs, certain attributes must be defined.
  134. //This structure tracks those attributes for a class.
  135. type
  136. _LVM_Class_Attributes=record
  137. ClassMember: BOOLEAN; // TRUE if a member of this class, FALSE otherwise.
  138. GlobalExclusive: BOOLEAN; // TRUE if this plugin can not work with any other plugin - i.e. it
  139. //must be the only "feature" on the volume, besides the built in feature of BBR.
  140. TopExclusive: BOOLEAN; // TRUE if this plugin must be the topmost plugin in this class.
  141. BottomExclusive: BOOLEAN; // TRUE if this plugin must be the bottommost plugin in this class.
  142. ClassExclusive: BOOLEAN; // TRUE if this plugin will not work with any other plugin in this class.
  143. Weight_Factor: CARDINAL32; // A value between 1 and 100 which is used to guide the LVM interfaces when attempting to
  144. //establish a default ordering for plugins within this class. A value of 1
  145. //indicates that this plugin wants to be as close to the bottom of the plugins
  146. //in this class as possible. A value of 100 means that this plugin wants to
  147. //be as close to being the topmost plugin in this class as possible. This value
  148. //is only used if none of the "exclusive" flags are set.
  149. end;
  150. LVM_Class_Attributes=_LVM_Class_Attributes;
  151. // The following enum specifies the interface types that LVM supports, and hence any plugin must support.
  152. _LVM_Interface_Types= (
  153. PM_Interface,
  154. 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.
  155. Java_Interface // The LVM GUI is written in Java.
  156. );
  157. LVM_Interface_Types=_LVM_Interface_Types;
  158. const
  159. MAXIMUM_LVM_INTERFACE_TYPES = 3;
  160. //* The following structures define what functions must be supported for each interface type.
  161. type
  162. PADDRESS=^ADDRESS;
  163. PCARDINAL32=^CARDINAL32;
  164. _LVM_OS2_Native_Support=record
  165. //void (* _System Create_and_Configure) ( CARDINAL32 ID, ADDRESS InputBuffer, CARDINAL32 InputBufferSize, ADDRESS * OutputBuffer, CARDINAL32 * OutputBufferSize, CARDINAL32 * Error_Code);
  166. Create_and_Configure: procedure(ID: CARDINAL32; InputBuffer: ADDRESS; InputBufferSize: CARDINAL32; OutputBuffer: PADDRESS; OutputBufferSize: PCARDINAL32; Error_Code: PCARDINAL32);
  167. //void (* _System Display_Status) ( ADDRESS Volume_Handle, CARDINAL32 * Error_Code );
  168. Display_Status: procedure(Volume_Handle: ADDRESS; Error_Code: PCARDINAL32 );
  169. //void (* _System Control_Panel) (ADDRESS Volume_Handle, CARDINAL32 * Error_Code );
  170. Control_Panel: procedure(Volume_Handle: ADDRESS; Error_Code: PCARDINAL32 );
  171. //void (* _System Help_Panel) (CARDINAL32 Help_Index, CARDINAL32 * Error_Code);
  172. Help_Panel: procedure(Help_Index: CARDINAL32; Error_Code: PCARDINAL32);
  173. end;
  174. LVM_OS2_Native_Support=_LVM_OS2_Native_Support;
  175. type
  176. _LVM_Interface_Support=record
  177. Interface_Supported: BOOLEAN;
  178. case longint of
  179. 0 : ( Java_Interface_Class : ^char );
  180. 1 : ( VIO_PM_Calls : LVM_OS2_Native_Support );
  181. end;
  182. LVM_Interface_Support=_LVM_Interface_Support;
  183. //* The following define the default help indicies which must be supported by the Help_Panel function. NOTE: Index
  184. //values from 0 to 100 are reserved by LVM. The Plugin may, for its own use, use any values above 100.
  185. const
  186. HELP_PLUGIN_DESCRIPTION = 0;
  187. // The following define the maximum length of the names which can be used to represent a feature in LVM. The
  188. //maximum name length for a feature is 30 characters plus the trailing NULL character. For command line parsing,
  189. //though, a shorter name is preferable! Thus, the "short" name for a feature will be limited to 10 characters
  190. //plus the trailing NULL character. The "short" name will be used for command line purposes, while the regular
  191. //name will be used by all other interfaces.
  192. const
  193. MAX_FEATURE_NAME_LENGTH = 31;
  194. MAX_FEATURE_SHORT_NAME_LENGTH = 11;
  195. MAX_OEM_INFO_LENGTH =255;
  196. // The following definitions are used to control and access the various "features" available through the LVM Engine, such as Drive Linking and BBR.
  197. type
  198. _Feature_ID_Data=record
  199. Name: Array[0..MAX_FEATURE_NAME_LENGTH-1] of char; // Feature Name, for use in menus and command line parsing.
  200. Short_Name: Array[0..MAX_FEATURE_SHORT_NAME_LENGTH-1] of char; // The name/code used to represent this feature during command line parsing.
  201. OEM_Info: Array[0..MAX_OEM_INFO_LENGTH-1] of char; // Name and copyright info. of the manufacturer, i.e. IBM, Vinca, etc.
  202. ID: CARDINAL32; // Numeric Feature ID.
  203. Major_Version_Number: CARDINAL32; // The version number of this feature.
  204. Minor_Version_Number: CARDINAL32; // The version number of this feature.
  205. LVM_Major_Version_Number: CARDINAL32; // The version of LVM that this feature was designed to work with.
  206. LVM_Minor_Version_Number: CARDINAL32; // The version of LVM that this feature was designed to work with.
  207. Preferred_Class: LVM_Classes; // The class from which this "feature" prefers to be chosen. Encryption can be performed
  208. //at the partition level or the volume level, and may therefore belong to both the
  209. //Partition_Class and the Volume_Class. However, it is preferrable for it to be used
  210. //on the volume level instead of at the partition level. Thus, its perferred class would
  211. //be the Volume_Class, but it would still be a member of both the Volume_Class and the
  212. //Partition_Class.
  213. ClassData: Array[0..MAXIMUM_LVM_CLASSES-1] of LVM_Class_Attributes; // The attributes for each of the LVM classes that this "feature" is in.
  214. Interface_Support: Array[0..MAXIMUM_LVM_INTERFACE_TYPES-1] of LVM_Interface_Support; // The functions and classes for each of the video modes that LVM can run it.
  215. end;
  216. Feature_ID_Data=_Feature_ID_Data;
  217. // The following defines the TAG value used to identify an item of type Feature_ID_Data in a DLIST.
  218. const
  219. FEATURE_ID_DATA_TAG = 354385972;
  220. // The following are invariant for a disk drive.
  221. Type
  222. Drive_Control_Record = record
  223. Drive_Number: CARDINAL32; // OS/2 Drive Number for this drive.
  224. Drive_Size: CARDINAL32; // The total number of sectors on the drive.
  225. Drive_Serial_Number: DoubleWord; // The serial number assigned to this drive. For info. purposes only.
  226. Drive_Handle: ADDRESS; // Handle used for operations on the disk that this record corresponds to.
  227. Cylinder_Count: CARDINAL32; // The number of cylinders on the drive.
  228. Heads_Per_Cylinder: CARDINAL32; // The number of heads per cylinder for this drive.
  229. Sectors_Per_Track: CARDINAL32; // The number of sectors per track for this drive.
  230. Drive_Is_PRM: BOOLEAN; // Set to TRUE if this drive is a PRM.
  231. Reserved: Array[0..3-1] of BYTE; // Alignment.
  232. end;
  233. // The following structure is returned by the Get_Drive_Control_Data function.
  234. Drive_Control_Array=record
  235. Drive_Control_Data: ^Drive_Control_Record; // An array of drive control records.
  236. Count: CARDINAL32; // The number of entries in the array of drive control records.
  237. end;
  238. // The following structure defines the information that can be changed for a specific disk drive.
  239. Drive_Information_Record=record
  240. Total_Available_Sectors: CARDINAL32; // The number of sectors on the disk which are not currently assigned to a partition.
  241. Largest_Free_Block_Of_Sectors: CARDINAL32; // The number of sectors in the largest contiguous block of available sectors.
  242. Corrupt_Partition_Table: BOOLEAN; // If TRUE, then the partitioning information found on the drive is incorrect!
  243. Unusable: BOOLEAN; // If TRUE, the drive's MBR is not accessible and the drive can not be partitioned.
  244. IO_Error: BOOLEAN; // If TRUE, then the last I/O operation on this drive failed!
  245. Is_Big_Floppy: BOOLEAN; // If TRUE, then the drive is a PRM formatted as a big floppy (i.e. the old style removable media support).
  246. Drive_Name: Array[0..DISK_NAME_SIZE-1] of Char; // User assigned name for this disk drive.
  247. end;
  248. Partition_Information_Record=record
  249. Partition_Handle: ADDRESS; // The handle used to perform operations on this partition.
  250. Volume_Handle: ADDRESS; // If this partition is part of a volume, this will be the handle of
  251. //the volume. If this partition is NOT part of a volume, then this
  252. //handle will be 0.
  253. Drive_Handle: ADDRESS; // The handle for the drive this partition resides on.
  254. Partition_Serial_Number: DoubleWord; // The serial number assigned to this partition.
  255. Partition_Start: CARDINAL32; // The LBA of the first sector of the partition.
  256. True_Partition_Size: CARDINAL32; // The total number of sectors comprising the partition.
  257. Usable_Partition_Size: CARDINAL32; // The size of the partition as reported to the IFSM. This is the
  258. //size of the partition less any LVM overhead.
  259. Boot_Limit: CARDINAL32; // The maximum number of sectors from this block of free space that can be used to
  260. //create a bootable partition if you allocate from the beginning of the block of
  261. //free space.
  262. Spanned_Volume: BOOLEAN; // TRUE if this partition is part of a multi-partition volume.
  263. Primary_Partition: BOOLEAN; // True or False. Any non-zero value here indicates that
  264. //this partition is a primary partition. Zero here indicates
  265. //that this partition is a "logical drive" - i.e. it resides
  266. //inside of an extended partition.
  267. Active_Flag: BYTE; // 80 = Partition is marked as being active.
  268. // 0 = Partition is not active.
  269. OS_Flag: BYTE; // This field is from the partition table. It is known as the
  270. //OS flag, the Partition Type Field, Filesystem Type, and
  271. //various other names.
  272. //Values of interest
  273. //If this field is: (values are in hex)
  274. //07 = The partition is a compatibility partition formatted for use
  275. //with an installable filesystem, such as HPFS or JFS.
  276. //00 = Unformatted partition
  277. //01 = FAT12 filesystem is in use on this partition.
  278. //04 = FAT16 filesystem is in use on this partition.
  279. //0A = OS/2 Boot Manager Partition
  280. //35 = LVM partition
  281. //84 = OS/2 FAT16 partition which has been relabeled by Boot Manager to "Hide" it.
  282. Partition_Type: BYTE; // 0 = Free Space
  283. //1 = LVM Partition (Part of an LVM Volume.)
  284. //2 = Compatibility Partition
  285. //All other values are reserved for future use.
  286. Partition_Status: BYTE; // 0 = Free Space
  287. //1 = In Use - i.e. already assigned to a volume.
  288. //2 = Available - i.e. not currently assigned to a volume.
  289. On_Boot_Manager_Menu: BOOLEAN; // Set to TRUE if this partition is not part of a Volume yet is on the Boot Manager Menu.
  290. Reserved: BYTE; // Alignment.
  291. Volume_Drive_Letter: char; // The drive letter assigned to the volume that this partition is a part of.
  292. Drive_Name: Array[0..DISK_NAME_SIZE-1] of char; // User assigned name for this disk drive.
  293. File_System_Name: Array[0..FILESYSTEM_NAME_SIZE-1] of char;// The name of the filesystem in use on this partition, if it is known.
  294. Partition_Name: Array[0..PARTITION_NAME_SIZE-1] of char; // The user assigned name for this partition.
  295. Volume_Name: Array[0..VOLUME_NAME_SIZE-1] of char; // If this partition is part of a volume, then this will be the
  296. //name of the volume that this partition is a part of. If this
  297. //record represents free space, then the Volume_Name will be
  298. //"FREE SPACE xx", where xx is a unique numeric ID generated by
  299. //LVM.DLL. Otherwise it will be an empty string.
  300. end;
  301. // The following defines are for use with the Partition_Type field in the Partition_Information_Record.
  302. const
  303. pt_FREE_SPACE_PARTITION = 0;
  304. pt_LVM_PARTITION = 1;
  305. pt_COMPATIBILITY_PARTITION = 2;
  306. // The following defines are for use with the Partition_Status field in the Partition_Information_Record.
  307. const
  308. PARTITION_IS_IN_USE = 1;
  309. PARTITION_IS_AVAILABLE = 2;
  310. PARTITION_IS_FREE_SPACE = 0;
  311. // The following structure is returned by various functions in the LVM Engine.
  312. type
  313. Partition_Information_Array=record
  314. Partition_Array: ^Partition_Information_Record; // An array of Partition_Information_Records.
  315. Count: CARDINAL32; // The number of entries in the Partition_Array.
  316. end;
  317. // The following items are invariant for a volume.
  318. type
  319. Volume_Control_Record=record
  320. Volume_Serial_Number: DoubleWord; // The serial number assigned to this volume.
  321. Volume_Handle: ADDRESS; // The handle used to perform operations on this volume.
  322. Compatibility_Volume: BOOLEAN; // TRUE indicates that this volume is compatible with older versions of OS/2.
  323. //FALSE indicates that this is an LVM specific volume and can not be used without OS2LVM.DMD.
  324. Device_Type: BYTE; // Indicates what type of device the Volume resides on:
  325. //0 = Hard Drive under LVM Control
  326. //1 = PRM under LVM Control
  327. //2 = CD-ROM
  328. //3 = Network drive
  329. //4 = Unknown device NOT under LVM Control
  330. Reserved: Array[0..2-1] of BYTE; // Alignment.
  331. end;
  332. // The following define the device types used in the Device_Type field of the Volume_Control_Record.
  333. const
  334. LVM_HARD_DRIVE = 0;
  335. LVM_PRM = 1;
  336. NON_LVM_CDROM = 2;
  337. NETWORK_DRIVE = 3;
  338. NON_LVM_DEVICE = 4;
  339. // The following structure is returned by the Get_Volume_Control_Data function.
  340. type
  341. Volume_Control_Array=record
  342. Volume_Control_Data: ^Volume_Control_Record; // An array of volume control records.
  343. Count: CARDINAL32; // The number of entries in the array of volume control records.
  344. end;
  345. // The following information about a volume can (and often does) vary.
  346. type
  347. Volume_Information_Record=record
  348. Volume_Size: CARDINAL32; // The number of sectors comprising the volume.
  349. Partition_Count: CARDINAL32; // The number of partitions which comprise this volume.
  350. Drive_Letter_Conflict: CARDINAL32; // 0 indicates that the drive letter preference for this volume is unique.
  351. //1 indicates that the drive letter preference for this volume
  352. //is not unique, but this volume got its preferred drive letter anyway.
  353. //2 indicates that the drive letter preference for this volume
  354. //is not unique, and this volume did NOT get its preferred drive letter.
  355. //4 indicates that this volume is currently "hidden" - i.e. it has
  356. //no drive letter preference at the current time.
  357. Compatibility_Volume: BOOLEAN; // TRUE if this is for a compatibility volume, FALSE otherwise.
  358. Bootable: BOOLEAN; // Set to TRUE if this volume appears on the Boot Manager menu, or if it is
  359. //a compatibility volume and its corresponding partition is the first active
  360. //primary partition on the first drive.
  361. Drive_Letter_Preference: char; // The drive letter that this volume desires to be.
  362. Current_Drive_Letter: char; // The drive letter currently used to access this volume. May be different than
  363. //Drive_Letter_Preference if there was a conflict ( i.e. Drive_Letter_Preference
  364. //is already in use by another volume ).
  365. Initial_Drive_Letter: char; // The drive letter assigned to this volume by the operating system when LVM was started.
  366. //This may be different from the Drive_Letter_Preference if there were conflicts, and
  367. //may be different from the Current_Drive_Letter. This will be 0x0 if the Volume did
  368. //not exist when the LVM Engine was opened (i.e. it was created during this LVM session).
  369. New_Volume: BOOLEAN; // Set to FALSE if this volume existed before the LVM Engine was opened. Set to
  370. //TRUE if this volume was created after the LVM Engine was opened.
  371. Status: BYTE; // 0 = None.
  372. //1 = Bootable
  373. //2 = Startable
  374. //3 = Installable.
  375. Reserved_1: BYTE;
  376. Volume_Name: Array[0..VOLUME_NAME_SIZE-1] of char; // The user assigned name for this volume.
  377. File_System_Name: Array[0..FILESYSTEM_NAME_SIZE-1] of char;// The name of the filesystem in use on this partition, if it is known.
  378. end;
  379. // The following structure is used to return the feature information for the installed features, or the features on a volume.
  380. type
  381. Feature_Information_Array=record
  382. Count: CARDINAL32;
  383. Feature_Data: ^Feature_ID_Data;
  384. end;
  385. // The following structure defines an item on the Boot Manager Menu.
  386. type
  387. Boot_Manager_Menu_Item=record
  388. Handle: ADDRESS; // A Volume or Partition handle.
  389. Volume: BOOLEAN; // If TRUE, then Handle is the handle of a Volume. Otherwise, Handle is the handle of a partition.
  390. end;
  391. // The following structure is used to get a list of the items on the partition manager menu.
  392. type
  393. Boot_Manager_Menu=record
  394. Menu_Items: ^Boot_Manager_Menu_Item;
  395. Count: CARDINAL32;
  396. end;
  397. // The following structure is used to specify an LVM Feature when creating a volume. Since LVM Features may be part of
  398. //more than one LVM Class, the specific class to be used with the feature must also be specified.
  399. type
  400. LVM_Feature_Specification_Record=record
  401. Feature_ID: CARDINAL32; // The feature ID of the feature to use.
  402. Actual_Class: LVM_Classes; // The LVM Class (supported by the specified feature) to use.
  403. Init_Data: ADDRESS; // The address of a buffer containing initialization data for this feature.
  404. //NULL if there is no initialization data being provided for this feature.
  405. end;
  406. // The following structure is used with the Get_Child_Handles function.
  407. Type
  408. LVM_Handle_Array_Record=record
  409. Count: CARDINAL32;
  410. Handles: ^ADDRESS;
  411. end;
  412. // The following preprocessor directives define the operations that can be performed on a partition, volume, or a block of free space.
  413. // These definitions represent bits in a 32 bit value returned by the Get_Valid_Options function.
  414. const
  415. CREATE_PRIMARY_PARTITION = 1;
  416. CREATE_LOGICAL_DRIVE = 2;
  417. DELETEPARTITION = 4;
  418. SET_ACTIVE_PRIMARY = 8;
  419. SET_PARTITION_ACTIVE = $10;
  420. SET_PARTITION_INACTIVE = $20;
  421. SETSTARTABLE = $40;
  422. INSTALLBOOTMANAGER = $80;
  423. REMOVEBOOTMANAGER = $100;
  424. SET_BOOT_MANAGER_DEFAULTS = $200;
  425. ADD_TO_BOOT_MANAGER_MENU = $400;
  426. REMOVE_FROM_BOOT_MANAGER_MENU = $800;
  427. DELETEVOLUME = $1000;
  428. HIDEVOLUME = $2000;
  429. EXPANDVOLUME = $4000;
  430. SET_VOLUME_INSTALLABLE = $8000;
  431. ASSIGNDRIVELETTER = $10000;
  432. CAN_BOOT_PRIMARY = $20000; // If a primary is created from this block of free space, then it can be made bootable.
  433. CAN_BOOT_LOGICAL = $40000; // If a logical drive is created from this block of free space, then OS/2 can boot from it by adding it to the boot manager menu.
  434. CAN_SET_NAME = $80000;
  435. SET_BOOT_MANAGER_STARTABLE = $100000;
  436. // The following enumeration defines the allocation strategies used by the Create_Partition function.
  437. type
  438. _Allocation_Algorithm =(
  439. Automatic, // Let LVM decide which block of free space to use to create the partition.
  440. Best_Fit, // Use the block of free space which is closest in size to the partition being created.
  441. First_Fit, // Use the first block of free space on the disk which is large enough to hold a partition of the specified size.
  442. Last_Fit, // Use the last block of free space on the disk which is large enough to hold a partition of the specified size.
  443. From_Largest, // Find the largest block of free space and allocate the partition from that block of free space.
  444. From_Smallest, // Find the smallest block of free space that can accommodate a partition of the size specified.
  445. All // Turn the specified drive or block of free space into a single partition.
  446. );
  447. Allocation_Algorithm=_Allocation_Algorithm;
  448. // Error codes returned by the LVM Engine.
  449. const
  450. LVM_ENGINE_NO_ERROR = 0;
  451. LVM_ENGINE_OUT_OF_MEMORY = 1;
  452. LVM_ENGINE_IO_ERROR = 2;
  453. LVM_ENGINE_BAD_HANDLE = 3;
  454. LVM_ENGINE_INTERNAL_ERROR = 4;
  455. LVM_ENGINE_ALREADY_OPEN = 5;
  456. LVM_ENGINE_NOT_OPEN = 6;
  457. LVM_ENGINE_NAME_TOO_BIG = 7;
  458. LVM_ENGINE_OPERATION_NOT_ALLOWED = 8;
  459. LVM_ENGINE_DRIVE_OPEN_FAILURE = 9;
  460. LVM_ENGINE_BAD_PARTITION = 10;
  461. LVM_ENGINE_CAN_NOT_MAKE_PRIMARY_PARTITION = 11;
  462. LVM_ENGINE_TOO_MANY_PRIMARY_PARTITIONS = 12;
  463. LVM_ENGINE_CAN_NOT_MAKE_LOGICAL_DRIVE = 13;
  464. LVM_ENGINE_REQUESTED_SIZE_TOO_BIG = 14;
  465. LVM_ENGINE_1024_CYLINDER_LIMIT = 15;
  466. LVM_ENGINE_PARTITION_ALIGNMENT_ERROR = 16;
  467. LVM_ENGINE_REQUESTED_SIZE_TOO_SMALL = 17;
  468. LVM_ENGINE_NOT_ENOUGH_FREE_SPACE = 18;
  469. LVM_ENGINE_BAD_ALLOCATION_ALGORITHM = 19;
  470. LVM_ENGINE_DUPLICATE_NAME = 20;
  471. LVM_ENGINE_BAD_NAME = 21;
  472. LVM_ENGINE_BAD_DRIVE_LETTER_PREFERENCE = 22;
  473. LVM_ENGINE_NO_DRIVES_FOUND = 23;
  474. LVM_ENGINE_WRONG_VOLUME_TYPE = 24;
  475. LVM_ENGINE_VOLUME_TOO_SMALL = 25;
  476. LVM_ENGINE_BOOT_MANAGER_ALREADY_INSTALLED = 26;
  477. LVM_ENGINE_BOOT_MANAGER_NOT_FOUND = 27;
  478. LVM_ENGINE_INVALID_PARAMETER = 28;
  479. LVM_ENGINE_BAD_FEATURE_SET = 29;
  480. LVM_ENGINE_TOO_MANY_PARTITIONS_SPECIFIED = 30;
  481. LVM_ENGINE_LVM_PARTITIONS_NOT_BOOTABLE = 31;
  482. LVM_ENGINE_PARTITION_ALREADY_IN_USE = 32;
  483. LVM_ENGINE_SELECTED_PARTITION_NOT_BOOTABLE = 33;
  484. LVM_ENGINE_VOLUME_NOT_FOUND = 34;
  485. LVM_ENGINE_DRIVE_NOT_FOUND = 35;
  486. LVM_ENGINE_PARTITION_NOT_FOUND = 36;
  487. LVM_ENGINE_TOO_MANY_FEATURES_ACTIVE = 37;
  488. LVM_ENGINE_PARTITION_TOO_SMALL = 38;
  489. LVM_ENGINE_MAX_PARTITIONS_ALREADY_IN_USE = 39;
  490. LVM_ENGINE_IO_REQUEST_OUT_OF_RANGE = 40;
  491. LVM_ENGINE_SPECIFIED_PARTITION_NOT_STARTABLE = 41;
  492. LVM_ENGINE_SELECTED_VOLUME_NOT_STARTABLE = 42;
  493. LVM_ENGINE_EXTENDFS_FAILED = 43;
  494. LVM_ENGINE_REBOOT_REQUIRED = 44;
  495. LVM_ENGINE_CAN_NOT_OPEN_LOG_FILE = 45;
  496. LVM_ENGINE_CAN_NOT_WRITE_TO_LOG_FILE = 46;
  497. LVM_ENGINE_REDISCOVER_FAILED = 47;
  498. LVM_ENGINE_INTERNAL_VERSION_FAILURE = 48;
  499. LVM_ENGINE_PLUGIN_OPERATION_INCOMPLETE = 49;
  500. LVM_ENGINE_BAD_FEATURE_ID = 50;
  501. LVM_ENGINE_NO_INIT_DATA = 51;
  502. LVM_ENGINE_NO_CONTEXT_DATA = 52;
  503. LVM_ENGINE_WRONG_CLASS_FOR_FEATURE = 53;
  504. LVM_ENGINE_INCOMPATIBLE_FEATURES_SELECTED = 54;
  505. LVM_ENGINE_NO_CHILDREN = 55;
  506. LVM_ENGINE_FEATURE_NOT_SUPPORTED_BY_INTERFACE= 56;
  507. LVM_ENGINE_NO_PARENT = 57;
  508. LVM_ENGINE_VOLUME_HAS_NOT_BEEN_COMMITTED_YET = 58;
  509. LVM_ENGINE_UNABLE_TO_REFERENCE_VOLUME = 59;
  510. LVM_ENGINE_PARSING_ERROR = 60;
  511. LVM_ENGINE_INTERNAL_FEATURE_ERROR = 61;
  512. LVM_ENGINE_VOLUME_NOT_CONVERTED = 62;
  513. // The following definitions are used for command line processing. As the command line is processed,
  514. //the command line is first broken up into tokens. Each token has a "characterization", which indicates
  515. //what the token is thought to be.
  516. type
  517. Token_Characterizations=(
  518. LVM_AcceptableCharsStr,
  519. LVM_All,
  520. LVM_BestFit,
  521. LVM_BootDOS,
  522. LVM_BootOS2,
  523. LVM_Bootable,
  524. LVM_CR,
  525. LVM_CRI,
  526. LVM_Compatibility,
  527. LVM_Drive,
  528. LVM_Existing,
  529. LVM_Expand,
  530. LVM_FS,
  531. LVM_FirstFit,
  532. LVM_Freespace,
  533. LVM_FromEnd,
  534. LVM_FromLargest,
  535. LVM_FromSmallest,
  536. LVM_FromStart,
  537. LVM_LVM,
  538. LVM_LastFit,
  539. LVM_Logical,
  540. LVM_New,
  541. LVM_NoBoot,
  542. LVM_NonBootable,
  543. LVM_NotBootable,
  544. LVM_Partition,
  545. LVM_Primary,
  546. LVM_RB,
  547. LVM_Size,
  548. LVM_Unusable,
  549. LVM_Unused,
  550. LVM_Volume,
  551. LVM_Volumes,
  552. LVM_Comma,
  553. LVM_Number,
  554. LVM_Colon,
  555. LVM_Space,
  556. LVM_Tab,
  557. LVM_MultiSpace,
  558. LVM_MultiTab,
  559. LVM_String,
  560. LVM_FileNameStr,
  561. LVM_SemiColon,
  562. LVM_Eof,
  563. LVM_Separator,
  564. LVM_Open_Paren, //* ( */
  565. LVM_Close_Paren, //* ) */
  566. LVM_Open_Bracket, //* [ */
  567. LVM_Close_Bracket, //* ] */
  568. LVM_Open_Brace, //* { */
  569. LVM_Close_Brace, //* } */
  570. LVM_EQ_Sign, //* = */
  571. LVM_Bootmgr,
  572. LVM_Create,
  573. LVM_Delete,
  574. LVM_DriveLetter,
  575. LVM_File,
  576. LVM_Hide,
  577. LVM_Install,
  578. LVM_NewMBR,
  579. LVM_Query,
  580. LVM_RediscoverPRM,
  581. LVM_SetName,
  582. LVM_SetStartable,
  583. LVM_SI,
  584. LVM_SlashSize,
  585. LVM_StartLog
  586. );
  587. type
  588. _LVM_Token=record
  589. TokenText: PChar; // The actual text of the token.
  590. TokenType: Token_Characterizations; // What the token is thought to be.
  591. Position: CARDINAL32; // The position of the first character of the token on the command line.
  592. end;
  593. LVM_Token=_LVM_Token;
  594. const
  595. LVM_TOKEN_TAG = 28387473;
  596. // Function Prototypes
  597. //***************************************************************************
  598. //
  599. // Functions relating to the LVM Engine itself
  600. //
  601. //***************************************************************************
  602. //****************************************************************************************************/
  603. //* */
  604. //* Function Name: Open_LVM_Engine */
  605. //* */
  606. //* Descriptive Name: Opens the LVM Engine and readies it for use. */
  607. //* */
  608. //* Input: BOOLEAN Ignore_CHS : If TRUE, then the LVM engine will not check the CHS values in the */
  609. //* MBR/EBR partition tables for validity. This is useful if there */
  610. //* are drive geometry problems, such as the drive was partitioned and */
  611. //* formatted with one geometry and then moved to a different machine */
  612. //* which uses a different geometry for the drive. This would cause */
  613. //* the starting and ending CHS values in the partition tables to */
  614. //* be inconsistent with the size and partition offset entries in the */
  615. //* partition tables. Setting Ignore_CHS to TRUE will disable the */
  616. //* LVM Engine's CHS consistency checks, thereby allowing the drive */
  617. //* to be partitioned. */
  618. //* CARDINAL32 * Error_Code - The address of a CARDINAL32 in which to store an error code */
  619. //* should an error occur. */
  620. //* */
  621. //* Output: *Error_Code will be 0 if this function completes successfully. If an error occurs, */
  622. //* *Error_Code will contain a non-zero error code. */
  623. //* */
  624. //* Error Handling: If this function aborts with an error, all memory allocated during the course */
  625. //* of this function will be released. Disk read errors will be reported to the */
  626. //* user via pop-up error messages. Disk read errors will only cause this */
  627. //* function to abort if none of the disk drives in the system could be */
  628. //* successfully read. */
  629. //* */
  630. //* Side Effects: The LVM Engine will be initialized. The partition tables for all OS2DASD */
  631. //* controlled disk drives will be read into memory. Memory will be allocated for */
  632. //* the data structures used by the LVM Engine. */
  633. //* */
  634. //* Notes: This is provided for programs that used LVM Version 1. This function assumes an */
  635. //* LVM_Interface_Type of VIO_Interface. */
  636. //* */
  637. //****************************************************************************************************/
  638. procedure Open_LVM_Engine(Ignore_CHS: BOOLEAN; Error_Code: PCARDINAL32); external 'lvm' name 'Open_LVM_Engine';
  639. //****************************************************************************************************/
  640. //* */
  641. //* Function Name: Open_LVM_Engine2 */
  642. //* */
  643. //* Descriptive Name: Opens the LVM Engine and readies it for use. */
  644. //* */
  645. //* Input: BOOLEAN Ignore_CHS : If TRUE, then the LVM engine will not check the CHS values in the */
  646. //* MBR/EBR partition tables for validity. This is useful if there */
  647. //* are drive geometry problems, such as the drive was partitioned and */
  648. //* formatted with one geometry and then moved to a different machine */
  649. //* which uses a different geometry for the drive. This would cause */
  650. //* the starting and ending CHS values in the partition tables to */
  651. //* be inconsistent with the size and partition offset entries in the */
  652. //* partition tables. Setting Ignore_CHS to TRUE will disable the */
  653. //* LVM Engine's CHS consistency checks, thereby allowing the drive */
  654. //* to be partitioned. */
  655. //* LVM_Interface_Types Interface_Type - Indicate the type of user interface being used: */
  656. //* PM_Interface, VIO_Interface, or Java_Interface. This lets the */
  657. //* LVM Engine know which interface support routines to call in any */
  658. //* plugin modules which may be loaded. */
  659. //* CARDINAL32 * Error_Code - The address of a CARDINAL32 in which to store an error code */
  660. //* should an error occur. */
  661. //* */
  662. //* Output: *Error_Code will be 0 if this function completes successfully. If an error occurs, */
  663. //* *Error_Code will contain a non-zero error code. */
  664. //* */
  665. //* Error Handling: If this function aborts with an error, all memory allocated during the course */
  666. //* of this function will be released. Disk read errors will be reported to the */
  667. //* user via pop-up error messages. Disk read errors will only cause this */
  668. //* function to abort if none of the disk drives in the system could be */
  669. //* successfully read. */
  670. //* */
  671. //* Side Effects: The LVM Engine will be initialized. The partition tables for all OS2DASD */
  672. //* controlled disk drives will be read into memory. Memory will be allocated for */
  673. //* the data structures used by the LVM Engine. */
  674. //* */
  675. //* Notes: New in LVM Version 2 */
  676. //* */
  677. //****************************************************************************************************/
  678. {$ifdef lvm2}
  679. procedure Open_LVM_Engine2(Ignore_CHS: BOOLEAN; Interface_Type: LVM_Interface_Types; Error_Code: PCARDINAL32); external 'lvm' name 'Open_LVM_Engine2';
  680. {$endif}
  681. //*********************************************************************/
  682. //* */
  683. //* Function Name: Commit_Changes */
  684. //* */
  685. //* Descriptive Name: Saves any changes made to the partitioning */
  686. //* information of the OS2DASD controlled disk */
  687. //* drives in the system. */
  688. //* */
  689. //* Input: CARDINAL32 * Error_Code - The address of a CARDINAL32 in */
  690. //* in which to store an error code */
  691. //* should an error occur. */
  692. //* */
  693. //* Output: The function return value will be TRUE if all of the */
  694. //* partitioning/volume changes made were successfully */
  695. //* written to disk. Also, *Error_Code will be 0 if no */
  696. //* errors occur. */
  697. //* */
  698. //* If an error occurs, then the furnction return value */
  699. //* will be FALSE and *Error_Code will contain a non-zero */
  700. //* error code. */
  701. //* */
  702. //* Error Handling: If an error occurs, the function return value */
  703. //* will be false and *Error_Code will be > 0. */
  704. //* */
  705. //* Disk read and write errors will be indicated by*/
  706. //* setting the IO_Error field of the */
  707. //* Drive_Information_Record to TRUE. Thus, if */
  708. //* the function return value is FALSE, and */
  709. //* *Error_Code indicates an I/O error, the caller */
  710. //* of this function should call the */
  711. //* Get_Drive_Status function on each drive to */
  712. //* determine which drives had I/O errors. */
  713. //* */
  714. //* If a read or write error occurs, then the */
  715. //* engine may not have been able to create a */
  716. //* partition or volume. Thus, the caller */
  717. //* may want to refresh all partition and volume */
  718. //* data to see what the engine was and was not */
  719. //* able to create. */
  720. //* */
  721. //* Side Effects: The partitioning information of the disk drives */
  722. //* in the system may be altered. */
  723. //* */
  724. //* Notes: None. */
  725. //* */
  726. //*********************************************************************/
  727. function Commit_Changes(Error_Code: PCARDINAL32): BOOLEAN; external 'lvm' name 'Commit_Changes';
  728. //*********************************************************************/
  729. //* */
  730. //* Function Name: Set_Java_Call_Back */
  731. //* */
  732. //* Descriptive Name: This function allows the calling Java program */
  733. //* to set the call back address. The call back */
  734. //* address is used when the LVM Engine or one of */
  735. //* its plug-ins, needs to run a Java class to */
  736. //* gather information from the user. */
  737. //* */
  738. //* Input: void ( * Execute_Java_Class) ... - The address of a */
  739. //* function that the LVM */
  740. //* engine may call when */
  741. //* it needs a Java class */
  742. //* to be executed. This */
  743. //* is only required if the*/
  744. //* user interface being */
  745. //* used is written in Java*/
  746. //* CARDINAL32 * Error_Code - The address of a CARDINAL32 in */
  747. //* in which to store an error code */
  748. //* should an error occur. */
  749. //* */
  750. //* Output: If the function completes successfully, then *Error_Code*/
  751. //* will be set to LVM_ENGINE_NO_ERROR. Otherwise, */
  752. //* *Error_Code will be set to a non-zero error code. */
  753. //* */
  754. //* Error Handling: If an error occurs, the function will abort and*/
  755. //* *Error_Code will be set to a non-zero error */
  756. //* code. */
  757. //* */
  758. //* Side Effects: The Java call back address is set to point to the*/
  759. //* specified function. Once the Java call back */
  760. //* address is set, LVM plug-ins which require the */
  761. //* Java call back will be enabled and can be used */
  762. //* during the creation of LVM Volumes. */
  763. //* */
  764. //* Notes: If a Java interface is in use (as specified on the */
  765. //* Open_LVM_Engine call), then this function must be called*/
  766. //* in order to enable those LVM plug-ins which require */
  767. //* initialization information during the creation of an */
  768. //* LVM Volume. If these plug-ins are not enabled, then */
  769. //* they will not be reported by the Get_Available_Features */
  770. //* API, nor can they be used or accessed by any other LVM */
  771. //* Engine APIs. Thus, this function should be called */
  772. //* immediately after the Open_LVM_Engine API is called. */
  773. //* */
  774. //*********************************************************************/
  775. {$ifdef lvm2}
  776. type
  777. TJavaExecProc=procedure(
  778. Class_Name: PChar;
  779. InputBuffer: ADDRESS;
  780. InputBufferSize: CARDINAL32;
  781. OutputBuffer: PADDRESS;
  782. OutputBufferSize,
  783. Error_Code: PCARDINAL32);
  784. procedure Set_Java_Call_Back(
  785. Execute_Java_Class: TJAvaExecProc;
  786. Error_Code: PCARDINAL32); external 'lvm' name 'Set_Java_Call_Back';
  787. {$endif}
  788. //*********************************************************************/
  789. //* */
  790. //* Function Name: Close_LVM_Engine */
  791. //* */
  792. //* Descriptive Name: Closes the LVM Engine and frees any memory */
  793. //* held by the LVM Engine. */
  794. //* */
  795. //* Input: None. */
  796. //* */
  797. //* Output: None. */
  798. //* */
  799. //* Error Handling: N/A */
  800. //* */
  801. //* Side Effects: Any memory held by the LVM Engine is released. */
  802. //* */
  803. //* Notes: None. */
  804. //* */
  805. //*********************************************************************/
  806. procedure Close_LVM_Engine; external 'lvm' name 'Close_LVM_Engine';
  807. //*********************************************************************/
  808. //* */
  809. //* Function Name: Get_Available_Features */
  810. //* */
  811. //* Descriptive Name: Returns the feature ID information for each of*/
  812. //* the features that the LVM Engine knows about. */
  813. //* */
  814. //* Input: CARDINAL32 * Error_Code - The address of a CARDINAL32 in */
  815. //* in which to store an error code */
  816. //* should an error occur. */
  817. //* */
  818. //* Output: If successful, a Feature_Information_Array structure is */
  819. //* returned with a non-zero Count. Also, *Error_Code will */
  820. //* be set to LVM_ENGINE_NO_ERROR. If an error occurs, */
  821. //* then the Count field in the structure will be 0 and */
  822. //* ( *Error_Code) will contain a non-zero error code. */
  823. //* */
  824. //* Error Handling: The only expected error is if this function is */
  825. //* called while the LVM Engine is not open. This */
  826. //* should be the only error condition. */
  827. //* */
  828. //* Side Effects: Memory is allocated using the LVM Engine's memory*/
  829. //* manager for the array of Feature_ID_Data items */
  830. //* being returned. */
  831. //* */
  832. //* Notes: This function seems to be presented since LVM Version 2 */
  833. //* */
  834. //*********************************************************************/
  835. {$ifdef LVM2}
  836. function Get_Available_Features(Error_Code: PCARDINAL32): Feature_Information_Array; external 'lvm' name 'Get_Available_Features';
  837. {$endif}
  838. //*********************************************************************/
  839. //* */
  840. //* Function Name: Issue_Feature_Command */
  841. //* */
  842. //* Descriptive Name: Issues a feature specific command to either */
  843. //* the Ring 0 or Ring 3 portion of the feature. */
  844. //* */
  845. //* Input: CARDINAL32 Feature_ID - The numeric ID assigned to the */
  846. //* feature which is to receive the */
  847. //* command being issued. */
  848. //* ADDRESS Handle - The handle of the volume, partition, or */
  849. //* aggregate to which the feature command */
  850. //* is to be directed. */
  851. //* BOOLEAN Ring0 - If TRUE, then the command will be sent */
  852. //* to the Ring 0 portion of the feature. */
  853. //* If FALSE, then the command will be sent */
  854. //* to the Ring 3 portion of the feature. */
  855. //* ADDRESS InputBuffer - A buffer containing the command and*/
  856. //* any necessary information for the */
  857. //* feature to process the command. */
  858. //* CARDINAL32 InputSize - The number of bytes in the */
  859. //* InputBuffer. */
  860. //* ADDRESS * OutputBuffer - The address of a variable used */
  861. //* to hold the location of the */
  862. //* output buffer created by the */
  863. //* feature in response to the */
  864. //* command in InputBuffer. */
  865. //* CARDINAL32 * OutputSize - The address of a variable used */
  866. //* to hold the number of bytes in */
  867. //* *OutputBuffer. */
  868. //* CARDINAL32 * Error_Code - The address of a CARDINAL32 in */
  869. //* in which to store an error code */
  870. //* should an error occur. */
  871. //* */
  872. //* Output: If successful, then *Error_Code will be set to */
  873. //* LVM_ENGINE_NO_ERROR. If unsuccessful, then *Error_Code */
  874. //* will be set to a non-zero error code. *OutputBuffer and*/
  875. //* *OutputSize are set by the feature. If the feature */
  876. //* specified does not exist, then *OutputBuffer will be */
  877. //* NULL and *Outputsize will be 0. If the feature does */
  878. //* exist, then the value of *OutputBuffer and *OutputSize */
  879. //* depend upon the feature. */
  880. //* */
  881. //* Error Handling: If the specified feature does not exist, then */
  882. //* *Error_Code will contain a non-zero error code, */
  883. //* *OutputBuffer will be NULL, and *OutputSize will*/
  884. //* be set to 0. All other error conditions are */
  885. //* feature dependent. */
  886. //* */
  887. //* Side Effects: Side effects are feature dependent. */
  888. //* */
  889. //* Notes: New in LVM Version 2 */
  890. //* */
  891. //*********************************************************************/
  892. {$ifdef lvm2}
  893. void _System Issue_Feature_Command( CARDINAL32 Feature_ID,
  894. ADDRESS Handle,
  895. BOOLEAN Ring0,
  896. ADDRESS InputBuffer,
  897. CARDINAL32 InputSize,
  898. ADDRESS * OutputBuffer,
  899. CARDINAL32 * OutputSize,
  900. CARDINAL32 * Error_Code );
  901. {$endif}
  902. //*********************************************************************/
  903. //* */
  904. //* Function Name: Parse_Feature_Parameters */
  905. //* */
  906. //* Descriptive Name: This function allows access to the parsing */
  907. //* function of an LVM Plug-in Feature. The */
  908. //* specified feature will be passed a list of */
  909. //* tokens to parse, and, if it parses the tokens */
  910. //* successfully, will produce a buffer containing*/
  911. //* initialization data that can be used with the */
  912. //* Create_Volume API. If it encounters an error,*/
  913. //* the current item in the Tokens list will be */
  914. //* the offending item, and a pointer to an error */
  915. //* message will be returned. */
  916. //* */
  917. //* Input: DLIST Tokens - A DLIST of tokens to parse. Parsing will*/
  918. //* begin with the current entry in the list */
  919. //* and proceed until there is an error or */
  920. //* until the specified feature has found a */
  921. //* complete command. Each feature defines */
  922. //* what commands it will accept. */
  923. //* LVM_Feature_Specification_Record * Feature_Data - A */
  924. //* pointer to a record which contains the */
  925. //* ID of the feature which is to parse the */
  926. //* DLIST of Tokens. The other fields in */
  927. //* this record will be filled in by the */
  928. //* feature if it successfully parses the */
  929. //* tokens. */
  930. //* char ** Error_Message - The address of a pointer to char.*/
  931. //* This will be set to NULL if the feature */
  932. //* successfully parses the list of tokens, */
  933. //* or it will be set to point to an error */
  934. //* message if an error occurs. */
  935. //* CARDINAL32 * Error_Code - The address of a CARDINAL32 */
  936. //* variable into which an error code may */
  937. //* be placed. The error code will be */
  938. //* LVM_ENGINE_NO_ERROR if this function */
  939. //* completes successfully, or a non-zero */
  940. //* error code if an error occurs. */
  941. //* */
  942. //* Output: If there are no errors, the Actual_Class and Init_Data */
  943. //* fields of *Feature_Data will be set, *Error_Message will*/
  944. //* be set to NULL, and Error_Code will be set to */
  945. //* LVM_ENGINE_NO_ERROR. The current item in the Tokens */
  946. //* list will be the first token that was not parsed by the */
  947. //* feature (i.e. the first token after the command accepted*/
  948. //* by the plug-in). */
  949. //* */
  950. //* If an error occurs, the values of Actual_Class and */
  951. //* Init_Data in *Feature_Data are undefined. *Error_Code */
  952. //* will be set to LVM_ENGINE_PARSING_ERROR if the error is */
  953. //* parsing related, or some other non-zero value if the */
  954. //* error is not parsing related. If the error is parsing */
  955. //* related, then *Error_Message will point to an error */
  956. //* message which can be displayed for the user. The */
  957. //* current item in the Tokens list will be the token which */
  958. //* failed. */
  959. //* */
  960. //* Error Handling: If an parsing related error occurs, i.e. the */
  961. //* tokens in the Tokens list do not form a valid */
  962. //* command accepted by the specified feature, then */
  963. //* the current item in the Tokens list will be the */
  964. //* offending token, *Error_Message will be set to */
  965. //* point to an error message, and *Error_Code will */
  966. //* be set to LVM_ENGINE_PARSING_ERROR. */
  967. //* If any other error occurs, the current item in */
  968. //* the Tokens list will be the token that was being*/
  969. //* processed when the error occurs, and *Error_Code*/
  970. //* will be set to a non-zero value. */
  971. //* */
  972. //* Side Effects: The current item in the Tokens list may change. */
  973. //* */
  974. //* Notes: Each feature defines which commands it will accept, and */
  975. //* therefore which commands it will successfully parse. */
  976. //* */
  977. //*********************************************************************/
  978. {$ifdef lvm2}
  979. void _System Parse_Feature_Parameters( DLIST Tokens,
  980. LVM_Feature_Specification_Record * Feature_Data,
  981. char ** Error_Message,
  982. CARDINAL32 * Error_Code);
  983. {$endif}
  984. //*********************************************************************/
  985. //* */
  986. //* Function Name: Refresh_LVM_Engine */
  987. //* */
  988. //* Descriptive Name: This function causes the LVM Engine to look */
  989. //* for changes in the current system */
  990. //* configuration and update its internal tables */
  991. //* accordingly. */
  992. //* */
  993. //* Input: CARDINAL32 * Error_Code - The address of a CARDINAL32 in */
  994. //* in which to store an error code */
  995. //* should an error occur. */
  996. //* */
  997. //* Output: None. */
  998. //* */
  999. //* Error Handling: If an error occurs, *Error_Code will be set to */
  1000. //* a non-zero value. */
  1001. //* */
  1002. //* Side Effects: Volumes which represent non-LVM devices may have */
  1003. //* their handles changed! */
  1004. //* */
  1005. //* Notes: After calling this function, Get_Volume_Control_Data */
  1006. //* should be called to get the updated list of volumes. */
  1007. //* This is necessary as the handles of some volumes may */
  1008. //* have changed. */
  1009. //* */
  1010. //*********************************************************************/
  1011. procedure Refresh_LVM_Engine(Error_Code: PCARDINAL32); external 'lvm' name 'Refresh_LVM_Engine';
  1012. //****************************************************************************
  1013. //
  1014. // Functions relating to Drives
  1015. //
  1016. //***************************************************************************
  1017. //*********************************************************************/
  1018. //* */
  1019. //* Function Name: Get_Drive_Control_Data */
  1020. //* */
  1021. //* Descriptive Name: This function returns an array of */
  1022. //* Drive_Control_Records. These records provide*/
  1023. //* important information about the drives in the*/
  1024. //* system and provide the handles required to */
  1025. //* access them. */
  1026. //* */
  1027. //* Input: CARDINAL32 * Error_Code - The address of a CARDINAL32 in */
  1028. //* in which to store an error code */
  1029. //* should an error occur. */
  1030. //* */
  1031. //* Output: A Drive_Control_Array structure is returned. If no */
  1032. //* errors occur, Drive_Control_Data will be non-NULL, */
  1033. //* Count will be greater than zero, and *Error_Code will */
  1034. //* be 0. */
  1035. //* */
  1036. //* Error Handling: If an error occurs, the Drive_Control_Array */
  1037. //* returned by this function will have NULL for */
  1038. //* Drive_Control_Data, and 0 for Count. */
  1039. //* *Error_Code will be greater than 0. */
  1040. //* */
  1041. //* Side Effects: None. */
  1042. //* */
  1043. //* Notes: The caller becomes responsible for the memory allocated */
  1044. //* for the array of Drive_Control_Records pointed to by */
  1045. //* Drive_Control_Data pointer in the Drive_Control_Array */
  1046. //* structure returned by this function. The caller should */
  1047. //* free this memory when they are done using it. */
  1048. //* */
  1049. //*********************************************************************/
  1050. function Get_Drive_Control_Data(Error_Code: PCARDINAL32): Drive_Control_Array; external 'lvm' name 'Get_Drive_Control_Data';
  1051. //*********************************************************************/
  1052. //* */
  1053. //* Function Name: Get_Drive_Status */
  1054. //* */
  1055. //* Descriptive Name: Returns the Drive_Information_Record for the */
  1056. //* drive specified by Drive_Handle. */
  1057. //* */
  1058. //* Input: ADDRESS Drive_Handle - The handle of the drive to use. */
  1059. //* Drive handles are obtained through the*/
  1060. //* Get_Drive_Control_Data function. */
  1061. //* CARDINAL32 * Error_Code - The address of a CARDINAL32 in */
  1062. //* in which to store an error code */
  1063. //* should an error occur. */
  1064. //* */
  1065. //* Output: This function returns the Drive_Information_Record for */
  1066. //* the drive associated with the specified Drive_Handle. */
  1067. //* If no errors occur, *Error_Code will be set to 0. If an*/
  1068. //* error does occur, then *Error_Code will be non-zero. */
  1069. //* */
  1070. //* Error Handling: If an error occurs, then *Error_Code will be */
  1071. //* non-zero. */
  1072. //* */
  1073. //* Side Effects: None. */
  1074. //* */
  1075. //* Notes: None. */
  1076. //* */
  1077. //*********************************************************************/
  1078. function Get_Drive_Status(Drive_Handle: ADDRESS; Error_Code: PCARDINAL32): Drive_Information_Record; external 'lvm' name 'Get_Drive_Status';
  1079. //****************************************************************************
  1080. //
  1081. // Functions relating to Partitions
  1082. //
  1083. //***************************************************************************
  1084. //*********************************************************************/
  1085. //* */
  1086. //* Function Name: Get_Partitions */
  1087. //* */
  1088. //* Descriptive Name: Returns an array of partitions associated */
  1089. //* with the object specified by Handle. */
  1090. //* */
  1091. //* Input:ADDRESS Handle - This is the handle of a drive or volume. */
  1092. //* Drive handles are obtained through the */
  1093. //* Get_Drive_Control_Data function. Volume */
  1094. //* handles are obtained through the */
  1095. //* Get_Volume_Control_Data function. */
  1096. //* CARDINAL32 * Error_Code - The address of a CARDINAL32 in */
  1097. //* in which to store an error code */
  1098. //* should an error occur. */
  1099. //* */
  1100. //* Output: This function returns a structure. The structure has */
  1101. //* two components: an array of partition information */
  1102. //* records and the number of entries in the array. If */
  1103. //* Handle is the handle of a disk drive, then the returned */
  1104. //* array will contain a partition information record for */
  1105. //* each partition and block of free space on that drive. */
  1106. //* If Handle is the handle of a volume, then the returned */
  1107. //* array will contain a partition information record for */
  1108. //* each partition which is part of the specified volume. */
  1109. //* If no errors occur, then *Error_Code will be 0. If an */
  1110. //* error does occur, then *Error_Code will be non-zero. */
  1111. //* */
  1112. //* Error Handling: Any memory allocated for the return value will */
  1113. //* be freed. The Partition_Information_Array */
  1114. //* returned by this function will contain a NULL */
  1115. //* pointer for Partition_Array, and have a Count of*/
  1116. //* 0. *Error_Code will be non-zero. */
  1117. //* */
  1118. //* If Handle is non-NULL and is invalid, a trap */
  1119. //* is likely. */
  1120. //* */
  1121. //* Side Effects: Memory will be allocated to hold the array */
  1122. //* returned by this function. */
  1123. //* */
  1124. //* Notes: The caller becomes responsible for the memory allocated */
  1125. //* for the array of Partition_Information_Records pointed */
  1126. //* to by Partition_Array pointer in the */
  1127. //* Partition_Information_Array structure returned by this */
  1128. //* function. The caller should free this memory when they */
  1129. //* are done using it. */
  1130. //* */
  1131. //*********************************************************************/
  1132. function Get_Partitions(Handle: ADDRESS; Error_Code: PCARDINAL32): Partition_Information_Array; external 'lvm' name 'Get_Partitions';
  1133. //*********************************************************************/
  1134. //* */
  1135. //* Function Name: Get_Partition_Handle */
  1136. //* */
  1137. //* Descriptive Name: Returns the handle of the partition whose */
  1138. //* serial number matches the one provided. */
  1139. //* */
  1140. //* Input: CARDINAL32 Serial_Number - This is the serial number to */
  1141. //* look for. If a partition with*/
  1142. //* a matching serial number is */
  1143. //* found, its handle will be */
  1144. //* returned. */
  1145. //* CARDINAL32 * Error_Code - The address of a CARDINAL32 in */
  1146. //* in which to store an error code*/
  1147. //* should an error occur. */
  1148. //* */
  1149. //* Output: If a partition with a matching serial number is found, */
  1150. //* then the function return value will be the handle */
  1151. //* of the partition found. If no matching partition is */
  1152. //* found, then the function return value will be NULL. */
  1153. //* */
  1154. //* Error Handling: If no errors occur, *Error_Code will be */
  1155. //* LVM_ENGINE_NO_ERROR. If an error occurs, then */
  1156. //* *Error_Code will be a non-zero error code. */
  1157. //* */
  1158. //* Side Effects: None. */
  1159. //* */
  1160. //* Notes: None. */
  1161. //* */
  1162. //*********************************************************************/
  1163. function Get_Partition_Handle(Serial_Number: CARDINAL32; Error_Code: PCARDINAL32): ADDRESS; external 'lvm' name 'Get_Partition_Handle';
  1164. //*********************************************************************/
  1165. //* */
  1166. //* Function Name: Get_Partition_Information */
  1167. //* */
  1168. //* Descriptive Name: Returns the Partition_Information_Record for */
  1169. //* the partition specified by Partition_Handle. */
  1170. //* */
  1171. //* Input: ADDRESS Partition_Handle - The handle associated with the*/
  1172. //* partition for which the */
  1173. //* Partition_Information_Record */
  1174. //* is desired. */
  1175. //* CARDINAL32 * Error_Code - The address of a CARDINAL32 in */
  1176. //* in which to store an error code*/
  1177. //* should an error occur. */
  1178. //* */
  1179. //* Output: A Partition_Information_Record is returned. If there */
  1180. //* is no error, then *Error_Code will be 0. If an error */
  1181. //* occurs, *Error_Code will be non-zero. */
  1182. //* */
  1183. //* Error Handling: If the Partition_Handle is not a valid handle, */
  1184. //* a trap could result. If it is a handle for */
  1185. //* something other than a partition, an error code*/
  1186. //* will be returned in *Error_Code. */
  1187. //* */
  1188. //* Side Effects: None. */
  1189. //* */
  1190. //* Notes: None. */
  1191. //* */
  1192. //*********************************************************************/
  1193. function Get_Partition_Information(Partition_Handle: ADDRESS; Error_Code: PCARDINAL32): Partition_Information_Record; external 'lvm' name 'Get_Partition_Information';
  1194. //*********************************************************************/
  1195. //* */
  1196. //* Function Name: Create_Partition */
  1197. //* */
  1198. //* Descriptive Name: Creates a partition on a disk drive. */
  1199. //* */
  1200. //* Input: ADDRESS Handle - The handle of a disk drive or */
  1201. //* a block of free space. */
  1202. //* CARDINAL32 Size - The size, in sectors, of the */
  1203. //* partition to create. */
  1204. //* char Name[] - The name to give to the newly */
  1205. //* created partition. */
  1206. //* Allocation_Algorithm algorithm - If Handle is a drive, */
  1207. //* then the engine will */
  1208. //* find a block of free */
  1209. //* space to use to create */
  1210. //* the partition. This */
  1211. //* tells the engine which */
  1212. //* memory management */
  1213. //* algorithm to use. */
  1214. //* BOOLEAN Bootable - If TRUE, then the engine will */
  1215. //* only create the partition if */
  1216. //* it can be booted from. If */
  1217. //* Primary_Partition is FALSE, */
  1218. //* then it is assumed that OS/2 */
  1219. //* is the operating system that */
  1220. //* will be booted. */
  1221. //* BOOLEAN Primary_Partition - If TRUE, then the */
  1222. //* engine will create */
  1223. //* a primary partition. */
  1224. //* If FALSE, then the */
  1225. //* engine will create a */
  1226. //* logical drive. */
  1227. //* BOOLEAN Allocate_From_Start - If TRUE, then the */
  1228. //* engine will */
  1229. //* allocate the new */
  1230. //* partition from the */
  1231. //* beginning of the */
  1232. //* selected block of */
  1233. //* free space. If */
  1234. //* FALSE, then the */
  1235. //* partition will be */
  1236. //* allocated from the */
  1237. //* end of the selected*/
  1238. //* block of free */
  1239. //* space. */
  1240. //* CARDINAL32 * Error_Code - The address of a CARDINAL32 in */
  1241. //* in which to store an error code*/
  1242. //* should an error occur. */
  1243. //* */
  1244. //* Output: The function return value will be the handle of the */
  1245. //* partition created. If the partition could not be */
  1246. //* created, then NULL will be returned. */
  1247. //* *Error_Code will be 0 if the partition was created. */
  1248. //* *Error_Code will be > 0 if the partition could not be */
  1249. //* created. */
  1250. //* */
  1251. //* Error Handling: If the partition can not be created, then any */
  1252. //* memory allocated by this function will be */
  1253. //* freed and the partitioning of the disk in */
  1254. //* question will be unchanged. */
  1255. //* */
  1256. //* If Handle is not a valid handle, then a trap */
  1257. //* may result. */
  1258. //* */
  1259. //* If Handle represents a partition or volume, */
  1260. //* then the function will abort and set */
  1261. //* *Error_Code to a non-zero value. */
  1262. //* */
  1263. //* Side Effects: A partition may be created on a disk drive. */
  1264. //* */
  1265. //* Notes: None. */
  1266. //* */
  1267. //*********************************************************************/
  1268. type
  1269. TPartitionName=Array[0..PARTITION_NAME_SIZE-1] of char;
  1270. function Create_Partition(Handle: ADDRESS;
  1271. Size: CARDINAL32;
  1272. Name: TPartitionName;
  1273. algorithm: Allocation_Algorithm;
  1274. Bootable: BOOLEAN;
  1275. Primary_Partition: BOOLEAN;
  1276. Allocate_From_Start: BOOLEAN;
  1277. Error_Code: PCARDINAL32
  1278. ): ADDRESS; external 'lvm' name 'Create_Partition';
  1279. //*********************************************************************/
  1280. //* */
  1281. //* Function Name: Delete_Partition */
  1282. //* */
  1283. //* Descriptive Name: Deletes the partition specified by */
  1284. //* Partition_Handle. */
  1285. //* */
  1286. //* Input: ADDRESS Partition_Handle - The handle associated with the*/
  1287. //* partition to be deleted. */
  1288. //* CARDINAL32 * Error_Code - The address of a CARDINAL32 in */
  1289. //* in which to store an error code*/
  1290. //* should an error occur. */
  1291. //* */
  1292. //* Output: *Error_Code will be 0 if the partition was deleted */
  1293. //* successfully. *Error_Code will be > 0 if the partition */
  1294. //* could not be deleted. */
  1295. //* */
  1296. //* Error Handling: If the partition can not be deleted, then */
  1297. //* *Error_Code will be > 0. */
  1298. //* */
  1299. //* If Partition_Handle is not a valid handle, a */
  1300. //* trap may result. */
  1301. //* */
  1302. //* If Partition_Handle is a volume or drive handle,*/
  1303. //* then this function will abort and set */
  1304. //* *Error_Code to a non-zero value. */
  1305. //* */
  1306. //* Side Effects: A partition on a disk drive may be deleted. */
  1307. //* */
  1308. //* Notes: A partition can not be deleted if it is part of a */
  1309. //* volume! */
  1310. //* */
  1311. //*********************************************************************/
  1312. procedure Delete_Partition(Partition_Handle: ADDRESS; Error_Code: PCARDINAL32); external 'lvm' name 'Delete_Partition';
  1313. //*********************************************************************/
  1314. //* */
  1315. //* Function Name: Set_Active_Flag */
  1316. //* */
  1317. //* Descriptive Name: Sets the Active Flag field for a partition. */
  1318. //* */
  1319. //* Input: ADDRESS Partition_Handle - The handle of the partition */
  1320. //* whose Active Flag is to be set*/
  1321. //* BYTE Active_Flag - The new value for the Active Flag. */
  1322. //* CARDINAL32 * Error_Code - The address of a CARDINAL32 in */
  1323. //* in which to store an error code*/
  1324. //* should an error occur. */
  1325. //* */
  1326. //* Output: *Error_Code will be 0 if the Active Flag was */
  1327. //* successfully set, otherwise *Error_Code will contain a */
  1328. //* non-zero error code indicating what went wrong. */
  1329. //* */
  1330. //* Error Handling: If the Active Flag can not be set, this function*/
  1331. //* will abort without changing any disk structures.*/
  1332. //* */
  1333. //* If Partition_Handle is not a valid handle, a */
  1334. //* trap may result. */
  1335. //* */
  1336. //* If Partition_Handle is a volume or drive handle,*/
  1337. //* then this function will abort and set */
  1338. //* *Error_Code to a non-zero value. */
  1339. //* */
  1340. //* */
  1341. //* Side Effects: The Active Flag for a partition may be modified. */
  1342. //* */
  1343. //* Notes: None. */
  1344. //* */
  1345. //*********************************************************************/
  1346. procedure Set_Active_Flag(Partition_Handle: ADDRESS;
  1347. Active_Flag: BYTE;
  1348. Error_Code: PCARDINAL32
  1349. ); external 'lvm' name 'Set_Active_Flag';
  1350. //*********************************************************************/
  1351. //* */
  1352. //* Function Name: Set_OS_Flag */
  1353. //* */
  1354. //* Descriptive Name: Sets the OS Flag field for a partition. This */
  1355. //* field is typically used to indicate the */
  1356. //* filesystem used on the partition, which */
  1357. //* generally gives an indication of which OS is */
  1358. //* using that partition. */
  1359. //* */
  1360. //* Input: ADDRESS Partition_Handle - The handle of the partition */
  1361. //* whose Active Flag is to be set*/
  1362. //* BYTE OS_Flag - The new value for the OS Flag. */
  1363. //* CARDINAL32 * Error_Code - The address of a CARDINAL32 in */
  1364. //* in which to store an error code*/
  1365. //* should an error occur. */
  1366. //* */
  1367. //* Output: *Error_Code will be 0 if the OS Flag was successfully */
  1368. //* set, otherwise *Error_Code will contain a non-zero error*/
  1369. //* code indicating what went wrong. */
  1370. //* */
  1371. //* Error Handling: If the OS Flag can not be set, this function */
  1372. //* will abort without changing any disk structures.*/
  1373. //* */
  1374. //* If Partition_Handle is not a valid handle, a */
  1375. //* trap may result. */
  1376. //* */
  1377. //* If Partition_Handle is a volume or drive handle,*/
  1378. //* then this function will abort and set */
  1379. //* *Error_Code to a non-zero value. */
  1380. //* */
  1381. //* */
  1382. //* Side Effects: The OS Flag for a partition may be modified. */
  1383. //* */
  1384. //* Notes: None. */
  1385. //* */
  1386. //*********************************************************************/
  1387. procedure Set_OS_Flag(Partition_Handle: ADDRESS;
  1388. OS_Flag: BYTE;
  1389. Error_Code: PCARDINAL32
  1390. ); external 'lvm' name 'Set_OS_Flag';
  1391. //****************************************************************************
  1392. //
  1393. // Functions relating to Volumes
  1394. //
  1395. //***************************************************************************
  1396. //*********************************************************************/
  1397. //* */
  1398. //* Function Name: Get_Volume_Control_Data */
  1399. //* */
  1400. //* Descriptive Name: This function returns a structure containing */
  1401. //* an array of Volume_Control_Records. These */
  1402. //* records contain information about volumes */
  1403. //* which is invariant - i.e. will not change for */
  1404. //* as long as the volume exists. One of the */
  1405. //* items in the Volume_Control_Record is the */
  1406. //* handle for the volume. This handle must be */
  1407. //* used on all accesses to the volume. */
  1408. //* */
  1409. //* Input: CARDINAL32 * Error_Code - The address of a CARDINAL32 in */
  1410. //* in which to store an error code*/
  1411. //* should an error occur. */
  1412. //* */
  1413. //* Output: A Volume_Control_Array structure is returned. */
  1414. //* */
  1415. //* If there are no errors, then the Volume_Control_Data */
  1416. //* pointer in the Volume_Control_Array will be non-NULL, */
  1417. //* the Count field of the Volume_Control_Array will be */
  1418. //* >= 0, and *Error_Code will be 0. */
  1419. //* */
  1420. //* If an error does occur, then the Volume_Control_Data */
  1421. //* pointer in the the Volume_Control_Array will be NULL, */
  1422. //* the Count field of the Volume_Control_Array will be 0, */
  1423. //* and *Error_Code will be > 0. */
  1424. //* */
  1425. //* Error Handling: If an error occurs, then any memory allocated by*/
  1426. //* this function will be freed. */
  1427. //* */
  1428. //* Side Effects: Memory for the returned array is allocated. */
  1429. //* */
  1430. //* Notes: The caller becomes responsible for the memory allocated */
  1431. //* for the array of Volume_Control_Records pointed to by */
  1432. //* Volume_Control_Data pointer in the Volume_Control_Array */
  1433. //* structure returned by this function. The caller should */
  1434. //* free this memory when they are done using it. */
  1435. //* */
  1436. //*********************************************************************/
  1437. function Get_Volume_Control_Data(Error_Code: PCARDINAL32): Volume_Control_Array; external 'lvm' name 'Get_Volume_Control_Data';
  1438. //*********************************************************************/
  1439. //* */
  1440. //* Function Name: Get_Volume_Information */
  1441. //* */
  1442. //* Descriptive Name: This function returns the */
  1443. //* Volume_Information_Record for the volume */
  1444. //* associated with Volume_Handle. */
  1445. //* */
  1446. //* Input: ADDRESS Volume_Handle - The handle of the volume about */
  1447. //* which information is desired. */
  1448. //* CARDINAL32 * Error_Code - The address of a CARDINAL32 in */
  1449. //* in which to store an error code*/
  1450. //* should an error occur. */
  1451. //* */
  1452. //* Output: This function returns a Volume_Information_Record. */
  1453. //* */
  1454. //* If this function is successful, then *Error_Code will be*/
  1455. //* 0. */
  1456. //* */
  1457. //* If this function fails, then *Error_Code will be > 0. */
  1458. //* */
  1459. //* Error Handling: If Volume_Handle is not a valid handle, a trap */
  1460. //* will be likely. If Volume_Handle is a drive or*/
  1461. //* partition handle, *Error_Code will be > 0. */
  1462. //* */
  1463. //* Side Effects: None. */
  1464. //* */
  1465. //* Notes: None. */
  1466. //* */
  1467. //*********************************************************************/
  1468. function Get_Volume_Information(Volume_Handle: ADDRESS; Error_Code: PCARDINAL32): Volume_Information_Record; external 'lvm' name 'Get_Volume_Information';
  1469. //*********************************************************************/
  1470. //* */
  1471. //* Function Name: Create_Volume */
  1472. //* */
  1473. //* Descriptive Name: This function creates a volume from a list of*/
  1474. //* partitions. The partitions are specified by */
  1475. //* their corresponding handles. */
  1476. //* */
  1477. //* Input: char Name[] - The name to assign to the newly */
  1478. //* created volume. */
  1479. //* BOOLEAN Create_LVM_Volume - If TRUE, then an LVM */
  1480. //* volume is created, */
  1481. //* otherwise a */
  1482. //* compatibility volume is */
  1483. //* created. */
  1484. //* BOOLEAN Bootable - If TRUE, the volume will not be */
  1485. //* created unless OS/2 can be booted*/
  1486. //* from it. */
  1487. //* char Drive_Letter_Preference - This is the drive */
  1488. //* letter to use for */
  1489. //* accessing the */
  1490. //* newly created */
  1491. //* volume. */
  1492. //* CARDINAL32 FeaturesToUse - This is currently reserved */
  1493. //* for future use and should */
  1494. //* always be set to 0. */
  1495. //* CARDINAL32 Partition_Count - The number of partitions */
  1496. //* to link together to form */
  1497. //* the volume being created. */
  1498. //* ADDRESS Partition_Handles[] - An array of partition */
  1499. //* handles with one entry*/
  1500. //* for each partition */
  1501. //* that is to become part*/
  1502. //* of the volume being */
  1503. //* created. */
  1504. //* CARDINAL32 * Error_Code - The address of a CARDINAL32 in */
  1505. //* in which to store an error code*/
  1506. //* should an error occur. */
  1507. //* */
  1508. //* Output: *Error_Code will be 0 if the volume was created. */
  1509. //* *Error_Code will be > 0 if the volume could not be */
  1510. //* created. */
  1511. //* */
  1512. //* Error Handling: If any of the handles in the partition handles */
  1513. //* array is not valid, then a trap is likely. If */
  1514. //* Partition_Count is greater than the number of */
  1515. //* entries in the partition handles array, then a */
  1516. //* trap is likely. If any of the handles in the */
  1517. //* partition array are not partition handles, then */
  1518. //* *Error_Code will be > 0. If the volume can NOT */
  1519. //* be created, then *Error_Code will be > 0 and any*/
  1520. //* memory allocated by this function will be freed.*/
  1521. //* If the volume can NOT be created, then the */
  1522. //* existing partition/volume structure of the disk */
  1523. //* will be unchanged. */
  1524. //* */
  1525. //* Side Effects: A volume may be created. */
  1526. //* */
  1527. //* Notes: This function provides limited compatibility for */
  1528. //* programs written to use the LVM Version 1 interface. */
  1529. //* Specifically, this function will only allow the */
  1530. //* creation of compatibility volumes. Any attempt to */
  1531. //* create an LVM volume will result in an error code being */
  1532. //* returned. */
  1533. //* */
  1534. //*********************************************************************/
  1535. type
  1536. TVolumeName=Array[0..VOLUME_NAME_SIZE-1] of char;
  1537. procedure Create_Volume(Name: TVolumeName;
  1538. Create_LVM_Volume: BOOLEAN;
  1539. Bootable: BOOLEAN;
  1540. Drive_Letter_Preference: char;
  1541. FeaturesToUse: CARDINAL32;
  1542. Partition_Count: CARDINAL32;
  1543. Partition_Handles: Array of ADDRESS;
  1544. Error_Code: PCARDINAL32
  1545. ); external 'lvm' name 'Create_Volume';
  1546. //*********************************************************************/
  1547. //* */
  1548. //* Function Name: Create_Volume2 */
  1549. //* */
  1550. //* Descriptive Name: This function creates a volume from a list of*/
  1551. //* partitions. The partitions are specified by */
  1552. //* their corresponding handles. */
  1553. //* */
  1554. //* Input: char Name[] - The name to assign to the newly */
  1555. //* created volume. */
  1556. //* BOOLEAN Create_LVM_Volume - If TRUE, then an LVM */
  1557. //* volume is created, */
  1558. //* otherwise a */
  1559. //* compatibility volume is */
  1560. //* created. */
  1561. //* BOOLEAN Bootable - If TRUE, the volume will not be */
  1562. //* created unless OS/2 can be booted*/
  1563. //* from it. */
  1564. //* char Drive_Letter_Preference - This is the drive */
  1565. //* letter to use for */
  1566. //* accessing the */
  1567. //* newly created */
  1568. //* volume. */
  1569. //* CARDINAL32 Feature_Count - The number of features to */
  1570. //* install on the volume being */
  1571. //* created. This field is */
  1572. //* ignored if Create_LVM_Volume*/
  1573. //* is FALSE. */
  1574. //* LVM_Feature_Specification_Record FeaturesToUse[] - An */
  1575. //* array of feature IDs and */
  1576. //* their associated LVM */
  1577. //* classes used to designate */
  1578. //* which features to install */
  1579. //* on the volume being */
  1580. //* created and the order in */
  1581. //* which to install them. */
  1582. //* This field is ignored if */
  1583. //* Create_LVM_Volume is */
  1584. //* FALSE. */
  1585. //* CARDINAL32 Partition_Count - The number of partitions */
  1586. //* to link together to form */
  1587. //* the volume being created. */
  1588. //* ADDRESS Partition_Handles[] - An array of partition */
  1589. //* handles with one entry*/
  1590. //* for each partition */
  1591. //* that is to become part*/
  1592. //* of the volume being */
  1593. //* created. */
  1594. //* CARDINAL32 * Error_Code - The address of a CARDINAL32 in */
  1595. //* in which to store an error code*/
  1596. //* should an error occur. */
  1597. //* */
  1598. //* Output: *Error_Code will be 0 if the volume was created. */
  1599. //* *Error_Code will be > 0 if the volume could not be */
  1600. //* created. */
  1601. //* */
  1602. //* Error Handling: If any of the handles in the partition handles */
  1603. //* array is not valid, then a trap is likely. If */
  1604. //* Partition_Count is greater than the number of */
  1605. //* entries in the partition handles array, then a */
  1606. //* trap is likely. If any of the handles in the */
  1607. //* partition array are not partition handles, then */
  1608. //* *Error_Code will be > 0. If the volume can NOT */
  1609. //* be created, then *Error_Code will be > 0 and any*/
  1610. //* memory allocated by this function will be freed.*/
  1611. //* If the volume can NOT be created, then the */
  1612. //* existing partition/volume structure of the disk */
  1613. //* will be unchanged. */
  1614. //* */
  1615. //* Side Effects: A volume may be created. */
  1616. //* */
  1617. //* Notes: None. */
  1618. //* */
  1619. //*********************************************************************/
  1620. {$ifdef lvm2}
  1621. void _System Create_Volume2( char Name[VOLUME_NAME_SIZE],
  1622. BOOLEAN Create_LVM_Volume,
  1623. BOOLEAN Bootable,
  1624. char Drive_Letter_Preference,
  1625. CARDINAL32 Feature_Count,
  1626. LVM_Feature_Specification_Record FeaturesToUse[],
  1627. CARDINAL32 Partition_Count,
  1628. ADDRESS Partition_Handles[],
  1629. CARDINAL32 * Error_Code
  1630. );
  1631. {$endif}
  1632. //*********************************************************************/
  1633. //* */
  1634. //* Function Name: Delete_Volume */
  1635. //* */
  1636. //* Descriptive Name: Deletes the volume specified by Volume_Handle.*/
  1637. //* */
  1638. //* Input: ADDRESS Volume_Handle - The handle of the volume to */
  1639. //* delete. All partitions which are*/
  1640. //* part of the specified volume will*/
  1641. //* be deleted also. */
  1642. //* CARDINAL32 * Error_Code - The address of a CARDINAL32 in */
  1643. //* in which to store an error code*/
  1644. //* should an error occur. */
  1645. //* */
  1646. //* Output: *Error_Code will be 0 if the volume and its partitions */
  1647. //* are successfully deleted. Otherwise, *Error_Code will */
  1648. //* be > 0. */
  1649. //* */
  1650. //* Error Handling: *Error_Code will be > 0 if an error occurs. If */
  1651. //* the volume or any of its partitions can not be */
  1652. //* deleted, then any changes made by this function */
  1653. //* will be undone. */
  1654. //* */
  1655. //* If Volume_Handle is not a valid handle, a trap */
  1656. //* may result. */
  1657. //* */
  1658. //* If Volume_Handle is a partition or drive handle,*/
  1659. //* then this function will abort and set */
  1660. //* *Error_Code to a non-zero value. */
  1661. //* */
  1662. //* Side Effects: A volume and its partitions may be deleted. */
  1663. //* System memory may be freed as the internal */
  1664. //* structures used to track the deleted volume */
  1665. //* are no longer required. */
  1666. //* */
  1667. //* Notes: None. */
  1668. //* */
  1669. //*********************************************************************/
  1670. procedure Delete_Volume(Volume_Handle: ADDRESS; Error_Code: PCARDINAL32); external 'lvm' name 'Delete_Volume';
  1671. //*********************************************************************/
  1672. //* */
  1673. //* Function Name: Hide_Volume */
  1674. //* */
  1675. //* Descriptive Name: Hide volume "hides" a volume from OS/2 by */
  1676. //* removing its drive letter assignment. Without*/
  1677. //* a drive letter assignment, OS/2 can not access*/
  1678. //* (or "see") the volume. */
  1679. //* */
  1680. //* Input: ADDRESS Volume_Handle - The handle of the volume to hide.*/
  1681. //* CARDINAL32 * Error_Code - The address of a CARDINAL32 in */
  1682. //* in which to store an error code*/
  1683. //* should an error occur. */
  1684. //* */
  1685. //* Output: *Error_Code will be 0 if the volume was successfully */
  1686. //* hidden. If the volume could not be hidden, then */
  1687. //* *Error_Code will be > 0. */
  1688. //* */
  1689. //* Error Handling: *Error_Code will be > 0 if the volume can not be*/
  1690. //* hidden. If the volume can not be hidden, then */
  1691. //* nothing will be altered. */
  1692. //* */
  1693. //* If Volume_Handle is not a valid handle, a trap */
  1694. //* may result. */
  1695. //* */
  1696. //* If Volume_Handle is a partition or drive handle,*/
  1697. //* then this function will abort and set */
  1698. //* *Error_Code to a non-zero value. */
  1699. //* */
  1700. //* Side Effects: None. */
  1701. //* */
  1702. //* Notes: None. */
  1703. //* */
  1704. //*********************************************************************/
  1705. procedure Hide_Volume(Volume_Handle: ADDRESS; Error_Code: PCARDINAL32); external 'lvm' name 'Hide_Volume';
  1706. //*********************************************************************/
  1707. //* */
  1708. //* Function Name: Expand_Volume */
  1709. //* */
  1710. //* Descriptive Name: This function expands an existing volume by */
  1711. //* linking additional partitions to it. */
  1712. //* */
  1713. //* Input: ADDRESS Volume_Handle - The handle of the volume to be */
  1714. //* expanded. */
  1715. //* CARDINAL32 Partition_Count - The number of partitions or */
  1716. //* volumes to be added to the */
  1717. //* volume being expanded. */
  1718. //* ADDRESS Partition_Handles[] - An array of handles. Each */
  1719. //* handle in the array is the */
  1720. //* handle of a partition */
  1721. //* which is to be added to */
  1722. //* the volume being expanded. */
  1723. //* CARDINAL32 * Error_Code - The address of a CARDINAL32 in */
  1724. //* in which to store an error code*/
  1725. //* should an error occur. */
  1726. //* */
  1727. //* Output: *Error_Code will be 0 if the volume is successfully */
  1728. //* expanded. If the volume can not be expanded, */
  1729. //* *Error_Code will be > 0. */
  1730. //* */
  1731. //* Error Handling: If the volume can not be expanded, the state of */
  1732. //* the volume is unchanged and any memory allocated*/
  1733. //* by this function is freed. */
  1734. //* */
  1735. //* If Volume_Handle is not a valid handle, a trap */
  1736. //* may result. */
  1737. //* */
  1738. //* If Volume_Handle is a partition or drive handle,*/
  1739. //* then this function will abort and set */
  1740. //* *Error_Code to a non-zero value. */
  1741. //* */
  1742. //* If any of the partition handles in the */
  1743. //* Partition_handles array are not valid handles, */
  1744. //* then a trap may result. */
  1745. //* */
  1746. //* If any of the partition handles in the */
  1747. //* Partition_Handles array are actually drive */
  1748. //* handles, then this function will abort and */
  1749. //* set *Error_Code to a non-zero value. */
  1750. //* */
  1751. //* If Partition_Count is greater than the number of*/
  1752. //* entries in the Partition_Handles array, a trap */
  1753. //* may result. */
  1754. //* */
  1755. //* Side Effects: A volume may be expanded. If the volume is */
  1756. //* expanded using another volume, the partitions */
  1757. //* on the second volume will be linked to those of */
  1758. //* the first volume and all data on the second */
  1759. //* volume will be lost. */
  1760. //* */
  1761. //* Notes: None. */
  1762. //* */
  1763. //*********************************************************************/
  1764. procedure Expand_Volume(Volume_Handle: ADDRESS;
  1765. Partition_Count: CARDINAL32;
  1766. Partition_Handles: Array of ADDRESS;
  1767. Error_Code: PCARDINAL32
  1768. ); external 'lvm' name 'Expand_Volume';
  1769. //*********************************************************************/
  1770. //* */
  1771. //* Function Name: Assign_Drive_Letter */
  1772. //* */
  1773. //* Descriptive Name: Assigns a drive letter to a volume. */
  1774. //* */
  1775. //* Input: ADDRESS Volume_Handle - The handle of the volume which */
  1776. //* is to have its assigned drive */
  1777. //* letter changed. */
  1778. //* char New_Drive_Preference - The new drive letter to */
  1779. //* assign to the volume. */
  1780. //* CARDINAL32 * Error_Code - The address of a CARDINAL32 in */
  1781. //* in which to store an error code*/
  1782. //* should an error occur. */
  1783. //* */
  1784. //* Output: *Error_Code will be 0 if the drive letter was assigned */
  1785. //* successfully; otherwise *Error_Code will be > 0. */
  1786. //* */
  1787. //* Error Handling: If the drive letter assignment can not be made, */
  1788. //* the volume will not be altered. */
  1789. //* */
  1790. //* If Volume_Handle is not a valid handle, a trap */
  1791. //* may result. */
  1792. //* */
  1793. //* If Volume_Handle is a partition or drive handle,*/
  1794. //* then this function will abort and set */
  1795. //* *Error_Code to a non-zero value. */
  1796. //* */
  1797. //* Side Effects: A volume may have its drive letter assignment */
  1798. //* changed. */
  1799. //* */
  1800. //* Notes: If the drive letter being assigned is already in use by */
  1801. //* volume which does not lie on removable media, then the */
  1802. //* drive assignment will NOT be made. */
  1803. //* */
  1804. //*********************************************************************/
  1805. procedure Assign_Drive_Letter(Volume_Handle: ADDRESS;
  1806. New_Drive_Preference: char;
  1807. Error_Code: PCARDINAL32
  1808. ); external 'lvm' name 'Assign_Drive_Letter';
  1809. //*********************************************************************/
  1810. //* */
  1811. //* Function Name: Set_Installable */
  1812. //* */
  1813. //* Descriptive Name: Marks a volume as being the volume to install */
  1814. //* OS/2 on. */
  1815. //* */
  1816. //* Input: ADDRESS Volume_Handle - The handle of the volume to which*/
  1817. //* OS/2 should be installed. */
  1818. //* CARDINAL32 * Error_Code - The address of a CARDINAL32 in */
  1819. //* in which to store an error code*/
  1820. //* should an error occur. */
  1821. //* */
  1822. //* Output: If the volume is successfully marked as installable, */
  1823. //* *Error_Code will be 0; otherwise *Error_Code will */
  1824. //* be > 0. */
  1825. //* */
  1826. //* Error Handling: If Volume_Handle is not a valid handle, a trap */
  1827. //* may result. */
  1828. //* */
  1829. //* If Volume_Handle is a partition or drive handle,*/
  1830. //* then this function will abort and set */
  1831. //* *Error_Code to a non-zero value. */
  1832. //* */
  1833. //* Side Effects: The specified volume may be marked as */
  1834. //* installable. */
  1835. //* */
  1836. //* Notes: None. */
  1837. //* */
  1838. //*********************************************************************/
  1839. procedure Set_Installable(Volume_Handle: ADDRESS; Error_Code: PCARDINAL32); external 'lvm' name 'Set_Installable';
  1840. //*********************************************************************/
  1841. //* */
  1842. //* Function Name: Get_Installable_Volume */
  1843. //* */
  1844. //* Descriptive Name: Marks a volume as being the volume to install */
  1845. //* OS/2 on. */
  1846. //* */
  1847. //* Input: CARDINAL32 * Error_Code - The address of a CARDINAL32 in */
  1848. //* in which to store an error code*/
  1849. //* should an error occur. */
  1850. //* */
  1851. //* Output: If a volume is mared installable, its information will */
  1852. //* be returned and *Error_Code will be LVM_ENGINE_NO_ERROR.*/
  1853. //* If there is no volume marked installable, then */
  1854. //* *Error_Code will be > 0. */
  1855. //* */
  1856. //* Error Handling: An error code is returned if there is an error. */
  1857. //* */
  1858. //* Side Effects: None. */
  1859. //* */
  1860. //* Notes: None. */
  1861. //* */
  1862. //*********************************************************************/
  1863. function Get_Installable_Volume(Error_Code: PCARDINAL32): Volume_Information_Record; external 'lvm' name 'Get_Installable_Volume';
  1864. //*********************************************************************/
  1865. //* */
  1866. //* Function Name: Convert_Volumes_To_V1 */
  1867. //* */
  1868. //* Descriptive Name: This function attempts to convert all LVM */
  1869. //* volumes in the system into a format that can */
  1870. //* be used by LVM Version 1, which was shipped */
  1871. //* with Warp Server for e-business. This */
  1872. //* function returns a bitmap of the drive letters*/
  1873. //* corresponding to Volumes that can not be */
  1874. //* converted. */
  1875. //* */
  1876. //* Input: BOOLEAN * Hidden_Volume_Conversion_Failure - The address */
  1877. //* of a BOOLEAN variable in which */
  1878. //* to store a flag indicating if */
  1879. //* there were hidden volumes that */
  1880. //* could not be converted. If */
  1881. //* *Hidden_Volume_Conversion_Failure */
  1882. //* is TRUE, then there were hidden */
  1883. //* volumes that could not be */
  1884. //* converted. If FALSE, then there */
  1885. //* were no hidden volumes, or the */
  1886. //* hidden volumes that existed were */
  1887. //* converted successfully. */
  1888. //* CARDINAL32 * Error_Code - The address of a CARDINAL32 in */
  1889. //* in which to store an error code*/
  1890. //* should an error occur. */
  1891. //* */
  1892. //* Output: This function returns a bitmap of the drive letters */
  1893. //* corresponding to volumes that could not be converted to */
  1894. //* LVM Version 1 format. If this function is successful */
  1895. //* and all volumes were converted, then *Error_Code will be*/
  1896. //* set to LVM_ENGINE_NO_ERROR and the bitmap returned will */
  1897. //* have no bits set. If this function failes, *Error_Code */
  1898. //* will contain a non-zero error code and the bitmap */
  1899. //* returned by this function may be non-zero. */
  1900. //* */
  1901. //* Error Handling: If an error occurs, *Error_Code will be > 0. */
  1902. //* */
  1903. //* Side Effects: All LVM volumes that can be converted to LVM */
  1904. //* Version 1 format will be. */
  1905. //* */
  1906. //* Notes: Bit 0 in the bitmap returned by this function represents*/
  1907. //* drive letter 'A'. */
  1908. //* */
  1909. //*********************************************************************/
  1910. {$ifdef lvm2}
  1911. CARDINAL32 _System Convert_Volumes_To_V1 ( BOOLEAN * Hidden_Volume_Conversion_Failure,
  1912. CARDINAL32 * Error_Code ) ;
  1913. {$endif}
  1914. //***************************************************************************
  1915. //
  1916. // Functions relating to Partitions, Drives, and Volumes.
  1917. //
  1918. //***************************************************************************
  1919. //*********************************************************************/
  1920. //* */
  1921. //* Function Name: Set_Name */
  1922. //* */
  1923. //* Descriptive Name: Sets the name of a volume, drive, or partition*/
  1924. //* */
  1925. //* Input: ADDRESS Handle - The handle of the drive, partition, or */
  1926. //* volume which is to have its name set. */
  1927. //* char New_Name[] - The new name for the drive/partition/ */
  1928. //* volume. */
  1929. //* CARDINAL32 * Error_Code - The address of a CARDINAL32 in */
  1930. //* in which to store an error code*/
  1931. //* should an error occur. */
  1932. //* */
  1933. //* Output: *Error_Code will be 0 if the name is set as specified. */
  1934. //* If the name can not be set, *Error_Code will be > 0. */
  1935. //* */
  1936. //* Error Handling: If the name can not be set, then drive/volume/ */
  1937. //* partition is not modified. */
  1938. //* */
  1939. //* If Handle is not a valid handle, a trap may */
  1940. //* result. */
  1941. //* */
  1942. //* Side Effects: A drive/volume/partition may have its name set. */
  1943. //* */
  1944. //* Notes: None. */
  1945. //* */
  1946. //*********************************************************************/
  1947. procedure Set_Name(Handle: ADDRESS;
  1948. New_Name: Array of char;
  1949. Error_Code: PCARDINAL32
  1950. ); external 'lvm' name 'Set_Name';
  1951. //*********************************************************************/
  1952. //* */
  1953. //* Function Name: Set_Startable */
  1954. //* */
  1955. //* Descriptive Name: Sets the specified volume or partition */
  1956. //* startable. If a volume is specified, it must */
  1957. //* be a compatibility volume whose partition is */
  1958. //* a primary partition on the first drive. If a */
  1959. //* partition is specified, it must be a primary */
  1960. //* partition on the first drive in the system. */
  1961. //* */
  1962. //* Input: ADDRESS Handle - The handle of the partition or volume */
  1963. //* which is to be set startable. */
  1964. //* CARDINAL32 * Error_Code - The address of a CARDINAL32 in */
  1965. //* in which to store an error code*/
  1966. //* should an error occur. */
  1967. //* */
  1968. //* Output: *Error_Code will be 0 if the specified volume or */
  1969. //* partition was set startable. */
  1970. //* If the name can not be set, *Error_Code will be > 0. */
  1971. //* */
  1972. //* Error Handling: If the volume or partition could not be set */
  1973. //* startable, then nothing in the system is */
  1974. //* changed. */
  1975. //* */
  1976. //* If Handle is not a valid handle, a trap may */
  1977. //* result. */
  1978. //* */
  1979. //* Side Effects: Any other partition or volume which is marked */
  1980. //* startable will have its startable flag cleared. */
  1981. //* */
  1982. //* Notes: None. */
  1983. //* */
  1984. //*********************************************************************/
  1985. procedure Set_Startable(Handle: ADDRESS;
  1986. Error_Code: PCARDINAL32
  1987. ); external 'lvm' name 'Set_Startable';
  1988. //*********************************************************************/
  1989. //* */
  1990. //* Function Name: Get_Valid_Options */
  1991. //* */
  1992. //* Descriptive Name: Returns a bitmap where each bit in the bitmap */
  1993. //* corresponds to a possible operation that the */
  1994. //* LVM Engine can perform. Those bits which are */
  1995. //* 1 represent operations which can be performed */
  1996. //* on the item specified by Handle. Those bits */
  1997. //* which are 0 are not allowed on the item */
  1998. //* specified by Handle. */
  1999. //* */
  2000. //* Input: ADDRESS Handle - This is any valid drive, volume, or */
  2001. //* partition handle. */
  2002. //* CARDINAL32 * Error_Code - The address of a CARDINAL32 in */
  2003. //* in which to store an error code*/
  2004. //* should an error occur. */
  2005. //* */
  2006. //* Output: A bitmap indicating which operations are valid on the */
  2007. //* item specified by Handle. */
  2008. //* */
  2009. //* If no errors occur, *Error_Code will be 0, otherwise */
  2010. //* *Error_Code will be > 0. */
  2011. //* */
  2012. //* Error Handling: If Handle is not valid, a trap will be likely. */
  2013. //* */
  2014. //* Side Effects: None. */
  2015. //* */
  2016. //* Notes: The values of the various bits in the bitmap returned */
  2017. //* by this function are defined near the beginning of this */
  2018. //* file, immediately after all of the structure */
  2019. //* definitions. */
  2020. //* */
  2021. //*********************************************************************/
  2022. function Get_Valid_Options(Handle: ADDRESS; Error_Code: PCARDINAL32): CARDINAL32; external 'lvm' name 'Get_Valid_Options';
  2023. //*********************************************************************/
  2024. //* */
  2025. //* Function Name: Get_Child_Handles */
  2026. //* */
  2027. //* Descriptive Name: Given the handle of a volume or aggregate, */
  2028. //* this function will return the handles of the */
  2029. //* children of the volume or aggregate. This */
  2030. //* allows the entire tree representation of a */
  2031. //* volume to be traversed, a level at a time. */
  2032. //* */
  2033. //* Input: ADDRESS Handle - The handle of the volume or aggregate */
  2034. //* whose children are required. */
  2035. //* CARDINAL32 * Error_Code - The address of a CARDINAL32 in */
  2036. //* in which to store an error code */
  2037. //* should an error occur. */
  2038. //* */
  2039. //* Output: If successful, an LVM_Handle_Array_Record is returned */
  2040. //* with a non-zero Count. Also, *Error_Code will be set */
  2041. //* to LVM_ENGINE_NO_ERROR. If an error occurs, then */
  2042. //* the Count field will be 0 and *Error_Code will contain */
  2043. //* a non-zero error code. */
  2044. //* */
  2045. //* Error Handling: If Handle is not a valid handle, then a trap is */
  2046. //* likely. If Handle is the handle of partition, */
  2047. //* then *Error_Code will be set to */
  2048. //* LVM_ENGINE_NO_CHILDREN. If Handle is not a */
  2049. //* volume or aggregate handle, then *Error_Code */
  2050. //* will be set to LVM_ENGINE_BAD_HANDLE. */
  2051. //* */
  2052. //* Side Effects: None. */
  2053. //* */
  2054. //* Notes: None. */
  2055. //* */
  2056. //*********************************************************************/
  2057. {$ifdef lvm2}
  2058. LVM_Handle_Array_Record _System Get_Child_Handles( ADDRESS Handle, CARDINAL32 * Error_Code);
  2059. {$endif}
  2060. //*********************************************************************/
  2061. //* */
  2062. //* Function Name: Get_Parent_Handle */
  2063. //* */
  2064. //* Descriptive Name: Given the handle of a partition or aggregate, */
  2065. //* this function will return the handle of the */
  2066. //* parent of the partition or aggregate. */
  2067. //* */
  2068. //* Input: ADDRESS Handle - The handle of the partition or aggregate*/
  2069. //* whose parent is required. */
  2070. //* CARDINAL32 * Error_Code - The address of a CARDINAL32 in */
  2071. //* in which to store an error code */
  2072. //* should an error occur. */
  2073. //* */
  2074. //* Output: If successful, the handle of the parent is returned */
  2075. //* as the function result and *Error_Code will be set to */
  2076. //* LVM_ENGINE_NO_ERROR. */
  2077. //* If an error occurs, then NULL will be the function */
  2078. //* result and *Error_Code will contain a non-zero error */
  2079. //* code. */
  2080. //* */
  2081. //* Error Handling: If Handle is not a valid handle, then a trap is */
  2082. //* likely. If Handle is the handle of volume, */
  2083. //* then *Error_Code will be set to */
  2084. //* LVM_ENGINE_NO_PARENT. If Handle is not the */
  2085. //* handle of a volume, partition, or aggregate */
  2086. //* then *Error_Code will be set to */
  2087. //* LVM_ENGINE_BAD_HANDLE. */
  2088. //* */
  2089. //* Side Effects: None. */
  2090. //* */
  2091. //* Notes: None. */
  2092. //* */
  2093. //*********************************************************************/
  2094. {$ifdef lvm2}
  2095. ADDRESS _System Get_Parent_Handle( ADDRESS Handle, CARDINAL32 * Error_Code);
  2096. {$endif}
  2097. //*********************************************************************/
  2098. //* */
  2099. //* Function Name: Get_Features */
  2100. //* */
  2101. //* Descriptive Name: Returns the feature ID information for each of*/
  2102. //* the features that are installed on the */
  2103. //* item specified by Handle. */
  2104. //* */
  2105. //* Input: ADDRESS Handle - The handle of the object to use. */
  2106. //* */
  2107. //* CARDINAL32 * Error_Code - The address of a CARDINAL32 in */
  2108. //* in which to store an error code */
  2109. //* should an error occur. */
  2110. //* */
  2111. //* Output: If successful, a Feature_Information_Array structure is */
  2112. //* returned with a non-zero Count. Also, *Error_Code will */
  2113. //* be set to LVM_ENGINE_NO_ERROR. If an error occurs, */
  2114. //* then the Count field in the structure will be 0 and */
  2115. //* ( *Error_Code) will contain a non-zero error code. */
  2116. //* */
  2117. //* Error Handling: If Handle is not a valid handle, a trap */
  2118. //* will be likely. */
  2119. //* */
  2120. //* Side Effects: Memory is allocated using the LVM Engine's memory*/
  2121. //* manager for the array of Feature_ID_Data items */
  2122. //* being returned. */
  2123. //* */
  2124. //* Notes: None. */
  2125. //* */
  2126. //*********************************************************************/
  2127. {$ifdef lvm2}
  2128. Feature_Information_Array _System Get_Features( ADDRESS Handle, CARDINAL32 * Error_Code );
  2129. {$endif}
  2130. //***************************************************************************
  2131. //
  2132. // Functions relating to Boot Manager
  2133. //
  2134. //***************************************************************************
  2135. //*********************************************************************/
  2136. //* */
  2137. //* Function Name: Boot_Manager_Is_Installed */
  2138. //* */
  2139. //* Descriptive Name: Indicates whether or not Boot Manager is */
  2140. //* installed on the first or second hard drives */
  2141. //* in the system. */
  2142. //* */
  2143. //* Input: BOOLEAN * Active - *Active is set to TRUE if LVM found an*/
  2144. //* active copy of Boot Manager on the */
  2145. //* system. If LVM could not find an */
  2146. //* active copy of Boot Manager on the */
  2147. //* system, but did find an inactive copy */
  2148. //* of Boot Manager, then *Active will be */
  2149. //* set to FALSE. */
  2150. //* CARDINAL32 * Error_Code - The address of a CARDINAL32 in */
  2151. //* in which to store an error code*/
  2152. //* should an error occur. */
  2153. //* */
  2154. //* Output: TRUE is returned if Boot Manager is found. If this */
  2155. //* copy of Boot Manager is Active, then *Active will be set*/
  2156. //* to TRUE. If the copy of Boot Manager is not currently */
  2157. //* active, then *Active will be set to FALSE. */
  2158. //* */
  2159. //* FALSE is returned if Boot Manager is not found or if an */
  2160. //* error occurs. In this case, *Active is undefined. */
  2161. //* */
  2162. //* *Error_Code will be 0 if no errors occur; otherwise it */
  2163. //* will be > 0. */
  2164. //* */
  2165. //* Error Handling: If an error occurs, *Error_Code will be > 0. */
  2166. //* */
  2167. //* Side Effects: None. */
  2168. //* */
  2169. //* Notes: None. */
  2170. //* */
  2171. //*********************************************************************/
  2172. type
  2173. PBOOLEAN=^BOOLEAN;
  2174. function Boot_Manager_Is_Installed(Active: PBOOLEAN; Error_Code: PCARDINAL32): BOOLEAN; external 'lvm' name 'Boot_Manager_Is_Installed';
  2175. //*********************************************************************/
  2176. //* */
  2177. //* Function Name: Get_Boot_Manager_Handle */
  2178. //* */
  2179. //* Descriptive Name: Returns the handle of the partition containing*/
  2180. //* Boot Manager. */
  2181. //* */
  2182. //* Input: CARDINAL32 * Error_Code - The address of a CARDINAL32 in */
  2183. //* in which to store an error code*/
  2184. //* should an error occur. */
  2185. //* */
  2186. //* Output: If Boot Manager is NOT installed, NULL is returned. */
  2187. //* If Boot Manager is installed, whether it is active or */
  2188. //* not, the handle of the partition it resides in is */
  2189. //* returned. */
  2190. //* */
  2191. //* Error Handling: If an error occurs, *Error_Code will be > 0. */
  2192. //* */
  2193. //* Side Effects: None. */
  2194. //* */
  2195. //* Notes: */
  2196. //* */
  2197. //*********************************************************************/
  2198. function Get_Boot_Manager_Handle(Error_Code: PCARDINAL32): ADDRESS; external 'lvm' name 'Get_Boot_Manager_Handle';
  2199. //*********************************************************************/
  2200. //* */
  2201. //* Function Name: Add_To_Boot_Manager */
  2202. //* */
  2203. //* Descriptive Name: Adds the volume/partition to the Boot Manager */
  2204. //* menu. */
  2205. //* */
  2206. //* Input: ADDRESS Handle - The handle of a partition or volume that*/
  2207. //* is to be added to the Boot Manager menu.*/
  2208. //* CARDINAL32 * Error_Code - The address of a CARDINAL32 in */
  2209. //* in which to store an error code*/
  2210. //* should an error occur. */
  2211. //* */
  2212. //* Output: *Error_Code will be 0 if the partition or volume was */
  2213. //* successfully added to the Boot Manager menu; otherwise */
  2214. //* *Error_Code will be > 0. */
  2215. //* */
  2216. //* Error Handling: If the partition/volume can not be added to the */
  2217. //* Boot Manager menu, no action is taken and */
  2218. //* *Error_Code will contain a non-zero error code. */
  2219. //* */
  2220. //* If Handle is not a valid handle, a trap may */
  2221. //* result. */
  2222. //* */
  2223. //* If Handle represents a drive, then this function*/
  2224. //* will abort and set *Error_Code to a non-zero */
  2225. //* value. */
  2226. //* */
  2227. //* Side Effects: The Boot Manager menu may be altered. */
  2228. //* */
  2229. //* Notes: None. */
  2230. //* */
  2231. //*********************************************************************/
  2232. procedure Add_To_Boot_Manager(Handle: ADDRESS; Error_Code: PCARDINAL32); external 'lvm' name 'Add_To_Boot_Manager';
  2233. //*********************************************************************/
  2234. //* */
  2235. //* Function Name: Remove_From_Boot_Manager */
  2236. //* */
  2237. //* Descriptive Name: Removes the specified partition or volume */
  2238. //* from the Boot Manager menu. */
  2239. //* */
  2240. //* Input: CARDINAL32 * Error_Code - The address of a CARDINAL32 in */
  2241. //* in which to store an error code*/
  2242. //* should an error occur. */
  2243. //* */
  2244. //* */
  2245. //* Output: *Error_Code will be 0 if the partition or volume was */
  2246. //* successfully removed to the Boot Manager menu; */
  2247. //* otherwise *Error_Code will be > 0. */
  2248. //* */
  2249. //* Error Handling: If Handle is not a valid handle, a trap may */
  2250. //* result. */
  2251. //* */
  2252. //* If Handle represents a drive, or if Handle */
  2253. //* represents a volume or partition which is NOT on*/
  2254. //* the boot manager menu, then this function */
  2255. //* will abort and set *Error_Code to a non-zero */
  2256. //* value. */
  2257. //* */
  2258. //* Side Effects: The Boot Manager menu may be altered. */
  2259. //* */
  2260. //* Notes: None. */
  2261. //* */
  2262. //*********************************************************************/
  2263. procedure Remove_From_Boot_Manager(Handle: ADDRESS; Error_Code: PCARDINAL32); external 'lvm' name 'Remove_From_Boot_Manager';
  2264. //*********************************************************************/
  2265. //* */
  2266. //* Function Name: Get_Boot_Manager_Menu */
  2267. //* */
  2268. //* Descriptive Name: Returns an array containing the handles of the*/
  2269. //* partitions and volumes appearing on the */
  2270. //* Boot Manager menu. */
  2271. //* */
  2272. //* Input: CARDINAL32 * Error_Code - The address of a CARDINAL32 in */
  2273. //* in which to store an error code*/
  2274. //* should an error occur. */
  2275. //* */
  2276. //* Output: The function returns a Boot_Manager_Menu structure. */
  2277. //* This structure contains two items: a pointer to an array*/
  2278. //* of Boot_Manager_Menu_Items and a count of how many items*/
  2279. //* are in the array. Each Boot_Manager_Menu_Item contains */
  2280. //* a handle and a BOOLEAN variable to indicate whether the */
  2281. //* handle is for a partition or a volume. */
  2282. //* */
  2283. //* If this function is successful, then *Error_Code will */
  2284. //* be 0. */
  2285. //* */
  2286. //* If an error occurs, the Count field in the */
  2287. //* Boot_Manager_Menu will be 0 and the corresponding */
  2288. //* pointer will be NULL. *Error_Code will be > 0. */
  2289. //* */
  2290. //* Error Handling: If an error occurs, *Error_Code will be > 0. */
  2291. //* any memory allocated by this function will be */
  2292. //* freed. */
  2293. //* */
  2294. //* Side Effects: None. */
  2295. //* */
  2296. //* Notes: None. */
  2297. //* */
  2298. //*********************************************************************/
  2299. function Get_Boot_Manager_Menu(Error_Code: PCARDINAL32): Boot_Manager_Menu; external 'lvm' name 'Get_Boot_Manager_Menu';
  2300. //*********************************************************************/
  2301. //* */
  2302. //* Function Name: Install_Boot_Manager */
  2303. //* */
  2304. //* Descriptive Name: This function installs Boot Manager. It can */
  2305. //* be used to replace an existing Boot Manager */
  2306. //* as well. */
  2307. //* */
  2308. //* Input: CARDINAL32 Drive_Number - The number of the drive to */
  2309. //* install Boot Manager on. Must*/
  2310. //* be 1 or 2. */
  2311. //* CARDINAL32 * Error_Code - The address of a CARDINAL32 in */
  2312. //* in which to store an error code*/
  2313. //* should an error occur. */
  2314. //* */
  2315. //* Output: If this function is successful, then *Error_Code will be*/
  2316. //* 0; otherwise it will be > 0. */
  2317. //* */
  2318. //* Error Handling: If an error occurs, *Error_Code will be set to a*/
  2319. //* non-zero value. Depending upon the error, it */
  2320. //* is possible that the Boot Manager partition can */
  2321. //* be left in an unusuable state (such as for a */
  2322. //* write error). */
  2323. //* */
  2324. //* Side Effects: Boot Manager may be installed on drive 1 or 2. */
  2325. //* The MBR for drive 1 may be altered. */
  2326. //* */
  2327. //* Notes: None. */
  2328. //* */
  2329. //*********************************************************************/
  2330. // Only drives 0 and 1 are acceptable.
  2331. procedure Install_Boot_Manager(Drive_Number: CARDINAL32; Error_Code: PCARDINAL32); external 'lvm' name 'Install_Boot_Manager';
  2332. //*********************************************************************/
  2333. //* */
  2334. //* Function Name: Remove_Boot_Manager */
  2335. //* */
  2336. //* Descriptive Name: Removes Boot Manager from the system. */
  2337. //* */
  2338. //* Input: CARDINAL32 * Error_Code - The address of a CARDINAL32 in */
  2339. //* in which to store an error code*/
  2340. //* should an error occur. */
  2341. //* */
  2342. //* Output: *Error_Code will be 0 if Boot Manager was successfully */
  2343. //* removed from the system; otherwise *Error_Code will */
  2344. //* be 0. */
  2345. //* */
  2346. //* Error Handling: If an error occurs, *Error_Code will be > 0. */
  2347. //* */
  2348. //* Side Effects: Boot Manager will be removed from the system. */
  2349. //* */
  2350. //* Notes: None. */
  2351. //* */
  2352. //*********************************************************************/
  2353. procedure Remove_Boot_Manager(Error_Code: PCARDINAL32); external 'lvm' name 'Remove_Boot_Manager';
  2354. //*********************************************************************/
  2355. //* */
  2356. //* Function Name: Set_Boot_Manager_Options */
  2357. //* */
  2358. //* Descriptive Name: Sets the Boot Managers Options. The options */
  2359. //* that can be set are: whether or not the time- */
  2360. //* out timer is active, how long the timer-out */
  2361. //* is, the partition to boot by default, and */
  2362. //* whether or not Boot Manager should display its*/
  2363. //* menu using default mode or advanced mode. */
  2364. //* */
  2365. //* Input: ADDRESS Handle - The handle of the partition or volume */
  2366. //* to boot if the time-out timer is active */
  2367. //* and the time-out value is reached. */
  2368. //* BOOLEAN Timer_Active - If TRUE, then the time-out timer */
  2369. //* is active. */
  2370. //* CARDINAL32 Time_Out_Value - If the time-out timer is */
  2371. //* active, this is the time-out */
  2372. //* value, in seconds. */
  2373. //* BOOLEAN Advanced_Mode - If TRUE, then Boot Manager will */
  2374. //* operate in advanced mode. If */
  2375. //* FALSE, then normal mode will be */
  2376. //* in effect. */
  2377. //* CARDINAL32 * Error_Code - The address of a CARDINAL32 in */
  2378. //* in which to store an error code*/
  2379. //* should an error occur. */
  2380. //* */
  2381. //* Output: *Error_Code will be 0 if no errors occur. If an error */
  2382. //* does occur, then *Error_Code will be > 0. */
  2383. //* */
  2384. //* Error Handling: If an error occurs, no changes will be made to */
  2385. //* Boot Manager and *Error_Code will be set a */
  2386. //* non-zero error code. */
  2387. //* */
  2388. //* Side Effects: Boot Manager may be modified. */
  2389. //* */
  2390. //* Notes: None. */
  2391. //* */
  2392. //*********************************************************************/
  2393. procedure Set_Boot_Manager_Options(Handle: ADDRESS;
  2394. Timer_Active: BOOLEAN;
  2395. Time_Out_Value: CARDINAL32;
  2396. Advanced_Mode: BOOLEAN;
  2397. Error_Code: PCARDINAL32
  2398. ); external 'lvm' name 'Set_Boot_Manager_Options';
  2399. //*********************************************************************/
  2400. //* */
  2401. //* Function Name: Get_Boot_Manager_Options */
  2402. //* */
  2403. //* Descriptive Name: This function returns the current Boot Manager*/
  2404. //* settings for the various Boot Manager options.*/
  2405. //* */
  2406. //* Input: ADDRESS * Handle - The handle for the default boot volume*/
  2407. //* or partition. */
  2408. //* BOOLEAN * Handle_Is_Volume - If TRUE, then Handle */
  2409. //* represents a volume. If */
  2410. //* FALSE, then Handle */
  2411. //* represents a partition. */
  2412. //* BOOLEAN * Timer_Active - If TRUE, then the time-out timer*/
  2413. //* is active. If FALSE, then the */
  2414. //* time-out timer is not active. */
  2415. //* CARDINAL32 * Time_Out_Value - If the time-out timer is */
  2416. //* active, then this is the */
  2417. //* number of seconds that Boot*/
  2418. //* Manager will wait for user */
  2419. //* input before booting the */
  2420. //* default volume/partition. */
  2421. //* BOOLEAN * Advanced_Mode - If TRUE, the Boot Manager is */
  2422. //* operating in advanced mode. If*/
  2423. //* FALSE, then Boot Manager is */
  2424. //* operating in normal mode. */
  2425. //* CARDINAL32 * Error_Code - The address of a CARDINAL32 in */
  2426. //* in which to store an error code*/
  2427. //* should an error occur. */
  2428. //* */
  2429. //* Output: *Handle, *Handle_Is_Volume, *Timer_Active, */
  2430. //* *Time_out_value, *Advanced_Mode, and *Error_Code are all*/
  2431. //* set by this function. If there are no errors, then */
  2432. //* *Error_Code will be set to 0. If any errors occur, then*/
  2433. //* *Error_Code will be > 0. */
  2434. //* */
  2435. //* Error Handling: If any of the parameters are invalid, then a */
  2436. //* trap is likely. If Boot Manager is not */
  2437. //* installed, then *Error_Code will be > 0. */
  2438. //* */
  2439. //* Side Effects: None. */
  2440. //* */
  2441. //* Notes: None. */
  2442. //* */
  2443. //*********************************************************************/
  2444. procedure Get_Boot_Manager_Options(Handle: PADDRESS;
  2445. Handle_Is_Volume: PBOOLEAN;
  2446. Timer_Active: PBOOLEAN;
  2447. Time_Out_Value: PCARDINAL32;
  2448. Advanced_Mode: PBOOLEAN;
  2449. Error_Code: PCARDINAL32
  2450. ); external 'lvm' name 'Get_Boot_Manager_Options';
  2451. //****************************************************************************
  2452. //
  2453. // Other Functions
  2454. //
  2455. //***************************************************************************
  2456. //*********************************************************************/
  2457. //* */
  2458. //* Function Name: Allocate_Engine_Memory */
  2459. //* */
  2460. //* Descriptive Name: Allocates a block of memory using LVM.DLL's */
  2461. //* memory management functions. */
  2462. //* */
  2463. //* Input: CARDINAL32 Size - The number of bytes of memory to */
  2464. //* allocate. */
  2465. //* */
  2466. //* Output: The address of the block of memory which was allocated, */
  2467. //* or NULL if the requested amount of memory could not be */
  2468. //* allocated. */
  2469. //* */
  2470. //* Error Handling: None. */
  2471. //* */
  2472. //* Side Effects: The specified number of bytes is allocated from */
  2473. //* the memory manager imbedded in LVM.DLL. Memory */
  2474. //* allocated by this function must be freed using */
  2475. //* Free_Engine_Memory function. The use of any */
  2476. //* memory manager to free the memory could result in*/
  2477. //* Bad Things Happening! */
  2478. //* */
  2479. //* Notes: None. */
  2480. //* */
  2481. //*********************************************************************/
  2482. {$ifdef lvm2}
  2483. ADDRESS _System Allocate_Engine_Memory( CARDINAL32 Size );
  2484. {$endif}
  2485. //*********************************************************************/
  2486. //* */
  2487. //* Function Name: Free_Engine_Memory */
  2488. //* */
  2489. //* Descriptive Name: Frees a memory object created by LVM.DLL and */
  2490. //* returned to a user of LVM.DLL. */
  2491. //* */
  2492. //* Input: ADDRESS Object : The address of the memory object to */
  2493. //* free. This could be the */
  2494. //* Drive_Control_Data field of a */
  2495. //* Drive_Control_Record, the */
  2496. //* Partition_Array field of a */
  2497. //* Partition_Information_Array structure, */
  2498. //* or any other dynamically allocated */
  2499. //* memory object created by LVM.DLL and */
  2500. //* returned by a function in LVM.DLL. */
  2501. //* */
  2502. //* Output: None. */
  2503. //* */
  2504. //* Error Handling: None. */
  2505. //* */
  2506. //* Side Effects: None. */
  2507. //* */
  2508. //* Notes: A trap or exception could occur if a bad address is */
  2509. //* passed into this function. */
  2510. //* */
  2511. //*********************************************************************/
  2512. procedure Free_Engine_Memory(Object_: ADDRESS); external 'lvm' name 'Free_Engine_Memory';
  2513. //*********************************************************************/
  2514. //* */
  2515. //* Function Name: New_MBR */
  2516. //* */
  2517. //* Descriptive Name: This function lays down a new MBR on the */
  2518. //* specified drive. */
  2519. //* */
  2520. //* Input: ADDRESS Drive_Handle - The handle of the drive on which */
  2521. //* the new MBR is to be placed. */
  2522. //* CARDINAL32 * Error_Code - The address of a CARDINAL32 in */
  2523. //* in which to store an error code*/
  2524. //* should an error occur. */
  2525. //* */
  2526. //* Output: *Error_Code will be 0 if the new MBR was successfully */
  2527. //* placed on the specified drive. If the operation failed */
  2528. //* for any reason, then *Error_Code will contain a non-zero*/
  2529. //* error code. */
  2530. //* */
  2531. //* Error Handling: If an error occurs, then the existing MBR is not*/
  2532. //* altered and *Error_Code will be > 0. */
  2533. //* */
  2534. //* Side Effects: A new MBR may be placed on the specified drive. */
  2535. //* */
  2536. //* Notes: None. */
  2537. //* */
  2538. //*********************************************************************/
  2539. procedure New_MBR(Drive_Handle: ADDRESS; Error_Code: PCARDINAL32); external 'lvm' name 'New_MBR';
  2540. //*********************************************************************/
  2541. //* */
  2542. //* Function Name: Get_Available_Drive_Letters */
  2543. //* */
  2544. //* Descriptive Name: This function returns a bitmap indicating */
  2545. //* which drive letters are available for use. */
  2546. //* */
  2547. //* Input: CARDINAL32 * Error_Code - The address of a CARDINAL32 in */
  2548. //* in which to store an error code*/
  2549. //* should an error occur. */
  2550. //* */
  2551. //* Output: This function returns a bitmap of the available drive */
  2552. //* letters. If this function is successful, then */
  2553. //* *Error_Code will be set to 0. Otherwise, *Error_Code */
  2554. //* will be > 0 and the bitmap returned will have all bits */
  2555. //* set to 0. */
  2556. //* */
  2557. //* Error Handling: If an error occurs, *Error_Code will be > 0. */
  2558. //* */
  2559. //* Side Effects: None. */
  2560. //* */
  2561. //* Notes: A drive letter is available if it is not associated */
  2562. //* with a volume located on a disk drive controlled */
  2563. //* by OS2DASD. */
  2564. //* */
  2565. //*********************************************************************/
  2566. function Get_Available_Drive_Letters(Error_Code: PCARDINAL32): CARDINAL32; external 'lcm' name 'Get_Available_Drive_Letters';
  2567. //*********************************************************************/
  2568. //* */
  2569. //* Function Name: Get_Reserved_Drive_Letters */
  2570. //* */
  2571. //* Descriptive Name: This function returns a bitmap indicating */
  2572. //* which drive letters are reserved for use by */
  2573. //* devices NOT under the control of LVM. */
  2574. //* */
  2575. //* Input: CARDINAL32 * Error_Code - The address of a CARDINAL32 in */
  2576. //* in which to store an error code*/
  2577. //* should an error occur. */
  2578. //* */
  2579. //* Output: This function returns a bitmap of the drive letters */
  2580. //* which are being used by devices which are NOT controlled*/
  2581. //* by LVM. While a Volume CAN be assigned a drive letter */
  2582. //* from this list, a reboot will almost always be required */
  2583. //* in order for the assignment to take place. */
  2584. //* If this function is successful, then *Error_Code will be*/
  2585. //* set to 0. Otherwise, *Error_Code will be > 0 and the */
  2586. //* bitmap returned will have all bits set to 0. */
  2587. //* */
  2588. //* Error Handling: If an error occurs, *Error_Code will be > 0. */
  2589. //* */
  2590. //* Side Effects: None. */
  2591. //* */
  2592. //* Notes: Devices which are assigned drive letters but which are */
  2593. //* NOT under LVM control include: CD-ROM, Network drives, */
  2594. //* parallel port attached devices, and any DASD devices */
  2595. //* not controlled by OS2DASD. */
  2596. //* */
  2597. //*********************************************************************/
  2598. function Get_Reserved_Drive_Letters(Error_Code: CARDINAL32): CARDINAL32; external 'lvm' name 'Get_Reserved_Drive_Letters';
  2599. //*********************************************************************/
  2600. //* */
  2601. //* Function Name: Reboot_Required */
  2602. //* */
  2603. //* Descriptive Name: This function indicates whether or not any */
  2604. //* changes were made to the partitioning of the */
  2605. //* disks in the system which would require a */
  2606. //* reboot to make functional. */
  2607. //* */
  2608. //* Input: None. */
  2609. //* */
  2610. //* Output: The function return value will be TRUE if the system */
  2611. //* must be rebooted as a result of disk partitioning */
  2612. //* changes. */
  2613. //* */
  2614. //* Error Handling: None required. */
  2615. //* */
  2616. //* Side Effects: None. */
  2617. //* */
  2618. //* Notes: None. */
  2619. //* */
  2620. //*********************************************************************/
  2621. function Reboot_Required: BOOLEAN; external 'lvm' name 'Reboot_Required';
  2622. //*********************************************************************/
  2623. //* */
  2624. //* Function Name: Changes_Pending */
  2625. //* */
  2626. //* Descriptive Name: This function indicates whether or not any */
  2627. //* changes were made to the partitioning of the */
  2628. //* disks in the system which have not yet been */
  2629. //* comitted to disk. */
  2630. //* */
  2631. //* Input: None. */
  2632. //* */
  2633. //* Output: The function return value will be TRUE if there are */
  2634. //* uncomitted changes to the partitioning of one or more of*/
  2635. //* the drives in the system. */
  2636. //* */
  2637. //* Error Handling: None required. */
  2638. //* */
  2639. //* Side Effects: None. */
  2640. //* */
  2641. //* Notes: None. */
  2642. //* */
  2643. //*********************************************************************/
  2644. function Changes_Pending: BOOLEAN; external 'lvm' name 'Changes_Pending';
  2645. //*********************************************************************/
  2646. //* */
  2647. //* Function Name: Set_Reboot_Flag */
  2648. //* */
  2649. //* Descriptive Name: This function sets the Reboot Flag. The */
  2650. //* Reboot Flag is a special flag on the boot */
  2651. //* disk used by the install program to keep */
  2652. //* track of whether or not the system was just */
  2653. //* rebooted. It is used by the various phases */
  2654. //* of install. */
  2655. //* */
  2656. //* Input: BOOLEAN Reboot - The new value for the Reboot Flag. If */
  2657. //* TRUE, then the reboot flag will be set. */
  2658. //* If FALSE, then the reboot flag will be */
  2659. //* cleared. */
  2660. //* CARDINAL32 * Error_Code - The address of a CARDINAL32 in */
  2661. //* in which to store an error code*/
  2662. //* should an error occur. */
  2663. //* */
  2664. //* Output: *Error_Code will be set to 0 if there are no errors. */
  2665. //* *Error_Code will be > 0 if an error occurs. */
  2666. //* */
  2667. //* Error Handling: If an error occurs, then the value of the Reboot*/
  2668. //* Flag will be unchanged. */
  2669. //* */
  2670. //* Side Effects: The value of the Reboot Flag may be changed. */
  2671. //* */
  2672. //* Notes: None. */
  2673. //* */
  2674. //*********************************************************************/
  2675. procedure Set_Reboot_Flag(Reboot: BOOLEAN; Error_Code: PCARDINAL32); external 'lvm' name 'Set_Reboot_Flag';
  2676. //*********************************************************************/
  2677. //* */
  2678. //* Function Name: Get_Reboot_Flag */
  2679. //* */
  2680. //* Descriptive Name: This function returns the value of the Reboot */
  2681. //* Flag. The Reboot Flag is a special flag on */
  2682. //* the boot disk used by the install program to */
  2683. //* keep track of whether or not the system was */
  2684. //* just rebooted. It is used by the various */
  2685. //* phases of install. */
  2686. //* */
  2687. //* Input: CARDINAL32 * Error_Code - The address of a CARDINAL32 in */
  2688. //* in which to store an error code*/
  2689. //* should an error occur. */
  2690. //* */
  2691. //* Output: The function return value will be TRUE if no errors */
  2692. //* occur and the Reboot Flag is set. *Error_Code will be */
  2693. //* 0 under these conditions. If an error occurs, the */
  2694. //* function return value will be FALSE and *Error_Code */
  2695. //* will be > 0. */
  2696. //* */
  2697. //* Error Handling: If an error occurs, *Error_Code will be > 0. */
  2698. //* The value of the reboot flag will be unchanged. */
  2699. //* */
  2700. //* Side Effects: None. */
  2701. //* */
  2702. //* Notes: None. */
  2703. //* */
  2704. //*********************************************************************/
  2705. function Get_Reboot_Flag(Error_Code: PCARDINAL32): BOOLEAN; external 'lvm' name 'Get_Reboot_Flag';
  2706. //*********************************************************************/
  2707. //* */
  2708. //* */
  2709. //* Function Name: Set_Install_Flags */
  2710. //* */
  2711. //* Descriptive Name: This function sets the value of the Install */
  2712. //* Flags. The Install Flags reside in a 32 bit */
  2713. //* field in the LVM dataspace. These flags are */
  2714. //* not used by LVM, thereby leaving Install free */
  2715. //* to use them for whatever it wants. */
  2716. //* */
  2717. //* Input: CARDINAL32 Install_Flags - The new value for the Install */
  2718. //* Flags. */
  2719. //* CARDINAL32 * Error_Code - The address of a CARDINAL32 */
  2720. //* in which to store an error code*/
  2721. //* should an error occur. */
  2722. //* */
  2723. //* Output: *Error_Code will be set to 0 if there are no errors. */
  2724. //* *Error_Code will be > 0 if an error occurs. */
  2725. //* */
  2726. //* Error Handling: If an error occurs, then the value of the */
  2727. //* Install Flags will be unchanged. */
  2728. //* */
  2729. //* Side Effects: The value of the Install Flags may be changed. */
  2730. //* */
  2731. //* Notes: None. */
  2732. //* */
  2733. //*********************************************************************/
  2734. procedure Set_Install_Flags(Install_Flags: CARDINAL32; Error_Code: PCARDINAL32); external 'lvm' name 'Set_Install_Flags';
  2735. //*********************************************************************/
  2736. //* */
  2737. //* Function Name: Get_Install_Flags */
  2738. //* */
  2739. //* Descriptive Name: This function returns the value of the Install*/
  2740. //* Flags. The Install Flags reside in a 32 bit */
  2741. //* field in the LVM dataspace. These flags are */
  2742. //* not used by LVM, thereby leaving Install free */
  2743. //* to use them for whatever it wants. */
  2744. //* */
  2745. //* Input: CARDINAL32 * Error_Code - The address of a CARDINAL32 in */
  2746. //* in which to store an error code*/
  2747. //* should an error occur. */
  2748. //* */
  2749. //* Output: The function returns the current value of the Install */
  2750. //* Flags stored in the LVM Dataspace. */
  2751. //* *Error_Code will be LVM_ENGINE_NO_ERROR if the function */
  2752. //* is successful. If an error occurs, the function will */
  2753. //* return 0 and *Error_Code will be > 0. */
  2754. //* */
  2755. //* Error Handling: If an error occurs, *Error_Code will be > 0. */
  2756. //* */
  2757. //* Side Effects: None. */
  2758. //* */
  2759. //* Notes: None. */
  2760. //* */
  2761. //*********************************************************************/
  2762. function Get_Install_Flags(Error_Code: PCARDINAL32): CARDINAL32; external 'lvm' name 'Get_Install_Flags';
  2763. //*********************************************************************/
  2764. //* */
  2765. //* Function Name: Set_Min_Install_Size */
  2766. //* */
  2767. //* Descriptive Name: This function tells the LVM Engine how big a */
  2768. //* partition/volume must be in order for it to */
  2769. //* marked installable. If this function is not */
  2770. //* used to set the minimum size for an */
  2771. //* installable partition/volume, the LVM Engine */
  2772. //* will use a default value of 300 MB. */
  2773. //* */
  2774. //* Input: CARDINAL32 Min_Sectors - The minimum size, in sectors, */
  2775. //* that a partition must be in */
  2776. //* order for it to be marked as */
  2777. //* installable. */
  2778. //* */
  2779. //* Output: None. */
  2780. //* */
  2781. //* Error Handling: None required. */
  2782. //* */
  2783. //* Side Effects: None. */
  2784. //* */
  2785. //* Notes: None. */
  2786. //* */
  2787. //*********************************************************************/
  2788. procedure Set_Min_Install_Size(Min_Sectors: CARDINAL32); external 'lvm' name 'Set_Min_Install_Size';
  2789. //*********************************************************************/
  2790. //* */
  2791. //* Function Name: Set_Free_Space_Threshold */
  2792. //* */
  2793. //* Descriptive Name: This function tells the LVM Engine not to */
  2794. //* report blocks of free space which are less */
  2795. //* than the size specified. The engine defaults */
  2796. //* to not reporting blocks of free space which */
  2797. //* are smaller than 2048 sectors (1 MB). */
  2798. //* */
  2799. //* Input: CARDINAL32 Min_Sectors - The minimum size, in sectors, */
  2800. //* that a block of free space must */
  2801. //* be in order for the LVM engine */
  2802. //* to report it. */
  2803. //* */
  2804. //* Output: None. */
  2805. //* */
  2806. //* Error Handling: None required. */
  2807. //* */
  2808. //* Side Effects: None. */
  2809. //* */
  2810. //* Notes: None. */
  2811. //* */
  2812. //*********************************************************************/
  2813. procedure Set_Free_Space_Threshold(Min_Sectors: CARDINAL32); external 'lvm' name 'Set_Free_Space_Threshold';
  2814. //*********************************************************************/
  2815. //* */
  2816. //* Function Name: Read_Sectors */
  2817. //* */
  2818. //* Descriptive Name: This function reads one or more sectors from */
  2819. //* the specified drive and places the data read */
  2820. //* in Buffer. */
  2821. //* */
  2822. //* Input: CARDINAL32 Drive_Number : The number of the hard drive to*/
  2823. //* read from. The drives in the */
  2824. //* system are numbered from 1 to */
  2825. //* n, where n is the total number */
  2826. //* of hard drives in the system. */
  2827. //* LBA Starting_Sector : The first sector to read from. */
  2828. //* CARDINAL32 Sectors_To_Read : The number of sectors to */
  2829. //* read into memory. */
  2830. //* ADDRESS Buffer : The location to put the data read into. */
  2831. //* CARDINAL32 * Error : The address of a variable to hold */
  2832. //* the error return code. */
  2833. //* */
  2834. //* Output: If Successful, then the data read will be placed in */
  2835. //* memory starting at Buffer, and *Error will be */
  2836. //* LVM_ENGINE_NO_ERROR. */
  2837. //* If Unsuccessful, then *Error will be > 0 and the */
  2838. //* contents of memory starting at Buffer is undefined. */
  2839. //* */
  2840. //* Error Handling: *Error will be > 0 if an error occurs. */
  2841. //* */
  2842. //* Side Effects: Data may be read into memory starting at Buffer. */
  2843. //* */
  2844. //* Notes: None. */
  2845. //* */
  2846. //*********************************************************************/
  2847. procedure Read_Sectors(Drive_Number: CARDINAL32;
  2848. Starting_Sector: LBA;
  2849. Sectors_To_Read: CARDINAL32;
  2850. Buffer: ADDRESS;
  2851. Error: PCARDINAL32); external 'lvm' name 'Read_Sectors';
  2852. //*********************************************************************/
  2853. //* */
  2854. //* Function Name: Write_Sectors */
  2855. //* */
  2856. //* Descriptive Name: This function writes data from memory to one */
  2857. //* or more sectors on the specified drive. */
  2858. //* */
  2859. //* Input: CARDINAL32 Drive_Number : The number of the hard drive to*/
  2860. //* write to. The drives in the */
  2861. //* system are numbered from 1 to */
  2862. //* n, where n is the total number */
  2863. //* of hard drives in the system. */
  2864. //* LBA Starting_Sector : The first sector to write to. */
  2865. //* CARDINAL32 Sectors_To_Read : The number of sectors to */
  2866. //* be written. */
  2867. //* ADDRESS Buffer : The location of the data to be written */
  2868. //* to disk. */
  2869. //* CARDINAL32 * Error : The address of a variable to hold */
  2870. //* the error return code. */
  2871. //* */
  2872. //* Output: If Successful, then the data at Buffer will be placed */
  2873. //* on the disk starting at the sector specified, and */
  2874. //* *Error will be LVM_ENGINE_NO_ERROR. */
  2875. //* If Unsuccessful, then *Error will be > 0 and the */
  2876. //* contents of the disk starting at sector */
  2877. //* Starting_Sector is undefined. */
  2878. //* */
  2879. //* Error Handling: *Error will be > 0 if an error occurs. */
  2880. //* */
  2881. //* Side Effects: Data may be written to disk. */
  2882. //* */
  2883. //* Notes: None. */
  2884. //* */
  2885. //*********************************************************************/
  2886. procedure Write_Sectors(Drive_Number: CARDINAL32;
  2887. Starting_Sector: LBA;
  2888. Sectors_To_Write: CARDINAL32;
  2889. Buffer: ADDRESS;
  2890. Error: PCARDINAL32); external 'lvm' name 'Write_Sectors';
  2891. //*********************************************************************/
  2892. //* */
  2893. //* Function Name: Rediscover_PRMs */
  2894. //* */
  2895. //* Descriptive Name: Causes OS2LVM and OS2DASD to check PRMs for */
  2896. //* new or changed media. */
  2897. //* */
  2898. //* Input: CARDINAL32 * Error_Code - The address of a CARDINAL32 in */
  2899. //* in which to store an error code*/
  2900. //* should an error occur. */
  2901. //* */
  2902. //* Output: If the Rediscover PRM operation was successful, then */
  2903. //* *Error_Code will be LVM_ENGINE_NO_ERROR. If there */
  2904. //* was an error, then *Error_Code will be > 0. */
  2905. //* */
  2906. //* Error Handling: None. */
  2907. //* */
  2908. //* Side Effects: New volumes may be discovered and assigned drive */
  2909. //* letters by OS2LVM and OS2DASD. */
  2910. //* */
  2911. //* Notes: The LVM Engine must be CLOSED when this function is */
  2912. //* called as this function is disabled while it is open! */
  2913. //* */
  2914. //*********************************************************************/
  2915. procedure Rediscover_PRMs(Error_Code: PCARDINAL32); external 'lvm' name 'Rediscover_PRMs';
  2916. //*********************************************************************/
  2917. //* */
  2918. //* Function Name: Get_LVM_View */
  2919. //* */
  2920. //* Descriptive Name: This function gets the OS2LVM data for the */
  2921. //* specified drive letter. The intent is to */
  2922. //* allow the determination of what drive letter */
  2923. //* a volume really has given the possibilities */
  2924. //* of conflict or a drive preference of '*'. */
  2925. //* */
  2926. //* Input: char IFSM_Drive_Letter : The drive letter for which the*/
  2927. //* OS2LVM data is requested. */
  2928. //* CARDINAL32 * Drive_Number : The address of a variable */
  2929. //* to hold the OS/2 drive */
  2930. //* number of the drive */
  2931. //* containing the first */
  2932. //* partition of the volume */
  2933. //* currently assigned to the */
  2934. //* requested drive letter. */
  2935. //* CARDINAL32 * Partition_LBA : The address of a variable */
  2936. //* to hold the LBA of the */
  2937. //* first partition of the */
  2938. //* volume currently assigned */
  2939. //* to the requested drive */
  2940. //* letter. */
  2941. //* char * LVM_Drive_Letter : The address of a variable to */
  2942. //* hold the drive letter that */
  2943. //* OS2LVM thinks the volume */
  2944. //* assigned to the requested */
  2945. //* drive letter should have. */
  2946. //* BYTE * UnitID : The address of a variable to hold the */
  2947. //* OS2LVM unit ID for the volume associated*/
  2948. //* with the requested drive letter. */
  2949. //* */
  2950. //* Output: The function return value will be TRUE if the function */
  2951. //* completed successfully. */
  2952. //* */
  2953. //* Error Handling: If this function fails, the specified drive */
  2954. //* letter is either not in use, or is in use by a */
  2955. //* device not controlled by OS2LVM. */
  2956. //* */
  2957. //* Side Effects: None. */
  2958. //* */
  2959. //* Notes: This function can be used with the LVM Engine open or */
  2960. //* closed. */
  2961. //* */
  2962. //*********************************************************************/
  2963. function Get_LVM_View(IFSM_Drive_Letter: char;
  2964. Drive_Number: PCARDINAL32;
  2965. Partition_LBA: PCARDINAL32;
  2966. LVM_Drive_Letter: Pchar;
  2967. UnitID: PBYTE): BOOLEAN; external 'lvm' name 'Get_LVM_View';
  2968. //*********************************************************************/
  2969. //* */
  2970. //* Function Name: Start_Logging */
  2971. //* */
  2972. //* Descriptive Name: Enables the LVM Engine logging. Once enabled,*/
  2973. //* the LVM Engine logging function will log all */
  2974. //* LVM Engine activity to the specified log file.*/
  2975. //* The data is logged in a binary format for */
  2976. //* compactness and speed. */
  2977. //* */
  2978. //* Input: char * Filename - The filename of the file to use as the */
  2979. //* log file. */
  2980. //* CARDINAL32 * Error_Code - The address of a CARDINAL32 in */
  2981. //* in which to store an error code*/
  2982. //* should an error occur. */
  2983. //* */
  2984. //* Output: If the logging file was successfully created, then */
  2985. //* *Error_Code will be 0. If the log file could not be */
  2986. //* created, then *Error_Code will be > 0. */
  2987. //* */
  2988. //* Error Handling: If the log file can not be created, then */
  2989. //* *Error_Code will be > 0. */
  2990. //* */
  2991. //* Side Effects: A file may be created/opened for logging of */
  2992. //* LVM Engine actions. */
  2993. //* */
  2994. //* Notes: None. */
  2995. //* */
  2996. //*********************************************************************/
  2997. procedure Start_Logging(Filename: Pchar; Error_Code: PCARDINAL32); external 'lvm' name 'Start_Logging';
  2998. //*********************************************************************/
  2999. //* */
  3000. //* Function Name: Stop_Logging */
  3001. //* */
  3002. //* Descriptive Name: This function ends LVM Engine logging and */
  3003. //* closes the log file. */
  3004. //* */
  3005. //* Input: CARDINAL32 * Error_Code - The address of a CARDINAL32 in */
  3006. //* in which to store an error code*/
  3007. //* should an error occur. */
  3008. //* */
  3009. //* Output: *Error_Code will be 0 if this function completes */
  3010. //* successfully; otherwise it will be > 0. */
  3011. //* */
  3012. //* Error Handling: If the log file is not currently opened, or if */
  3013. //* the close operation fails on the log file, then */
  3014. //* *Error_Code will be > 0. */
  3015. //* */
  3016. //* Side Effects: The log file may be closed. */
  3017. //* */
  3018. //* Notes: None. */
  3019. //* */
  3020. //*********************************************************************/
  3021. procedure Stop_Logging(Error_Code: PCARDINAL32); external 'lvm' name 'Stop_Logging';
  3022. {$ifdef lists}
  3023. (*
  3024. * Description: This module implements a simple, generic, doubly linked list.
  3025. * Data objects of any type can be placed into a linked list
  3026. * created by this module. Futhermore, data objects of different
  3027. * types may be placed into the same linked list.
  3028. *
  3029. * Notes: This linked list implementation makes use of the concept of the
  3030. * current item. In any non-empty list, one item in the list will
  3031. * be designated as the current item. When any of the following
  3032. * functions are called, they will operate upon the current item
  3033. * only: GetItem, ReplaceItem, DeleteItem, GetTag, NextItem,
  3034. * PreviousItem, GetObject, ExtractItem, and ExtractObject. The
  3035. * user of this module may set the current item through the use of
  3036. * the GoToStartOfList, GoToEndOfList, NextItem, PreviousItem,
  3037. * and GoToSpecifiedItem functions.
  3038. *
  3039. * Since a linked list created by this module may contain items
  3040. * of different types, the user will need a way to identify items
  3041. * of different types which may be in the same list. To allow users
  3042. * to do this, the concept of an item tag is used. When an item is
  3043. * added to the list, the user must enter an item tag. The item
  3044. * tag is merely some identifier that the user wishes to associate
  3045. * with the item being placed into the list. When used as intended,
  3046. * each type of data item will have a unique tag associated with it.
  3047. * This way, all data items of the same type will have the same tag
  3048. * while data items of different types will have different tags.
  3049. * Thus, by using the GetTag function, the user can get the item
  3050. * tag for the current item without having to get the item from the
  3051. * list. This allows the user to differentiate between items of
  3052. * different types which reside in the same list.
  3053. *
  3054. * This module is single threaded. If used in a multi-threaded
  3055. * environment, the user must implement appropriate access controls.
  3056. *
  3057. * When an item is inserted or appended to a list, this module
  3058. * allocates memory on the heap to hold the item and then copies
  3059. * the item to the memory that it allocated. This allows local
  3060. * variables to be safely inserted or appended to a list. However,
  3061. * it should be noted that under certain circumstances a copy of the
  3062. * entire data item will NOT be made. Specifically, if the data item
  3063. * is a structure or array containing pointers, then the data pointed
  3064. * to by the pointers will NOT be copied even though the structure or
  3065. * array is! This results from the fact that, when an item is being
  3066. * inserted or appended to a list, the user provides just an address
  3067. * and size. This module assumes that the item to inserted or append
  3068. * lies in a contiguous block of memory at the address provided by the
  3069. * user. This module has no way of knowing the structure of the data
  3070. * at the specified address, and therefore can not know about any
  3071. * embedded pointers which may lie within that block of memory.
  3072. *
  3073. * This module now employs the concept of a handle. A handle is a
  3074. * reference to a specific item in a list which allows that item to
  3075. * be made the current item in the list quickly. Example: If you
  3076. * use the GetHandle function to get a handle for the current item
  3077. * (lets call the item B1), then, regardless of where you are in the
  3078. * list (or any reodering of the items in the list), you can make item
  3079. * B1 the current item by passing its handle to the GoToSpecifiedItem
  3080. * function. Alternatively, you could operate directly on B1 using
  3081. * the other handle based functions, such as GetItem_By_Handle, for
  3082. * example. GetItem_By_Handle gets the item associated with the
  3083. * specified handle without changing which item in the list is the
  3084. * current item in the list.
  3085. *
  3086. * The functions of this module refer to user data as either items or
  3087. * objects. The difference between the two is simple, yet subtle. It
  3088. * deals with who is responsible for the memory used to hold the data.
  3089. * In the case of an item, this module is responsible for the memory
  3090. * used to hold the user data. In the case of an object, the user
  3091. * is responsible for the memory used to hold the data.
  3092. *
  3093. * What this means is that, for functions adding ITEMS to a list,
  3094. * this module will be responsible for allocating memory to hold
  3095. * the user data and then copying the user data into the memory
  3096. * that was allocated. For functions which return items, this
  3097. * module will COPY the user data from the LIST into a buffer
  3098. * specified by the user. For functions which add objects to a
  3099. * list, the user provides a pointer to a block of memory holding
  3100. * user data. This block of memory was allocated by the user, and
  3101. * becomes the "property" of this module once it has been added to
  3102. * a LIST. For functions which return objects, a pointer to the
  3103. * memory where the data is stored is returned. As long as an item/object
  3104. * is in a LIST, this module will be responsible for the memory that
  3105. * is used to store the data associated with that item. This means that
  3106. * users of this module should not call free on an object returned by this
  3107. * module as long as that object is still within a list.
  3108. *
  3109. *
  3110. *)
  3111. typedef unsigned long TAG;
  3112. typedef ADDRESS DLIST;
  3113. //*--------------------------------------------------
  3114. //* Type definitions
  3115. //--------------------------------------------------*/
  3116. typedef enum _Insertion_Modes {
  3117. InsertAtStart,
  3118. InsertBefore,
  3119. InsertAfter,
  3120. AppendToList
  3121. } Insertion_Modes;
  3122. //************************************************
  3123. //* Functions Available *
  3124. //************************************************/
  3125. //*
  3126. //* The parameter *Error is set by every function in this module. It
  3127. //* will be set to 0 to indicate success, and will be > 0 if an
  3128. //* error occurs. The following table lists the possible error codes:
  3129. //* 0 : No error.
  3130. //* 1 : Out of memory
  3131. //* 2 : Memory has been corrupted!
  3132. //* 3 : Bad List Record!
  3133. //* 4 : List Record not initialized yet!
  3134. //* 5 : List is empty!
  3135. //* 6 : Item size mismatch!
  3136. //* 7 : Bad item pointer!
  3137. //* 8 : Item has zero size!
  3138. //* 9 : Item tag mismatch!
  3139. //* 10 : Already at end of list!
  3140. //* 11 : Already at start of list!
  3141. //* 12 : Bad Handle!
  3142. //* 13 : Invalid Insertion Mode!
  3143. //*/
  3144. const
  3145. DLIST_SUCCESS = 0;
  3146. DLIST_OUT_OF_MEMORY = 1;
  3147. DLIST_CORRUPTED = 2;
  3148. DLIST_BAD = 3;
  3149. DLIST_NOT_INITIALIZED = 4;
  3150. DLIST_EMPTY = 5;
  3151. DLIST_ITEM_SIZE_WRONG = 6;
  3152. DLIST_BAD_ITEM_POINTER = 7;
  3153. DLIST_ITEM_SIZE_ZERO = 8;
  3154. DLIST_ITEM_TAG_WRONG = 9;
  3155. DLIST_END_OF_LIST =10;
  3156. DLIST_ALREADY_AT_START =11;
  3157. DLIST_BAD_HANDLE =12;
  3158. DLIST_INVALID_INSERTION_MODE =13;
  3159. ///* The following code is special. It is for use with the PruneList and ForEachItem functions. Basically, these functions
  3160. //can be thought of as "searching" a list. They present each item in the list to a user supplied function which can then
  3161. //operate on the items. If the user supplied function returns a non-zero error code, ForEachItem and PruneList abort and
  3162. //return an error to the caller. This may be undesirable. If the user supplied function used with PruneList and ForEachItem
  3163. //returns the code below, PruneList/ForEachItem will abort and return DLIST_SUCCESS. This allows PruneList and ForEachItem
  3164. //to be used to search a list and terminate the search when the desired item is found without having to traverse the
  3165. //remaining items in the list. */
  3166. #define DLIST_SEARCH_COMPLETE 0xFF
  3167. #ifdef USE_POOLMAN
  3168. //*********************************************************************/
  3169. //* */
  3170. //* Function Name: CreateList */
  3171. //* */
  3172. //* Descriptive Name: This function allocates and initializes the */
  3173. //* data structures associated with a list and */
  3174. //* then returns a pointer to these structures. */
  3175. //* */
  3176. //* Input: CARDINAL32 InitialPoolSize - Each List gets a pool of */
  3177. //* link nodes. When items are */
  3178. //* added to the List, a link node*/
  3179. //* is removed from the pool. */
  3180. //* When an item is removed from */
  3181. //* the List, the link node used */
  3182. //* for that item is returned to */
  3183. //* the pool. InitialPoolSize is */
  3184. //* the number of link nodes to */
  3185. //* place in the pool when the */
  3186. //* pool is created. */
  3187. //* CARDINAL32 MaximumPoolSize - When the pool runs out of */
  3188. //* link nodes, new nodes are */
  3189. //* allocated by the pool. When */
  3190. //* these links start being */
  3191. //* returned to the pool, the pool*/
  3192. //* will grow. This parameter */
  3193. //* puts a limit on how big the */
  3194. //* pool may grow to. Once the */
  3195. //* pool reaches this size, any */
  3196. //* link nodes being returned to */
  3197. //* the pool will be deallocated. */
  3198. //* CARDINAL32 PoolIncrement - When the pool runs out of link*/
  3199. //* nodes and more are required, */
  3200. //* the pool will allocate one or */
  3201. //* more link nodes. This tells the*/
  3202. //* pool how many link nodes to */
  3203. //* allocate at one time. */
  3204. //* */
  3205. //* Output: If Success : The function return value will be non-NULL */
  3206. //* */
  3207. //* If Failure : The function return value will be NULL. */
  3208. //* */
  3209. //* Error Handling: The function will only fail if it can not */
  3210. //* allocate enough memory to create the new list */
  3211. //* and its associated pool of link nodes. */
  3212. //* */
  3213. //* Side Effects: None. */
  3214. //* */
  3215. //* Notes: None. */
  3216. //* */
  3217. //*********************************************************************/
  3218. DLIST _System CreateList(CARDINAL32 InitialPoolSize,
  3219. CARDINAL32 MaximumPoolSize,
  3220. CARDINAL32 PoolIncrement);
  3221. #else
  3222. //*********************************************************************/
  3223. //* */
  3224. //* Function Name: CreateList */
  3225. //* */
  3226. //* Descriptive Name: This function allocates and initializes the */
  3227. //* data structures associated with a list and */
  3228. //* then returns a pointer to these structures. */
  3229. //* */
  3230. //* Input: None. */
  3231. //* */
  3232. //* Output: If Success : The function return value will be non-NULL */
  3233. //* */
  3234. //* If Failure : The function return value will be NULL. */
  3235. //* */
  3236. //* Error Handling: The function will only fail if it can not */
  3237. //* allocate enough memory to create the new list. */
  3238. //* */
  3239. //* Side Effects: None. */
  3240. //* */
  3241. //* Notes: None. */
  3242. //* */
  3243. //*********************************************************************/
  3244. DLIST _System CreateList( void );
  3245. #endif
  3246. //*********************************************************************/
  3247. //* */
  3248. //* Function Name: InsertItem */
  3249. //* */
  3250. //* Descriptive Name: This function inserts an item into a DLIST. */
  3251. //* The item can be placed either before or */
  3252. //* after the current item in the DLIST. */
  3253. //* */
  3254. //* Input: DLIST ListToAddTo : The list to which the */
  3255. //* data item is to be */
  3256. //* added. */
  3257. //* CARDINAL32 ItemSize : The size of the data item, in */
  3258. //* bytes. */
  3259. //* ADDRESS ItemLocation : The address of the data */
  3260. //* to append to the list */
  3261. //* TAG ItemTag : The item tag to associate with */
  3262. //* item being appended to the list */
  3263. //* ADDRESS TargetHandle : The item in ListToAddTo which */
  3264. //* is used to determine where */
  3265. //* the item being transferred will */
  3266. //* be placed. If this is NULL, */
  3267. //* then the current item in */
  3268. //* ListToAddTo will be used. */
  3269. //* Insertion_Modes InsertMode : This indicates where, */
  3270. //* relative to the item in */
  3271. //* ListToAddTo specified by */
  3272. //* Target_Handle, the item being */
  3273. //* inserted can be placed. */
  3274. //* BOOLEAN MakeCurrent : If TRUE, the item being inserted */
  3275. //* into ListToAddTo becomes the */
  3276. //* current item in ListToAddTo. */
  3277. //* CARDINAL32 * Error : The address of a variable to hold */
  3278. //* the error return code. */
  3279. //* */
  3280. //* Output: If the operation is successful, then *Error will be */
  3281. //* set to 0 and the function return value will be the */
  3282. //* handle for the item that was appended to the list. */
  3283. //* If the operation fails, then *Error will contain an */
  3284. //* error code and the function return value will be NULL. */
  3285. //* */
  3286. //* Error Handling: This function will fail under the following */
  3287. //* conditions: */
  3288. //* ListToAddTo does not point to a valid */
  3289. //* list */
  3290. //* ItemSize is 0 */
  3291. //* ItemLocation is NULL */
  3292. //* The memory required to hold a copy of the */
  3293. //* item can not be allocated. */
  3294. //* The memory required to create a LINK NODE */
  3295. //* can not be allocated. */
  3296. //* TargetHandle is invalid or is for an item */
  3297. //* in another list. */
  3298. //* If this routine fails, an error code is returned*/
  3299. //* and any memory allocated by this function is */
  3300. //* freed. */
  3301. //* */
  3302. //* Side Effects: None. */
  3303. //* */
  3304. //* Notes: The item to add is copied to the heap to */
  3305. //* avoid possible conflicts with the usage of */
  3306. //* local variables in functions which process */
  3307. //* DLISTs. However, a pointer to a local variable */
  3308. //* should not be appended to the DLIST. */
  3309. //* */
  3310. //* It is assumed that TargetHandle is valid, or is at least*/
  3311. //* the address of an accessible block of storage. If */
  3312. //* TargetHandle is invalid, or is not the address of an */
  3313. //* accessible block of storage, then a trap or exception */
  3314. //* may occur. */
  3315. //* */
  3316. //* It is assumed that Error contains a valid address. It */
  3317. //* is also assumed that if ItemLocation is not NULL, then */
  3318. //* it is a valid address that can be dereferenced. If */
  3319. //* these assumptions are violated, an exception or trap */
  3320. //* may occur. */
  3321. //* */
  3322. //* */
  3323. //*********************************************************************/
  3324. ADDRESS _System InsertItem ( DLIST ListToAddTo,
  3325. CARDINAL32 ItemSize,
  3326. ADDRESS ItemLocation,
  3327. TAG ItemTag,
  3328. ADDRESS TargetHandle,
  3329. Insertion_Modes Insert_Mode,
  3330. BOOLEAN MakeCurrent,
  3331. CARDINAL32 * Error);
  3332. //*********************************************************************/
  3333. //* */
  3334. //* Function Name: InsertObject */
  3335. //* */
  3336. //* Descriptive Name: This function inserts an object into a DLIST.*/
  3337. //* The object can be inserted before or after */
  3338. //* the current item in the list. */
  3339. //* */
  3340. //* Input: DLIST ListToAddTo : The list to which the */
  3341. //* data object is to be */
  3342. //* inserted. */
  3343. //* CARDINAL32 ItemSize : The size of the data item, in */
  3344. //* bytes. */
  3345. //* ADDRESS ItemLocation : The address of the data */
  3346. //* to append to the list */
  3347. //* TAG ItemTag : The item tag to associate with */
  3348. //* the item being appended to the */
  3349. //* list */
  3350. //* ADDRESS TargetHandle : The item in ListToAddTo which */
  3351. //* is used to determine where */
  3352. //* the item being transferred will */
  3353. //* be placed. If this is NULL, */
  3354. //* then the current item in */
  3355. //* ListToAddTo will be used. */
  3356. //* Insertion_Modes InsertMode : This indicates where, */
  3357. //* relative to the item in */
  3358. //* ListToAddTo specified by */
  3359. //* Target_Handle, the item being */
  3360. //* inserted can be placed. */
  3361. //* BOOLEAN MakeCurrent : If TRUE, the item being inserted */
  3362. //* into ListToAddTo becomes the */
  3363. //* current item in ListToAddTo. */
  3364. //* CARDINAL32 * Error : The address of a variable to hold */
  3365. //* the error return code. */
  3366. //* */
  3367. //* Output: If the operation is successful, then *Error will be */
  3368. //* set to 0 and the function return value will be the */
  3369. //* handle for the item that was appended to the list. */
  3370. //* If the operation fails, then *Error will contain an */
  3371. //* error code and the function return value will be NULL. */
  3372. //* */
  3373. //* Error Handling: This function will fail under the following */
  3374. //* conditions: */
  3375. //* ListToAddTo does not point to a valid */
  3376. //* list */
  3377. //* ItemSize is 0 */
  3378. //* ItemLocation is NULL */
  3379. //* The memory required for a LINK NODE can not */
  3380. //* be allocated. */
  3381. //* TargetHandle is invalid or is for an item */
  3382. //* in another list. */
  3383. //* If this routine fails, an error code is returned*/
  3384. //* and any memory allocated by this function is */
  3385. //* freed. */
  3386. //* */
  3387. //* Side Effects: None. */
  3388. //* */
  3389. //* Notes: The item to insert is NOT copied to the heap. Instead, */
  3390. //* the location of the item is stored in the list. This */
  3391. //* is the major difference between InsertObject and */
  3392. //* InsertItem. InsertItem allocates memory on the heap, */
  3393. //* copies the item to the memory it allocated, and stores */
  3394. //* the address of the memory it allocated in the list. */
  3395. //* InsertObject stores the address provided by the user. */
  3396. //* */
  3397. //* It is assumed that TargetHandle is valid, or is at least*/
  3398. //* the address of an accessible block of storage. If */
  3399. //* TargetHandle is invalid, or is not the address of an */
  3400. //* accessible block of storage, then a trap or exception */
  3401. //* may occur. */
  3402. //* */
  3403. //* It is assumed that Error contains a valid address. It */
  3404. //* is also assumed that if ItemLocation is not NULL, then */
  3405. //* it is a valid address that can be dereferenced. If */
  3406. //* these assumptions are violated, an exception or trap */
  3407. //* may occur. */
  3408. //* */
  3409. //* */
  3410. //*********************************************************************/
  3411. ADDRESS _System InsertObject ( DLIST ListToAddTo,
  3412. CARDINAL32 ItemSize,
  3413. ADDRESS ItemLocation,
  3414. TAG ItemTag,
  3415. ADDRESS TargetHandle,
  3416. Insertion_Modes Insert_Mode,
  3417. BOOLEAN MakeCurrent,
  3418. CARDINAL32 * Error);
  3419. //*********************************************************************/
  3420. //* */
  3421. //* Function Name: DeleteItem */
  3422. //* */
  3423. //* Descriptive Name: This function removes the specified item from*/
  3424. //* the list and optionally frees the memory */
  3425. //* associated with it. */
  3426. //* */
  3427. //* Input: DLIST ListToDeleteFrom : The list whose current */
  3428. //* item is to be deleted. */
  3429. //* BOOLEAN FreeMemory : If TRUE, then the memory */
  3430. //* associated with the current */
  3431. //* item will be freed. If FALSE */
  3432. //* then the current item will be */
  3433. //* removed from the list but its */
  3434. //* memory will not be freed. */
  3435. //* ADDRESS Handle : The handle of the item to get. This */
  3436. //* handle must be of an item which resides*/
  3437. //* in ListToDeleteFrom, or NULL. If */
  3438. //* NULL is used, then the current item */
  3439. //* in ListToDeleteFrom will be deleted. */
  3440. //* CARDINAL32 * Error : The address of a variable to hold */
  3441. //* the error return code. */
  3442. //* */
  3443. //* Output: If the operation is successful, then *Error will be */
  3444. //* set to 0. If the operation fails, then *Error will */
  3445. //* contain an error code. */
  3446. //* */
  3447. //* Error Handling: This function will fail if ListToDeleteFrom is */
  3448. //* not a valid list, or if ListToDeleteFrom is */
  3449. //* empty, or if Handle is invalid. */
  3450. //* If this routine fails, an error code is returned*/
  3451. //* in *Error. */
  3452. //* */
  3453. //* Side Effects: None. */
  3454. //* */
  3455. //* Notes: Items in a list can be accessed in two ways: A copy of */
  3456. //* the item can be obtained using GetItem and its related */
  3457. //* calls, or a pointer to the item can be obtained using */
  3458. //* GetObject and its related calls. If you have a copy of */
  3459. //* the data and wish to remove the item from the list, set */
  3460. //* FreeMemory to TRUE. This will remove the item from the */
  3461. //* list and deallocate the memory used to hold it. If you */
  3462. //* have a pointer to the item in the list (from one of the */
  3463. //* GetObject style functions) and wish to remove the item */
  3464. //* from the list, set FreeMemory to FALSE. This removes */
  3465. //* the item from the list without freeing its memory, so */
  3466. //* that the pointer obtained with the GetObject style */
  3467. //* functions is still useable. */
  3468. //* */
  3469. //* It is assumed that Error contains a valid address. If */
  3470. //* this assumption is violated, an exception or trap */
  3471. //* may occur. */
  3472. //* */
  3473. //* It is assumed that Handle is valid, or is at least the */
  3474. //* address of an accessible block of storage. If Handle */
  3475. //* is invalid, or is not the address of an accessible block*/
  3476. //* of storage, then a trap or exception may occur. */
  3477. //* NOTE: For this function, NULL is considered a valid */
  3478. //* handle which refers to the current item in */
  3479. //* ListToDeleteFrom. */
  3480. //* */
  3481. //* This function does not alter which item is the current */
  3482. //* item in the list, unless the handle specified belongs */
  3483. //* to the current item in the list, in which case the */
  3484. //* item following the current item becomes the current */
  3485. //* item in the list. If there is no item following the */
  3486. //* current item in the list, then the item preceeding the */
  3487. //* current item will become the current item in the list. */
  3488. //* */
  3489. //*********************************************************************/
  3490. void _System DeleteItem (DLIST ListToDeleteFrom,
  3491. BOOLEAN FreeMemory,
  3492. ADDRESS Handle,
  3493. CARDINAL32 * Error);
  3494. //*********************************************************************/
  3495. //* */
  3496. //* Function Name: DeleteAllItems */
  3497. //* */
  3498. //* Descriptive Name: This function deletes all of the items in the*/
  3499. //* specified list and optionally frees the */
  3500. //* memory associated with each item deleted. */
  3501. //* */
  3502. //* Input: DLIST ListToDeleteFrom : The list whose items */
  3503. //* are to be deleted. */
  3504. //* BOOLEAN FreeMemory : If TRUE, then the memory */
  3505. //* associated with each item in the*/
  3506. //* list will be freed. If FALSE */
  3507. //* then the each item will be */
  3508. //* removed from the list but its */
  3509. //* memory will not be freed. */
  3510. //* CARDINAL32 * Error : The address of a variable to hold */
  3511. //* the error return code. */
  3512. //* */
  3513. //* Output: If the operation is successful, then *Error will be */
  3514. //* set to 0. If the operation fails, then *Error will */
  3515. //* contain an error code. */
  3516. //* */
  3517. //* Error Handling: This function will fail if ListToDeleteFrom is */
  3518. //* not a valid list, or if ListToDeleteFrom is */
  3519. //* empty. */
  3520. //* If this routine fails, an error code is returned*/
  3521. //* in *Error. */
  3522. //* */
  3523. //* Side Effects: None. */
  3524. //* */
  3525. //* Notes: Items in a list can be accessed in two ways: A copy of */
  3526. //* the item can be obtained using GetItem and its related */
  3527. //* calls, or a pointer to the item can be obtained using */
  3528. //* GetObject and its related calls. If you have a copy of */
  3529. //* the data and wish to remove the item from the list, set */
  3530. //* FreeMemory to TRUE. This will remove the item from the */
  3531. //* list and deallocate the memory used to hold it. If you */
  3532. //* have a pointer to the item in the list (from one of the */
  3533. //* GetObject style functions) and wish to remove the item */
  3534. //* from the list, set FreeMemory to FALSE. This removes */
  3535. //* the item from the list without freeing its memory, so */
  3536. //* that the pointer obtained with the GetObject style */
  3537. //* functions is still useable. */
  3538. //* */
  3539. //* It is assumed that Error contains a valid address. If */
  3540. //* this assumption is violated, an exception or trap */
  3541. //* may occur. */
  3542. //* */
  3543. //*********************************************************************/
  3544. void _System DeleteAllItems (DLIST ListToDeleteFrom,
  3545. BOOLEAN FreeMemory,
  3546. CARDINAL32 * Error);
  3547. //*********************************************************************/
  3548. //* */
  3549. //* Function Name: GetItem */
  3550. //* */
  3551. //* Descriptive Name: This function copies the specified item in */
  3552. //* the list to a buffer provided by the caller. */
  3553. //* */
  3554. //* Input: DLIST ListToGetItemFrom : The list whose current item */
  3555. //* is to be copied and returned */
  3556. //* to the caller. */
  3557. //* CARDINAL32 ItemSize : What the caller thinks the size of*/
  3558. //* the current item is. */
  3559. //* ADDRESS ItemLocation : This is the location of the */
  3560. //* buffer into which the current*/
  3561. //* item is to be copied. */
  3562. //* TAG ItemTag : What the caller thinks the item tag */
  3563. //* of the current item is. */
  3564. //* ADDRESS Handle : The handle of the item to get. This */
  3565. //* handle must be of an item which resides*/
  3566. //* in ListToGetItemFrom, or NULL. If */
  3567. //* NULL, then the current item in the list*/
  3568. //* will be used. */
  3569. //* BOOLEAN MakeCurrent : If TRUE, the item to get will */
  3570. //* become the current item in the */
  3571. //* list. */
  3572. //* CARDINAL32 * Error : The address of a variable to hold */
  3573. //* the error return code. */
  3574. //* */
  3575. //* Output: If Successful : */
  3576. //* *Error will be set to 0. */
  3577. //* The buffer at ItemLocation will contain a copy of */
  3578. //* the current item from ListToGetItemFrom. */
  3579. //* If Failure : */
  3580. //* *Error will contain an error code. */
  3581. //* */
  3582. //* */
  3583. //* Error Handling: This function will fail under any of the */
  3584. //* following conditions: */
  3585. //* ListToGetItemFrom is not a valid list */
  3586. //* ItemSize does not match the size of the */
  3587. //* current item in the list */
  3588. //* ItemLocation is NULL */
  3589. //* ItemTag does not match the item tag */
  3590. //* of the current item in the list */
  3591. //* Handle is invalid, or is for an item */
  3592. //* which is not in ListToGetItemFrom */
  3593. //* If any of these conditions occur, *Error will */
  3594. //* contain a non-zero error code. */
  3595. //* */
  3596. //* Side Effects: None. */
  3597. //* */
  3598. //* Notes: It is assumed that Error contains a valid address. It */
  3599. //* is also assumed that if ItemLocation is not NULL, then */
  3600. //* it is a valid address that can be dereferenced. If */
  3601. //* these assumptions are violated, an exception or trap */
  3602. //* may occur. */
  3603. //* */
  3604. //* It is assumed that Handle is valid, or is at least the */
  3605. //* address of an accessible block of storage. If Handle */
  3606. //* is invalid, or is not the address of an accessible block*/
  3607. //* of storage, then a trap or exception may occur. */
  3608. //* NOTE: For this function, NULL is considered a valid */
  3609. //* handle corresponding to the current item in the */
  3610. //* list. */
  3611. //* */
  3612. //* This function does not alter which item is the current */
  3613. //* item in the list. */
  3614. //* */
  3615. //*********************************************************************/
  3616. void _System GetItem( DLIST ListToGetItemFrom,
  3617. CARDINAL32 ItemSize,
  3618. ADDRESS ItemLocation,
  3619. TAG ItemTag,
  3620. ADDRESS Handle,
  3621. BOOLEAN MakeCurrent,
  3622. CARDINAL32 * Error);
  3623. //*********************************************************************/
  3624. //* */
  3625. //* Function Name: GetNextItem */
  3626. //* */
  3627. //* Descriptive Name: This function advances the current item */
  3628. //* pointer and then copies the current item in */
  3629. //* the list to a buffer provided by the caller. */
  3630. //* */
  3631. //* Input: DLIST ListToGetItemFrom : The list whose current item */
  3632. //* is to be copied and returned */
  3633. //* to the caller. */
  3634. //* CARDINAL32 ItemSize : What the caller thinks the size of*/
  3635. //* the current item is. */
  3636. //* ADDRESS ItemLocation : This is the location of the */
  3637. //* buffer into which the current*/
  3638. //* item is to be copied. */
  3639. //* TAG ItemTag : What the caller thinks the item tag */
  3640. //* of the current item is. */
  3641. //* CARDINAL32 * Error : The address of a variable to hold */
  3642. //* the error return code. */
  3643. //* */
  3644. //* Output: If Successful : */
  3645. //* *Error will be set to 0. */
  3646. //* The buffer at ItemLocation will contain a copy of */
  3647. //* the current item from ListToGetItemFrom. */
  3648. //* If Failure : */
  3649. //* *Error will contain an error code. */
  3650. //* The current item pointer will NOT be advanced. */
  3651. //* The current item in the list will be the same */
  3652. //* as before the call to this function. */
  3653. //* */
  3654. //* Error Handling: This function will fail under any of the */
  3655. //* following conditions: */
  3656. //* ListToGetItemFrom is not a valid list */
  3657. //* ItemSize does not match the size of the */
  3658. //* current item in the list */
  3659. //* ItemLocation is NULL */
  3660. //* ItemTag does not match the item tag */
  3661. //* of the current item in the list */
  3662. //* The current item in the list before this */
  3663. //* function is called is the last item */
  3664. //* item in the list. */
  3665. //* If any of these conditions occur, *Error will */
  3666. //* contain a non-zero error code. */
  3667. //* */
  3668. //* Side Effects: None. */
  3669. //* */
  3670. //* Notes: It is assumed that Error contains a valid address. It */
  3671. //* is also assumed that if ItemLocation is not NULL, then */
  3672. //* it is a valid address that can be dereferenced. If */
  3673. //* these assumptions are violated, an exception or trap */
  3674. //* may occur. */
  3675. //* */
  3676. //*********************************************************************/
  3677. void _System GetNextItem( DLIST ListToGetItemFrom,
  3678. CARDINAL32 ItemSize,
  3679. ADDRESS ItemLocation,
  3680. TAG ItemTag,
  3681. CARDINAL32 * Error);
  3682. //*********************************************************************/
  3683. //* */
  3684. //* Function Name: GetPreviousItem */
  3685. //* */
  3686. //* Descriptive Name: This function makes the previous item in the */
  3687. //* list the current item in the list and then */
  3688. //* copies that item to a buffer provided by the */
  3689. //* user. */
  3690. //* */
  3691. //* Input: DLIST ListToGetItemFrom : The list whose current item */
  3692. //* is to be copied and returned */
  3693. //* to the caller. */
  3694. //* CARDINAL32 ItemSize : What the caller thinks the size of*/
  3695. //* the current item is. */
  3696. //* ADDRESS ItemLocation : This is the location of the */
  3697. //* buffer into which the current*/
  3698. //* item is to be copied. */
  3699. //* TAG ItemTag : What the caller thinks the item tag */
  3700. //* of the current item is. */
  3701. //* CARDINAL32 * Error : The address of a variable to hold */
  3702. //* the error return code. */
  3703. //* */
  3704. //* Output: If Successful : */
  3705. //* *Error will be set to 0. */
  3706. //* The buffer at ItemLocation will contain a copy of */
  3707. //* the current item from ListToGetItemFrom. */
  3708. //* If Failure : */
  3709. //* *Error will contain an error code. */
  3710. //* The current item pointer will NOT be advanced. */
  3711. //* The current item in the list will be the same */
  3712. //* as before the call to this function. */
  3713. //* */
  3714. //* Error Handling: This function will fail under any of the */
  3715. //* following conditions: */
  3716. //* ListToGetItemFrom is not a valid list */
  3717. //* ItemSize does not match the size of the */
  3718. //* current item in the list */
  3719. //* ItemLocation is NULL */
  3720. //* ItemTag does not match the item tag */
  3721. //* of the current item in the list */
  3722. //* The current item in the list before this */
  3723. //* function is called is the last item */
  3724. //* item in the list. */
  3725. //* If any of these conditions occur, *Error will */
  3726. //* contain a non-zero error code. */
  3727. //* */
  3728. //* Side Effects: None. */
  3729. //* */
  3730. //* Notes: It is assumed that Error contains a valid address. It */
  3731. //* is also assumed that if ItemLocation is not NULL, then */
  3732. //* it is a valid address that can be dereferenced. If */
  3733. //* these assumptions are violated, an exception or trap */
  3734. //* may occur. */
  3735. //* */
  3736. //*********************************************************************/
  3737. void _System GetPreviousItem( DLIST ListToGetItemFrom,
  3738. CARDINAL32 ItemSize,
  3739. ADDRESS ItemLocation,
  3740. TAG ItemTag,
  3741. CARDINAL32 * Error);
  3742. //*********************************************************************/
  3743. //* */
  3744. //* Function Name: GetObject */
  3745. //* */
  3746. //* Descriptive Name: This function returns the address of the data*/
  3747. //* associated with the specified item in the */
  3748. //* list. */
  3749. //* */
  3750. //* Input: DLIST ListToGetItemFrom : The list whose current item */
  3751. //* is to have its address */
  3752. //* returned to the caller. */
  3753. //* CARDINAL32 ItemSize : What the caller thinks the size of*/
  3754. //* the current item is. */
  3755. //* TAG ItemTag : What the caller thinks the item tag */
  3756. //* of the current item is. */
  3757. //* ADDRESS Handle : The handle of the item to get. This */
  3758. //* handle must be of an item which resides*/
  3759. //* in ListToGetItemFrom, or NULL. If */
  3760. //* NULL, then the current item in the list*/
  3761. //* BOOLEAN MakeCurrent : If TRUE, the item to get will */
  3762. //* become the current item in the */
  3763. //* list. */
  3764. //* CARDINAL32 * Error : The address of a variable to hold */
  3765. //* the error return code. */
  3766. //* */
  3767. //* Output: If Successful : */
  3768. //* *Error will be set to 0. */
  3769. //* The function return value will be the address of */
  3770. //* the data associated with the current item in the */
  3771. //* list. */
  3772. //* If Failure : */
  3773. //* *Error will contain an error code. */
  3774. //* The function return value will be NULL. */
  3775. //* */
  3776. //* Error Handling: This function will fail under any of the */
  3777. //* following conditions: */
  3778. //* ListToGetItemFrom is not a valid list */
  3779. //* ItemSize does not match the size of the */
  3780. //* current item in the list */
  3781. //* ItemTag does not match the item tag */
  3782. //* of the current item in the list */
  3783. //* Handle is invalid, or is for an item */
  3784. //* which is not in ListToGetItemFrom */
  3785. //* If any of these conditions occur, *Error will */
  3786. //* contain a non-zero error code. */
  3787. //* */
  3788. //* Side Effects: None. */
  3789. //* */
  3790. //* Notes: The user should not free the memory associated with */
  3791. //* the address returned by this function as the object is */
  3792. //* still in the list. */
  3793. //* */
  3794. //* It is assumed that Error contains a valid address. If */
  3795. //* this assumption is violated, an exception or trap may */
  3796. //* occur. */
  3797. //* */
  3798. //* It is assumed that Handle is valid, or is at least the */
  3799. //* address of an accessible block of storage. If Handle */
  3800. //* is invalid, or is not the address of an accessible block*/
  3801. //* of storage, then a trap or exception may occur. */
  3802. //* NOTE: For this function, NULL is considered a valid */
  3803. //* handle designating the current item in the list. */
  3804. //* */
  3805. //* This function does not alter which item is the current */
  3806. //* item in the list. */
  3807. //* */
  3808. //*********************************************************************/
  3809. ADDRESS _System GetObject( DLIST ListToGetItemFrom,
  3810. CARDINAL32 ItemSize,
  3811. TAG ItemTag,
  3812. ADDRESS Handle,
  3813. BOOLEAN MakeCurrent,
  3814. CARDINAL32 * Error);
  3815. //*********************************************************************/
  3816. //* */
  3817. //* Function Name: GetNextObject */
  3818. //* */
  3819. //* Descriptive Name: This function advances the current item */
  3820. //* pointer and then returns the address of the */
  3821. //* data associated with the current item in the */
  3822. //* list. */
  3823. //* */
  3824. //* Input: DLIST ListToGetItemFrom : The list whose current item */
  3825. //* is to be copied and returned */
  3826. //* to the caller. */
  3827. //* CARDINAL32 ItemSize : What the caller thinks the size of*/
  3828. //* the current item is. */
  3829. //* TAG ItemTag : What the caller thinks the item tag */
  3830. //* of the current item is. */
  3831. //* CARDINAL32 * Error : The address of a variable to hold */
  3832. //* the error return code. */
  3833. //* */
  3834. //* Output: If Successful : */
  3835. //* *Error will be set to 0. */
  3836. //* The function return value will be the address of */
  3837. //* the data associated with the current item in the */
  3838. //* list. */
  3839. //* If Failure : */
  3840. //* *Error will contain an error code. */
  3841. //* The function return value will be NULL. */
  3842. //* The current item pointer will NOT be advanced. */
  3843. //* The current item in the list will be the same */
  3844. //* as before the call to this function. */
  3845. //* */
  3846. //* Error Handling: This function will fail under any of the */
  3847. //* following conditions: */
  3848. //* ListToGetItemFrom is not a valid list */
  3849. //* ItemSize does not match the size of the */
  3850. //* current item in the list */
  3851. //* ItemTag does not match the item tag */
  3852. //* of the current item in the list */
  3853. //* The current item in the list before this */
  3854. //* function is called is the last item */
  3855. //* item in the list. */
  3856. //* If any of these conditions occur, *Error will */
  3857. //* contain a non-zero error code. */
  3858. //* */
  3859. //* Side Effects: None. */
  3860. //* */
  3861. //* Notes: The user should not free the memory associated with */
  3862. //* the address returned by this function as the object is */
  3863. //* still in the list. */
  3864. //* */
  3865. //* It is assumed that Error contains a valid address. If */
  3866. //* this assumption are violated, an exception or trap may */
  3867. //* occur. */
  3868. //* */
  3869. //*********************************************************************/
  3870. ADDRESS _System GetNextObject( DLIST ListToGetItemFrom,
  3871. CARDINAL32 ItemSize,
  3872. TAG ItemTag,
  3873. CARDINAL32 * Error);
  3874. //*********************************************************************/
  3875. //* */
  3876. //* Function Name: GetPreviousObject */
  3877. //* */
  3878. //* Descriptive Name: This function makes the previous item in the */
  3879. //* list the current item and then returns the */
  3880. //* address of the data associated with the */
  3881. //* current item in the list. */
  3882. //* */
  3883. //* Input: DLIST ListToGetItemFrom : The list whose current item */
  3884. //* is to be copied and returned */
  3885. //* to the caller. */
  3886. //* CARDINAL32 ItemSize : What the caller thinks the size of*/
  3887. //* the current item is. */
  3888. //* TAG ItemTag : What the caller thinks the item tag */
  3889. //* of the current item is. */
  3890. //* CARDINAL32 * Error : The address of a variable to hold */
  3891. //* the error return code. */
  3892. //* */
  3893. //* Output: If Successful : */
  3894. //* *Error will be set to 0. */
  3895. //* The function return value will be the address of */
  3896. //* the data associated with the current item in the */
  3897. //* list. */
  3898. //* If Failure : */
  3899. //* *Error will contain an error code. */
  3900. //* The function return value will be NULL. */
  3901. //* The current item pointer will NOT be advanced. */
  3902. //* The current item in the list will be the same */
  3903. //* as before the call to this function. */
  3904. //* */
  3905. //* Error Handling: This function will fail under any of the */
  3906. //* following conditions: */
  3907. //* ListToGetItemFrom is not a valid list */
  3908. //* ItemSize does not match the size of the */
  3909. //* current item in the list */
  3910. //* ItemTag does not match the item tag */
  3911. //* of the current item in the list */
  3912. //* The current item in the list before this */
  3913. //* function is called is the last item */
  3914. //* item in the list. */
  3915. //* If any of these conditions occur, *Error will */
  3916. //* contain a non-zero error code. */
  3917. //* */
  3918. //* Side Effects: None. */
  3919. //* */
  3920. //* Notes: The user should not free the memory associated with */
  3921. //* the address returned by this function as the object is */
  3922. //* still in the list. */
  3923. //* */
  3924. //* It is assumed that Error contains a valid address. If */
  3925. //* this assumption are violated, an exception or trap may */
  3926. //* occur. */
  3927. //* */
  3928. //*********************************************************************/
  3929. ADDRESS _System GetPreviousObject( DLIST ListToGetItemFrom,
  3930. CARDINAL32 ItemSize,
  3931. TAG ItemTag,
  3932. CARDINAL32 * Error);
  3933. //*********************************************************************/
  3934. //* */
  3935. //* Function Name: ExtractItem */
  3936. //* */
  3937. //* Descriptive Name: This function copies the specified item in */
  3938. //* the list to a buffer provided by the caller */
  3939. //* and removes the item from the list. */
  3940. //* */
  3941. //* Input: DLIST ListToGetItemFrom : The list whose current item */
  3942. //* is to be copied and returned */
  3943. //* to the caller. */
  3944. //* CARDINAL32 ItemSize : What the caller thinks the size of*/
  3945. //* the current item is. */
  3946. //* ADDRESS ItemLocation : This is the location of the */
  3947. //* buffer into which the current*/
  3948. //* item is to be copied. */
  3949. //* TAG ItemTag : What the caller thinks the item tag */
  3950. //* of the current item is. */
  3951. //* ADDRESS Handle : The handle of the item to get. This */
  3952. //* handle must be of an item which resides*/
  3953. //* in ListToGetItemFrom, or NULL. If */
  3954. //* NULL, then the current item in the list*/
  3955. //* will be used. */
  3956. //* CARDINAL32 * Error : The address of a variable to hold */
  3957. //* the error return code. */
  3958. //* */
  3959. //* Output: If Successful : */
  3960. //* *Error will be set to 0. */
  3961. //* The buffer at ItemLocation will contain a copy of */
  3962. //* the current item from ListToGetItemFrom. */
  3963. //* The item will have been removed from the list and */
  3964. //* its memory deallocated. */
  3965. //* If Failure : */
  3966. //* *Error will contain an error code. */
  3967. //* */
  3968. //* Error Handling: This function will fail under any of the */
  3969. //* following conditions: */
  3970. //* ListToGetItemFrom is not a valid list */
  3971. //* ItemSize does not match the size of the */
  3972. //* current item in the list */
  3973. //* ItemLocation is NULL */
  3974. //* ItemTag does not match the item tag */
  3975. //* of the current item in the list */
  3976. //* Handle is invalid, or is for an item */
  3977. //* which is not in ListToGetItemFrom */
  3978. //* If any of these conditions occur, *Error will */
  3979. //* contain a non-zero error code. */
  3980. //* */
  3981. //* Side Effects: None. */
  3982. //* */
  3983. //* Notes: It is assumed that Error contains a valid address. It */
  3984. //* is also assumed that if ItemLocation is not NULL, then */
  3985. //* it is a valid address that can be dereferenced. If */
  3986. //* these assumptions are violated, an exception or trap */
  3987. //* may occur. */
  3988. //* */
  3989. //* It is assumed that Handle is valid, or is at least the */
  3990. //* address of an accessible block of storage. If Handle */
  3991. //* is invalid, or is not the address of an accessible block*/
  3992. //* of storage, then a trap or exception may occur. */
  3993. //* NOTE: For this function, NULL is considered a valid */
  3994. //* handle which refers to the current item in the */
  3995. //* list. */
  3996. //* */
  3997. //* This function does not alter which item is the current */
  3998. //* item in the list, unless the handle specified belongs */
  3999. //* to the current item in the list, in which case the */
  4000. //* item following the current item becomes the current */
  4001. //* item in the list. If there is no item following the */
  4002. //* current item in the list, then the item preceeding the */
  4003. //* current item will become the current item in the list. */
  4004. //* */
  4005. //*********************************************************************/
  4006. void _System ExtractItem( DLIST ListToGetItemFrom,
  4007. CARDINAL32 ItemSize,
  4008. ADDRESS ItemLocation,
  4009. TAG ItemTag,
  4010. ADDRESS Handle,
  4011. CARDINAL32 * Error);
  4012. //*********************************************************************/
  4013. //* */
  4014. //* Function Name: ExtractObject */
  4015. //* */
  4016. //* Descriptive Name: This function returns the address of the data*/
  4017. //* associated with the specified item in the */
  4018. //* list and then removes that item from the list*/
  4019. //* */
  4020. //* Input: DLIST ListToGetItemFrom : The list whose current item */
  4021. //* is to be copied and returned */
  4022. //* to the caller. */
  4023. //* CARDINAL32 ItemSize : What the caller thinks the size of*/
  4024. //* the current item is. */
  4025. //* TAG ItemTag : What the caller thinks the item tag */
  4026. //* of the current item is. */
  4027. //* ADDRESS Handle : The handle of the item to get. This */
  4028. //* handle must be of an item which resides*/
  4029. //* in ListToGetItemFrom, or NULL. If */
  4030. //* NULL, then the current item in the */
  4031. //* list will be used. */
  4032. //* CARDINAL32 * Error : The address of a variable to hold */
  4033. //* the error return code. */
  4034. //* */
  4035. //* Output: If Successful : */
  4036. //* *Error will be set to 0. */
  4037. //* The function return value will be the address of */
  4038. //* the data associated with the current item in the */
  4039. //* list. */
  4040. //* The current item is removed from the list. */
  4041. //* If Failure : */
  4042. //* *Error will contain an error code. */
  4043. //* The function return value will be NULL. */
  4044. //* */
  4045. //* Error Handling: This function will fail under any of the */
  4046. //* following conditions: */
  4047. //* ListToGetItemFrom is not a valid list */
  4048. //* ItemSize does not match the size of the */
  4049. //* current item in the list */
  4050. //* ItemTag does not match the item tag */
  4051. //* of the current item in the list */
  4052. //* Handle is invalid, or is for an item */
  4053. //* which is not in ListToGetItemFrom */
  4054. //* If any of these conditions occur, *Error will */
  4055. //* contain a non-zero error code. */
  4056. //* */
  4057. //* Side Effects: None. */
  4058. //* */
  4059. //* Notes: The user is responsible for the memory associated with */
  4060. //* the address returned by this function since this */
  4061. //* function removes that object from the list. This means */
  4062. //* that, when the user is through with the object, they */
  4063. //* should free it. */
  4064. //* */
  4065. //* It is assumed that Error contains a valid address. If */
  4066. //* this assumption is violated, an exception or trap may */
  4067. //* occur. */
  4068. //* */
  4069. //* It is assumed that Handle is valid, or is at least the */
  4070. //* address of an accessible block of storage. If Handle */
  4071. //* is invalid, or is not the address of an accessible block*/
  4072. //* of storage, then a trap or exception may occur. */
  4073. //* NOTE: For this function, NULL is considered a valid */
  4074. //* handle which refers to the current item in the */
  4075. //* list. */
  4076. //* */
  4077. //* This function does not alter which item is the current */
  4078. //* item in the list, unless the handle specified belongs */
  4079. //* to the current item in the list, in which case the */
  4080. //* item following the current item becomes the current */
  4081. //* item in the list. If there is no item following the */
  4082. //* current item in the list, then the item preceeding the */
  4083. //* current item will become the current item in the list. */
  4084. //* */
  4085. //*********************************************************************/
  4086. ADDRESS _System ExtractObject( DLIST ListToGetItemFrom,
  4087. CARDINAL32 ItemSize,
  4088. TAG ItemTag,
  4089. ADDRESS Handle,
  4090. CARDINAL32 * Error);
  4091. //*********************************************************************/
  4092. //* */
  4093. //* Function Name: ReplaceItem */
  4094. //* */
  4095. //* Descriptive Name: This function replaces the specified item in */
  4096. //* the list with the one provided as its */
  4097. //* argument. */
  4098. //* */
  4099. //* Input: DLIST ListToReplaceItemIn : The list whose current item*/
  4100. //* is to be replaced */
  4101. //* CARDINAL32 ItemSize : The size, in bytes, of the */
  4102. //* replacement item */
  4103. //* ADDRESS ItemLocation : The address of the replacement*/
  4104. //* item */
  4105. //* TAG ItemTag : The item tag that the user wishes to */
  4106. //* associate with the replacement item */
  4107. //* ADDRESS Handle : The handle of the item to get. This */
  4108. //* handle must be of an item which resides */
  4109. //* in ListToGetItemFrom, or NULL. If NULL */
  4110. //* then the current item in the list will */
  4111. //* used. */
  4112. //* BOOLEAN MakeCurrent : If TRUE, the item to get will */
  4113. //* become the current item in the */
  4114. //* list. */
  4115. //* CARDINAL32 * Error : The address of a variable to hold */
  4116. //* the error return code */
  4117. //* */
  4118. //* Output: If Successful then *Error will be set to 0. */
  4119. //* If Unsuccessful, then *Error will be set to a non-zero */
  4120. //* error code. */
  4121. //* */
  4122. //* Error Handling: This function will fail under the following */
  4123. //* conditions: */
  4124. //* ListToReplaceItemIn is empty */
  4125. //* ItemSize is 0 */
  4126. //* ItemLocation is NULL */
  4127. //* The memory required can not be allocated. */
  4128. //* Handle is invalid, or is for an item */
  4129. //* which is not in ListToGetItemFrom */
  4130. //* If any of these conditions occurs, *Error */
  4131. //* will contain a non-zero error code. */
  4132. //* */
  4133. //* Side Effects: None. */
  4134. //* */
  4135. //* Notes: It is assumed that Error contains a valid address. It */
  4136. //* is also assumed that if ItemLocation is not NULL, then */
  4137. //* it is a valid address that can be dereferenced. If */
  4138. //* these assumptions are violated, an exception or trap */
  4139. //* may occur. */
  4140. //* */
  4141. //* It is assumed that Handle is valid, or is at least the */
  4142. //* address of an accessible block of storage. If Handle */
  4143. //* is invalid, or is not the address of an accessible block*/
  4144. //* of storage, then a trap or exception may occur. */
  4145. //* NOTE: For this function, NULL is a valid handle which */
  4146. //* refers to the current item in the list. */
  4147. //* */
  4148. //* This function does not alter which item is the current */
  4149. //* item in the list. */
  4150. //* */
  4151. //*********************************************************************/
  4152. void _System ReplaceItem( DLIST ListToReplaceItemIn,
  4153. CARDINAL32 ItemSize,
  4154. ADDRESS ItemLocation,
  4155. TAG ItemTag,
  4156. ADDRESS Handle,
  4157. BOOLEAN MakeCurrent,
  4158. CARDINAL32 * Error);
  4159. //*********************************************************************/
  4160. //* */
  4161. //* Function Name: ReplaceObject */
  4162. //* */
  4163. //* Descriptive Name: This function replaces the specified object */
  4164. //* in the list with the one provided as its */
  4165. //* argument. */
  4166. //* */
  4167. //* Input: DLIST ListToReplaceItemIn : The list whose current */
  4168. //* object is to be replaced */
  4169. //* CARDINAL32 ItemSize : The size, in bytes, of the */
  4170. //* replacement object */
  4171. //* ADDRESS ItemLocation : The address of the replacement*/
  4172. //* item */
  4173. //* TAG ItemTag : The item tag that the user wishes to */
  4174. //* associate with the replacement item */
  4175. //* ADDRESS Handle : The handle of the item to get. This */
  4176. //* handle must be of an item which resides */
  4177. //* in ListToGetItemFrom, or NULL. If NULL */
  4178. //* then the current item in the list will */
  4179. //* be used. */
  4180. //* BOOLEAN MakeCurrent : If TRUE, the item to get will */
  4181. //* become the current item in the */
  4182. //* list. */
  4183. //* CARDINAL32 * Error : The address of a variable to hold */
  4184. //* the error return code */
  4185. //* */
  4186. //* Output: If Successful then *Error will be set to 0 and the */
  4187. //* return value of the function will be the address */
  4188. //* of the object that was replaced. */
  4189. //* If Unsuccessful, then *Error will be set to a non-zero */
  4190. //* error code and the function return value will be */
  4191. //* NULL. */
  4192. //* */
  4193. //* Error Handling: This function will fail under the following */
  4194. //* conditions: */
  4195. //* ListToReplaceItemIn is empty */
  4196. //* ItemSize is 0 */
  4197. //* ItemLocation is NULL */
  4198. //* The memory required can not be allocated. */
  4199. //* Handle is invalid, or is for an item */
  4200. //* which is not in ListToGetItemFrom */
  4201. //* If any of these conditions occurs, *Error */
  4202. //* will contain a non-zero error code. */
  4203. //* */
  4204. //* Side Effects: None. */
  4205. //* */
  4206. //* Notes: The user is responsible for the memory associated with */
  4207. //* the object returned by this function as that object is */
  4208. //* removed from the list. This means that, when the user */
  4209. //* is through with the object returned by this function, */
  4210. //* they should free it. */
  4211. //* */
  4212. //* It is assumed that Error contains a valid address. It */
  4213. //* is also assumed that if ItemLocation is not NULL, then */
  4214. //* it is a valid address that can be dereferenced. If */
  4215. //* these assumptions are violated, an exception or trap */
  4216. //* may occur. */
  4217. //* */
  4218. //* It is assumed that Handle is valid, or is at least the */
  4219. //* address of an accessible block of storage. If Handle */
  4220. //* is invalid, or is not the address of an accessible block*/
  4221. //* of storage, then a trap or exception may occur. */
  4222. //* NOTE: For this function, NULL is a valid handle for the */
  4223. //* current item in the list. */
  4224. //* */
  4225. //* This function does not alter which item is the current */
  4226. //* item in the list. */
  4227. //* */
  4228. //*********************************************************************/
  4229. ADDRESS _System ReplaceObject( DLIST ListToReplaceItemIn,
  4230. CARDINAL32 * ItemSize, /* On input - size of new object. On return = size of old object. */
  4231. ADDRESS ItemLocation,
  4232. TAG * ItemTag, /* On input - TAG of new object. On return = TAG of old object. */
  4233. ADDRESS Handle,
  4234. BOOLEAN MakeCurrent,
  4235. CARDINAL32 * Error);
  4236. //*********************************************************************/
  4237. //* */
  4238. //* Function Name: GetTag */
  4239. //* */
  4240. //* Descriptive Name: This function returns the item tag associated*/
  4241. //* with the current item in the list. */
  4242. //* */
  4243. //* Input: DLIST ListToGetTagFrom : The list from which the item */
  4244. //* tag of the current item is to */
  4245. //* be returned */
  4246. //* ADDRESS Handle : The handle of the item whose TAG and */
  4247. //* size we are to get. This handle must */
  4248. //* be of an item which resides in */
  4249. //* in ListToGetTagFrom, or NULL. If NULL */
  4250. //* then the current item in the list will */
  4251. //* be used. */
  4252. //* CARDINAL32 * ItemSize : The size, in bytes, of the */
  4253. //* current item in the list. */
  4254. //* CARDINAL32 * Error : The address of a variable to hold */
  4255. //* the error return code */
  4256. //* */
  4257. //* Output: If successful, the function returns the item tag & size*/
  4258. //* associated with the current item in ListToGetTagFrom*/
  4259. //* and *Error is set to 0. */
  4260. //* If unsuccessful, the function returns 0 and *Error is */
  4261. //* set to a non-zero error code. */
  4262. //* */
  4263. //* Error Handling: This function will fail if ListToGetTagFrom is */
  4264. //* not a valid list or is an empty list. In either*/
  4265. //* of these cases, *Error is set to a non-zero */
  4266. //* error code. */
  4267. //* */
  4268. //* Side Effects: None. */
  4269. //* */
  4270. //* Notes: It is assumed that Error contains a valid address. If */
  4271. //* this assumption is violated, an exception or trap */
  4272. //* may occur. */
  4273. //* */
  4274. //* */
  4275. //*********************************************************************/
  4276. TAG _System GetTag( DLIST ListToGetTagFrom,
  4277. ADDRESS Handle,
  4278. CARDINAL32 * ItemSize,
  4279. CARDINAL32 * Error);
  4280. //*********************************************************************/
  4281. //* */
  4282. //* Function Name: GetHandle */
  4283. //* */
  4284. //* Descriptive Name: This function returns a handle for the */
  4285. //* current item in the list. This handle is */
  4286. //* then associated with that item regardless of */
  4287. //* its position in the list. This handle can be*/
  4288. //* used to make its associated item the current */
  4289. //* item in the list. */
  4290. //* */
  4291. //* Input: DLIST ListToGetHandleFrom : The list from which a */
  4292. //* handle is needed. */
  4293. //* CARDINAL32 * Error : The address of a variable to hold */
  4294. //* the error return code */
  4295. //* */
  4296. //* Output: If successful, the function returns a handle for the */
  4297. //* the current item in ListToGetHandleFrom, and *Error */
  4298. //* is set to 0. */
  4299. //* If unsuccessful, the function returns 0 and *Error is */
  4300. //* set to a non-zero error code. */
  4301. //* */
  4302. //* Error Handling: This function will fail if ListToGetHandleFrom */
  4303. //* is not a valid list or is an empty list. In */
  4304. //* either of these cases, *Error is set to a */
  4305. //* non-zero error code. */
  4306. //* */
  4307. //* Side Effects: None. */
  4308. //* */
  4309. //* Notes: It is assumed that Error contains a valid address. If */
  4310. //* this assumption is violated, an exception or trap */
  4311. //* may occur. */
  4312. //* */
  4313. //* The handle returned is a pointer to an internal */
  4314. //* structure within the list. If the item associated */
  4315. //* with this handle is removed from the list, the handle */
  4316. //* will be invalid and should not be used as the internal */
  4317. //* structure it points to will nolonger exist! */
  4318. //* */
  4319. //*********************************************************************/
  4320. ADDRESS _System GetHandle ( DLIST ListToGetHandleFrom, CARDINAL32 * Error);
  4321. //*********************************************************************/
  4322. //* */
  4323. //* Function Name: GetListSize */
  4324. //* */
  4325. //* Descriptive Name: This function returns the number of items in */
  4326. //* a list. */
  4327. //* */
  4328. //* Input: DLIST ListToGetSizeOf : The list whose size we wish to*/
  4329. //* know */
  4330. //* CARDINAL32 * Error : The address of a variable to hold */
  4331. //* the error return code */
  4332. //* */
  4333. //* Output: If successful, the function returns the a count of the */
  4334. //* number of items in the list, and *Error is set to 0.*/
  4335. //* If unsuccessful, the function returns 0 and *Error is */
  4336. //* set to a non-zero error code. */
  4337. //* */
  4338. //* Error Handling: This function will fail if ListToGetSizeOf is */
  4339. //* not a valid list. If this happens, then *Error */
  4340. //* is set to a non-zero error code. */
  4341. //* */
  4342. //* Side Effects: None. */
  4343. //* */
  4344. //* Notes: It is assumed that Error contains a valid address. If */
  4345. //* this assumption is violated, an exception or trap */
  4346. //* may occur. */
  4347. //* */
  4348. //*********************************************************************/
  4349. CARDINAL32 _System GetListSize( DLIST ListToGetSizeOf, CARDINAL32 * Error);
  4350. //*********************************************************************/
  4351. //* */
  4352. //* Function Name: ListEmpty */
  4353. //* */
  4354. //* Descriptive Name: This function returns TRUE if the */
  4355. //* specified list is empty, otherwise it returns*/
  4356. //* FALSE. */
  4357. //* */
  4358. //* Input: DLIST ListToCheck : The list to check to see if it*/
  4359. //* is empty */
  4360. //* CARDINAL32 * Error : The address of a variable to hold */
  4361. //* the error return code */
  4362. //* */
  4363. //* Output: If successful, the function returns TRUE if the */
  4364. //* number of items in the list is 0, otherwise it */
  4365. //* returns FALSE. Also, *Error is set to 0. */
  4366. //* If unsuccessful, the function returns TRUE and */
  4367. //* *Error is set to a non-zero error code. */
  4368. //* */
  4369. //* Error Handling: This function will fail if ListToCheck is not */
  4370. //* a valid list. If this happens, then *Error */
  4371. //* is set to a non-zero error code. */
  4372. //* */
  4373. //* Side Effects: None. */
  4374. //* */
  4375. //* Notes: It is assumed that Error contains a valid address. If */
  4376. //* this assumption is violated, an exception or trap */
  4377. //* may occur. */
  4378. //* */
  4379. //*********************************************************************/
  4380. BOOLEAN _System ListEmpty( DLIST ListToCheck, CARDINAL32 * Error);
  4381. //*********************************************************************/
  4382. //* */
  4383. //* Function Name: AtEndOfList */
  4384. //* */
  4385. //* Descriptive Name: This function returns TRUE if the */
  4386. //* current item in the list is the last item */
  4387. //* in the list. Returns FALSE otherwise. */
  4388. //* */
  4389. //* Input: DLIST ListToCheck : The list to check. */
  4390. //* CARDINAL32 * Error : The address of a variable to hold */
  4391. //* the error return code */
  4392. //* */
  4393. //* Output: If successful, the function returns TRUE if the */
  4394. //* current item in the list is the last item in the */
  4395. //* list. If it is not the last item in the list, */
  4396. //* FALSE is returned. *Error_Code is set to */
  4397. //* DLIST_SUCCESS. */
  4398. //* If unsuccessful, the function returns FALSE and */
  4399. //* *Error is set to a non-zero error code. */
  4400. //* */
  4401. //* Error Handling: This function will fail if ListToCheck is not */
  4402. //* a valid list. If this happens, then *Error */
  4403. //* is set to a non-zero error code. */
  4404. //* */
  4405. //* Side Effects: None. */
  4406. //* */
  4407. //* Notes: It is assumed that Error contains a valid address. If */
  4408. //* this assumption is violated, an exception or trap */
  4409. //* may occur. */
  4410. //* */
  4411. //*********************************************************************/
  4412. BOOLEAN _System AtEndOfList( DLIST ListToCheck, CARDINAL32 * Error);
  4413. //*********************************************************************/
  4414. //* */
  4415. //* Function Name: AtStartOfList */
  4416. //* */
  4417. //* Descriptive Name: This function returns TRUE if the */
  4418. //* current item in the list is the first item */
  4419. //* in the list. Returns FALSE otherwise. */
  4420. //* */
  4421. //* Input: DLIST ListToCheck : The list to check. */
  4422. //* CARDINAL32 * Error : The address of a variable to hold */
  4423. //* the error return code */
  4424. //* */
  4425. //* Output: If successful, the function returns TRUE if the */
  4426. //* current item in the list is the first item in the */
  4427. //* list. If it is not the first item in the list, */
  4428. //* FALSE is returned. *Error_Code is set to */
  4429. //* DLIST_SUCCESS. */
  4430. //* If unsuccessful, the function returns FALSE and */
  4431. //* *Error is set to a non-zero error code. */
  4432. //* */
  4433. //* Error Handling: This function will fail if ListToCheck is not */
  4434. //* a valid list. If this happens, then *Error */
  4435. //* is set to a non-zero error code. */
  4436. //* */
  4437. //* Side Effects: None. */
  4438. //* */
  4439. //* Notes: It is assumed that Error contains a valid address. If */
  4440. //* this assumption is violated, an exception or trap */
  4441. //* may occur. */
  4442. //* */
  4443. //*********************************************************************/
  4444. BOOLEAN _System AtStartOfList( DLIST ListToCheck, CARDINAL32 * Error);
  4445. //*********************************************************************/
  4446. //* */
  4447. //* Function Name: DestroyList */
  4448. //* */
  4449. //* Descriptive Name: This function releases the memory associated */
  4450. //* with the internal data structures of a DLIST.*/
  4451. //* Once a DLIST has been eliminated by this */
  4452. //* function, it must be reinitialized before it */
  4453. //* can be used again. */
  4454. //* */
  4455. //* Input: DLIST ListToDestroy : The list to be eliminated */
  4456. //* from memory. */
  4457. //* BOOLEAN FreeItemMemory : If TRUE, all items in the list */
  4458. //* will be freed. If FALSE, all */
  4459. //* items in the list are not */
  4460. //* freed, only the list structures*/
  4461. //* associated with them are. */
  4462. //* CARDINAL32 * Error : The address of a variable to hold */
  4463. //* the error return code */
  4464. //* */
  4465. //* Output: If successful, *Error will be set to 0. */
  4466. //* If unsuccessful, *Error will be set to a non-zero error*/
  4467. //* code. */
  4468. //* */
  4469. //* Error Handling: This function will fail if ListToDestroy is not */
  4470. //* a valid list. If this happens, then *Error */
  4471. //* is set to a non-zero error code. */
  4472. //* */
  4473. //* Side Effects: None. */
  4474. //* */
  4475. //* Notes: It is assumed that Error contains a valid address. If */
  4476. //* this assumption is violated, an exception or trap */
  4477. //* may occur. */
  4478. //* */
  4479. //* If FreeItemMemory is TRUE, then this function will try */
  4480. //* to delete any items which may be in the list. However, */
  4481. //* since this function has no way of knowing the internal */
  4482. //* structure of an item, items which contain embedded */
  4483. //* pointers will not be entirely freed. This can lead to */
  4484. //* memory leaks. The programmer should ensure that any */
  4485. //* list passed to this function when the FreeItemMemory */
  4486. //* parameter is TRUE is empty or does not contain any */
  4487. //* items with embedded pointers. */
  4488. //* */
  4489. //*********************************************************************/
  4490. void _System DestroyList( DLIST * ListToDestroy, BOOLEAN FreeItemMemory, CARDINAL32 * Error);
  4491. //*********************************************************************/
  4492. //* */
  4493. //* Function Name: NextItem */
  4494. //* */
  4495. //* Descriptive Name: This function makes the next item in the list*/
  4496. //* the current item in the list (i.e. it */
  4497. //* advances the current item pointer). */
  4498. //* */
  4499. //* Input: DLIST ListToAdvance : The list whose current item */
  4500. //* pointer is to be advanced */
  4501. //* CARDINAL32 * Error : The address of a variable to hold */
  4502. //* the error return code */
  4503. //* */
  4504. //* Output: If successful, *Error will be set to 0. */
  4505. //* If unsuccessful, *Error will be set to a non-zero error*/
  4506. //* code. */
  4507. //* */
  4508. //* Error Handling: This function will fail under the following */
  4509. //* conditions: */
  4510. //* ListToAdvance is not a valid list */
  4511. //* ListToAdvance is empty */
  4512. //* The current item is the last item in the */
  4513. //* list */
  4514. //* If any of these conditions occurs, then *Error */
  4515. //* is set to a non-zero error code. */
  4516. //* */
  4517. //* Side Effects: None. */
  4518. //* */
  4519. //* Notes: It is assumed that Error contains a valid address. If */
  4520. //* this assumption is violated, an exception or trap */
  4521. //* may occur. */
  4522. //* */
  4523. //*********************************************************************/
  4524. void _System NextItem( DLIST ListToAdvance, CARDINAL32 * Error);
  4525. //*********************************************************************/
  4526. //* */
  4527. //* Function Name: PreviousItem */
  4528. //* */
  4529. //* Descriptive Name: This function makes the previous item in the */
  4530. //* list the current item in the list. */
  4531. //* */
  4532. //* Input: DLIST ListToChange : The list whose current item */
  4533. //* pointer is to be changed */
  4534. //* CARDINAL32 * Error : The address of a variable to hold */
  4535. //* the error return code */
  4536. //* */
  4537. //* Output: If successful, *Error will be set to 0. */
  4538. //* If unsuccessful, *Error will be set to a non-zero error*/
  4539. //* code. */
  4540. //* */
  4541. //* Error Handling: This function will fail under the following */
  4542. //* conditions: */
  4543. //* ListToChange is not a valid list */
  4544. //* ListToChange is empty */
  4545. //* The current item is the first item in the */
  4546. //* list */
  4547. //* If any of these conditions occurs, then *Error */
  4548. //* is set to a non-zero error code. */
  4549. //* */
  4550. //* Side Effects: None. */
  4551. //* */
  4552. //* Notes: It is assumed that Error contains a valid address. If */
  4553. //* this assumption is violated, an exception or trap */
  4554. //* may occur. */
  4555. //* */
  4556. //*********************************************************************/
  4557. void _System PreviousItem( DLIST ListToChange, CARDINAL32 * Error);
  4558. //*********************************************************************/
  4559. //* */
  4560. //* Function Name: GoToStartOfList */
  4561. //* */
  4562. //* Descriptive Name: This function makes the first item in the */
  4563. //* list the current item in the list. */
  4564. //* */
  4565. //* Input: DLIST ListToReset : The list whose current item */
  4566. //* is to be set to the first item */
  4567. //* in the list */
  4568. //* CARDINAL32 * Error : The address of a variable to hold */
  4569. //* the error return code */
  4570. //* */
  4571. //* Output: If successful, *Error will be set to 0. */
  4572. //* If unsuccessful, *Error will be set to a non-zero error*/
  4573. //* code. */
  4574. //* */
  4575. //* Error Handling: This function will fail if ListToReset is not */
  4576. //* a valid list. If this occurs, then *Error */
  4577. //* is set to a non-zero error code. */
  4578. //* */
  4579. //* Side Effects: None. */
  4580. //* */
  4581. //* Notes: It is assumed that Error contains a valid address. If */
  4582. //* this assumption is violated, an exception or trap */
  4583. //* may occur. */
  4584. //* */
  4585. //*********************************************************************/
  4586. void _System GoToStartOfList( DLIST ListToReset, CARDINAL32 * Error);
  4587. //*********************************************************************/
  4588. //* */
  4589. //* Function Name: GoToEndOfList */
  4590. //* */
  4591. //* Descriptive Name: This function makes the last item in the */
  4592. //* list the current item in the list. */
  4593. //* */
  4594. //* Input: DLIST ListToSet : The list whose current item */
  4595. //* is to be set to the last item */
  4596. //* in the list */
  4597. //* CARDINAL32 * Error : The address of a variable to hold */
  4598. //* the error return code */
  4599. //* */
  4600. //* Output: If successful, *Error will be set to 0. */
  4601. //* If unsuccessful, *Error will be set to a non-zero error*/
  4602. //* code. */
  4603. //* */
  4604. //* Error Handling: This function will fail if ListToSet is not */
  4605. //* a valid list. If this occurs, then *Error */
  4606. //* is set to a non-zero error code. */
  4607. //* */
  4608. //* Side Effects: None. */
  4609. //* */
  4610. //* Notes: It is assumed that Error contains a valid address. If */
  4611. //* this assumption is violated, an exception or trap */
  4612. //* may occur. */
  4613. //* */
  4614. //*********************************************************************/
  4615. void _System GoToEndOfList( DLIST ListToSet, CARDINAL32 * Error);
  4616. //*********************************************************************/
  4617. //* */
  4618. //* Function Name: GoToSpecifiedItem */
  4619. //* */
  4620. //* Descriptive Name: This function makes the item associated with */
  4621. //* Handle the current item in the list. */
  4622. //* */
  4623. //* Input: DLIST ListToReposition: The list whose current item */
  4624. //* is to be set to the item */
  4625. //* associated with Handle. */
  4626. //* ADDRESS Handle : A handle obtained by using the */
  4627. //* GetHandle function. This handle */
  4628. //* identifies a unique item in the list. */
  4629. //* CARDINAL32 * Error : The address of a variable to hold */
  4630. //* the error return code */
  4631. //* */
  4632. //* Output: If successful, *Error will be set to 0. */
  4633. //* If unsuccessful, *Error will be set to a non-zero error*/
  4634. //* code. */
  4635. //* */
  4636. //* Error Handling: This function will fail if ListToReposition is */
  4637. //* not a valid list. If this occurs, then *Error */
  4638. //* is set to a non-zero error code. */
  4639. //* */
  4640. //* Side Effects: None. */
  4641. //* */
  4642. //* Notes: It is assumed that Error contains a valid address. If */
  4643. //* this assumption is violated, an exception or trap */
  4644. //* may occur. */
  4645. //* */
  4646. //* */
  4647. //* It is assumed that Handle is a valid handle and that */
  4648. //* the item associated with Handle is still in the list. */
  4649. //* If these conditions are not met, an exception or trap */
  4650. //* may occur. */
  4651. //* */
  4652. //*********************************************************************/
  4653. void _System GoToSpecifiedItem( DLIST ListToReposition, ADDRESS Handle, CARDINAL32 * Error);
  4654. //*********************************************************************/
  4655. //* */
  4656. //* Function Name: SortList */
  4657. //* */
  4658. //* Descriptive Name: This function sorts the contents of a list. */
  4659. //* The sorting algorithm used is a stable sort */
  4660. //* whose performance is not dependent upon the */
  4661. //* initial order of the items in the list. */
  4662. //* */
  4663. //* Input: DLIST ListToSort : The DLIST that is to be sorted. */
  4664. //* */
  4665. //* INTEGER32 ( *Compare) ( ... ) */
  4666. //* */
  4667. //* This is a pointer to a function that can compare any */
  4668. //* two items in the list. It should return -1 if */
  4669. //* Object1 is less than Object2, 0 if Object1 is equal */
  4670. //* to Object2, and 1 if Object1 is greater than Object2.*/
  4671. //* This function will be called during the sort whenever*/
  4672. //* the sorting algorithm needs to compare two objects. */
  4673. //* */
  4674. //* The Compare function takes the following parameters: */
  4675. //* */
  4676. //* ADDRESS Object1 : The address of the data for the */
  4677. //* first object to be compared. */
  4678. //* TAG Object1Tag : The user assigned TAG value for the */
  4679. //* first object to be compared. */
  4680. //* ADDRESS Object2 : The address of the data for the */
  4681. //* second object to be compared. */
  4682. //* TAG Object2Tag : The user assigned TAG value for the */
  4683. //* second object to be compared. */
  4684. //* CARDINAL32 * Error : The address of a variable to */
  4685. //* hold the error return value. */
  4686. //* */
  4687. //* If this function ever sets *Error to a non-zero value*/
  4688. //* the sort will terminate and the error code will be */
  4689. //* returned to the caller of the SortList function. */
  4690. //* */
  4691. //* CARDINAL32 * Error : The address of a variable to hold */
  4692. //* the error return value. */
  4693. //* */
  4694. //* Output: If successful, this function will set *Error to */
  4695. //* DLIST_SUCCESS and ListToSort will have been sorted. */
  4696. //* If unsuccessful, *Error will contain an error code. */
  4697. //* The order of the items in ListToSort is undefined */
  4698. //* and may have changed. */
  4699. //* */
  4700. //* Error Handling: This function will terminate if *Compare sets */
  4701. //* *Error to a non-zero value, or if ListToSort */
  4702. //* is invalid. If this function does terminate in */
  4703. //* the middle of a sort, the order of the items in */
  4704. //* ListToSort may be different than it was before */
  4705. //* the function was called. */
  4706. //* */
  4707. //* Side Effects: None. */
  4708. //* */
  4709. //* Notes: It is assumed that Error contains a valid address. If */
  4710. //* this assumption is violated, an exception or trap */
  4711. //* may occur. */
  4712. //* */
  4713. //*********************************************************************/
  4714. void _System SortList(DLIST ListToSort,
  4715. INTEGER32 ( * _System Compare) (ADDRESS Object1, TAG Object1Tag, ADDRESS Object2, TAG Object2Tag,CARDINAL32 * Error),
  4716. CARDINAL32 * Error);
  4717. //*********************************************************************/
  4718. //* */
  4719. //* Function Name: ForEachItem */
  4720. //* */
  4721. //* Descriptive Name: This function passes a pointer to each item */
  4722. //* in a list to a user provided function for */
  4723. //* processing by the user provided function. */
  4724. //* */
  4725. //* Input: DLIST ListToProcess : The DLIST whose items are to be */
  4726. //* processed by the user provided */
  4727. //* function. */
  4728. //* */
  4729. //* void ( * ProcessItem) (...) */
  4730. //* */
  4731. //* This is a pointer to the user provided function. */
  4732. //* This user provided function takes the following */
  4733. //* parameters: */
  4734. //* */
  4735. //* ADDRESS Object : A pointer to an item in */
  4736. //* ListToProcess. */
  4737. //* TAG Object1Tag : The user assigned TAG value for */
  4738. //* the item pointed to by Object. */
  4739. //* ADDRESS Parameter : The address of a block of */
  4740. //* memory containing any */
  4741. //* parameters that the user */
  4742. //* wishes to have passed to this*/
  4743. //* function. */
  4744. //* CARDINAL32 * Error : The address of a variable to*/
  4745. //* hold the error return value.*/
  4746. //* */
  4747. //* ADDRESS Parameters : This field is passed through to */
  4748. //* *ProcessItem. This function does */
  4749. //* not even look at the contents of */
  4750. //* this field. This field is here to */
  4751. //* provide the user a way to pass */
  4752. //* additional data to *ProcessItem */
  4753. //* that *ProcessItem may need to */
  4754. //* function correctly. */
  4755. //* */
  4756. //* BOOLEAN Forward : If TRUE, then the list is traversed */
  4757. //* from the start of the list to the end */
  4758. //* of the list. If FALSE, then the list */
  4759. //* is traversed from the end of the list */
  4760. //* to the beginning. */
  4761. //* */
  4762. //* CARDINAL32 * Error : The address of a variable to hold */
  4763. //* the error return value. */
  4764. //* */
  4765. //* Output: If successful, this function will set *Error to */
  4766. //* DLIST_SUCCESS. */
  4767. //* If unsuccessful, then this function will set *Error to */
  4768. //* a non-zero error code. */
  4769. //* */
  4770. //* Error Handling: This function aborts immediately when an error */
  4771. //* is detected, and any remaining items in the list*/
  4772. //* will not be processed. */
  4773. //* */
  4774. //* Side Effects: None. */
  4775. //* */
  4776. //* Notes: This function allows the user to access all of the items */
  4777. //* in a list and perform an operation on them. The */
  4778. //* operation performed must not free any items in the list, */
  4779. //* or perform any list operations on the list being */
  4780. //* processed. */
  4781. //* */
  4782. //* As an example of when this would be useful, consider a */
  4783. //* a list of graphic objects (rectangles, triangles, circles*/
  4784. //* etc.) which comprise a drawing. To draw the picture */
  4785. //* that these graphic objects represent, one could build a */
  4786. //* loop which gets and draws each item. Another way to */
  4787. //* do this would be to build a drawing function which can */
  4788. //* draw any of the graphic objects, and then use that */
  4789. //* function as the ProcessItem function in a call to */
  4790. //* ForEachItem. */
  4791. //* */
  4792. //* If the ProcessItem function sets *Error to something */
  4793. //* other than DLIST_SUCCESS, then ForEachItem will terminate*/
  4794. //* and return an error to whoever called it. The single */
  4795. //* exception to this is if ProcessItem sets *Error to */
  4796. //* DLIST_SEARCH_COMPLETE, in which case ForEachItem */
  4797. //* terminates and sets *Error to DLIST_SUCCESS. This is */
  4798. //* useful for using ForEachItem to search a list and then */
  4799. //* terminating the search once the desired item is found. */
  4800. //* */
  4801. //* A word about the Parameters parameter. This parameter */
  4802. //* is passed through to *ProcessItem and is never looked at */
  4803. //* by this function. This means that the user can put any */
  4804. //* value they desire into Parameters as long as it is the */
  4805. //* same size (in bytes) as Parameters. The intended use of */
  4806. //* Parameters is to allow the user to pass information to */
  4807. //* *ProcessItem that *ProcessItem may need. Either way, */
  4808. //* how Parameters is used is literally up to the user. */
  4809. //* */
  4810. //*********************************************************************/
  4811. void _System ForEachItem(DLIST ListToProcess,
  4812. void ( * _System ProcessItem) (ADDRESS Object, TAG ObjectTag, CARDINAL32 ObjectSize, ADDRESS ObjectHandle, ADDRESS Parameters, CARDINAL32 * Error),
  4813. ADDRESS Parameters,
  4814. BOOLEAN Forward,
  4815. CARDINAL32 * Error);
  4816. //*********************************************************************/
  4817. //* */
  4818. //* Function Name: PruneList */
  4819. //* */
  4820. //* Descriptive Name: This function allows the caller to examine */
  4821. //* each item in a list and optionally delete */
  4822. //* it from the list. */
  4823. //* */
  4824. //* Input: DLIST ListToProcess : The DLIST to be pruned. */
  4825. //* */
  4826. //* BOOLEAN ( * KillItem) (...) */
  4827. //* */
  4828. //* This is a pointer to a user provided function. */
  4829. //* This user provided function takes the following */
  4830. //* parameters: */
  4831. //* */
  4832. //* ADDRESS Object : A pointer to an item in */
  4833. //* ListToProcess. */
  4834. //* TAG Object1Tag : The user assigned TAG value for */
  4835. //* the item pointed to by Object. */
  4836. //* ADDRESS Parameter : The address of a block of */
  4837. //* memory containing any */
  4838. //* parameters that the user */
  4839. //* wishes to have passed to this*/
  4840. //* function. */
  4841. //* BOOLEAN * FreeMemory : The address of a BOOLEAN */
  4842. //* variable which this */
  4843. //* function will set to */
  4844. //* either TRUE or FALSE. */
  4845. //* If the function return */
  4846. //* value is TRUE, then the */
  4847. //* value in *FreeMemory will */
  4848. //* be examined. If it is */
  4849. //* TRUE, then PruneList will */
  4850. //* free the memory associated*/
  4851. //* with the item being */
  4852. //* deleted. If *FreeMemory */
  4853. //* is FALSE, then the item */
  4854. //* being removed from the */
  4855. //* DLIST will not be freed, */
  4856. //* and it is up to the user */
  4857. //* to ensure that this memory*/
  4858. //* is handled properly. */
  4859. //* CARDINAL32 * Error : The address of a variable to*/
  4860. //* hold the error return value.*/
  4861. //* */
  4862. //* ADDRESS Parameters : This field is passed through to */
  4863. //* *ProcessItem. This function does */
  4864. //* not even look at the contents of */
  4865. //* this field. This field is here to */
  4866. //* provide the user a way to pass */
  4867. //* additional data to *ProcessItem */
  4868. //* that *ProcessItem may need to */
  4869. //* function correctly. */
  4870. //* */
  4871. //* CARDINAL32 * Error : The address of a variable to hold */
  4872. //* the error return value. */
  4873. //* */
  4874. //* Output: If successful, this function will set *Error to */
  4875. //* DLIST_SUCCESS. */
  4876. //* If unsuccessful, then this function will set *Error to */
  4877. //* a non-zero error code. */
  4878. //* */
  4879. //* Error Handling: This function aborts immediately when an error */
  4880. //* is detected, and any remaining items in the list*/
  4881. //* will not be processed. */
  4882. //* */
  4883. //* Side Effects: None. */
  4884. //* */
  4885. //* Notes: This function allows the user to access all of the items */
  4886. //* in a list, perform an operation on them, and then */
  4887. //* optionally delete ("remove") them from the DLIST. The */
  4888. //* operation performed must not free any items in the list, */
  4889. //* or perform any list operations on the list being */
  4890. //* processed. */
  4891. //* */
  4892. //* If the KillItem function sets *Error to something other */
  4893. //* than DLIST_SUCCESS, then PruneList will terminate and */
  4894. //* return an error to whoever called it. The single */
  4895. //* exception to this is if KillItem sets *Error to */
  4896. //* DLIST_SEARCH_COMPLETE, in which case KillItem */
  4897. //* terminates and sets *Error to DLIST_SUCCESS. This is */
  4898. //* useful for using KillItem to search a list and then */
  4899. //* terminating the search once the desired item is found. */
  4900. //* */
  4901. //* A word about the Parameters parameter. This parameter */
  4902. //* is passed through to *ProcessItem and is never looked at */
  4903. //* by this function. This means that the user can put any */
  4904. //* value they desire into Parameters as long as it is the */
  4905. //* same size (in bytes) as Parameters. The intended use of */
  4906. //* Parameters is to allow the user to pass information to */
  4907. //* *ProcessItem that *ProcessItem may need. Either way, */
  4908. //* how Parameters is used is literally up to the user. */
  4909. //* */
  4910. //*********************************************************************/
  4911. void _System PruneList(DLIST ListToProcess,
  4912. BOOLEAN ( * _System KillItem) (ADDRESS Object, TAG ObjectTag, CARDINAL32 ObjectSize, ADDRESS ObjectHandle, ADDRESS Parameters, BOOLEAN * FreeMemory, CARDINAL32 * Error),
  4913. ADDRESS Parameters,
  4914. CARDINAL32 * Error);
  4915. //*********************************************************************/
  4916. //* */
  4917. //* Function Name: AppendList */
  4918. //* */
  4919. //* Descriptive Name: Removes the items in SourceList and appends */
  4920. //* them to TargetList. */
  4921. //* */
  4922. //* Input: DLIST TargetList : The DLIST which is to have the items */
  4923. //* from SourceList appended to it. */
  4924. //* DLIST SourceList : The DLIST whose items are to be */
  4925. //* removed and appended to TargetList. */
  4926. //* CARDINAL32 * Error : The address of a variable to hold */
  4927. //* the error return value. */
  4928. //* */
  4929. //* Output: If successful, *Error will be set to DLIST_SUCCESS, */
  4930. //* SourceList will be empty, and TargetList will contain*/
  4931. //* all of its original items and all of the items that */
  4932. //* were in SourceList. */
  4933. //* If unsuccessful, *Error will be set to a non-zero value */
  4934. //* and SourceList and TargetList will be unmodified. */
  4935. //* */
  4936. //* Error Handling: This function will abort immediately upon */
  4937. //* detection of an error. All errors that can be */
  4938. //* detected are detected before the contents of */
  4939. //* SourceList are appended to TargetList, so if an*/
  4940. //* error is detected and the function aborts, */
  4941. //* SourceList and TargetList are unaltered. */
  4942. //* */
  4943. //* Side Effects: None. */
  4944. //* */
  4945. //* Notes: None. */
  4946. //* */
  4947. //*********************************************************************/
  4948. void _System AppendList(DLIST TargetList,
  4949. DLIST SourceList,
  4950. CARDINAL32 * Error);
  4951. //*********************************************************************/
  4952. //* */
  4953. //* Function Name: TransferItem */
  4954. //* */
  4955. //* Descriptive Name: Removes an item in SourceList and places in */
  4956. //* TargetList. */
  4957. //* */
  4958. //* Input: DLIST SourceList : The DLIST containing the item which */
  4959. //* is to be transferred. */
  4960. //* ADDRESS SourceHandle : The handle of the item in */
  4961. //* SourceList which is to be */
  4962. //* transferred to another DLIST. */
  4963. //* If this is NULL, then the */
  4964. //* current item in SourceList will */
  4965. //* be used. */
  4966. //* DLIST TargetList : The DLIST which is to receive the */
  4967. //* item being transferred. */
  4968. //* ADDRESS TargetHandle : The item in TargetList which */
  4969. //* is used to determine where */
  4970. //* the item being transferred will */
  4971. //* be placed. If this is NULL, */
  4972. //* then the current item in */
  4973. //* TargetList will be used. */
  4974. //* Insertion_Modes TransferMode : This indicates where, */
  4975. //* relative to the item in */
  4976. //* TargetList specified by */
  4977. //* Target_Handle, the item being */
  4978. //* transferred can be placed. */
  4979. //* BOOLEAN MakeCurrent : If TRUE, the item transferred to */
  4980. //* TargetList becomes the current */
  4981. //* item in TargetList. */
  4982. //* CARDINAL32 * Error : The address of a variable to hold */
  4983. //* the error return value. */
  4984. //* */
  4985. //* Output: If successful, *Error will be set to DLIST_SUCCESS, */
  4986. //* SourceList will be empty, and TargetList will contain*/
  4987. //* all of its original items and all of the items that */
  4988. //* were in SourceList. */
  4989. //* If unsuccessful, *Error will be set to a non-zero value */
  4990. //* and SourceList and TargetList will be unmodified. */
  4991. //* */
  4992. //* Error Handling: This function will abort immediately upon */
  4993. //* detection of an error. All errors that can be */
  4994. //* detected are detected before the contents of */
  4995. //* SourceList are appended to TargetList, so if an*/
  4996. //* error is detected and the function aborts, */
  4997. //* SourceList and TargetList are unaltered. */
  4998. //* */
  4999. //* Side Effects: None. */
  5000. //* */
  5001. //* Notes: None. */
  5002. //* */
  5003. //*********************************************************************/
  5004. void _System TransferItem(DLIST SourceList,
  5005. ADDRESS SourceHandle,
  5006. DLIST TargetList,
  5007. ADDRESS TargetHandle,
  5008. Insertion_Modes TransferMode,
  5009. BOOLEAN MakeCurrent,
  5010. CARDINAL32 * Error);
  5011. //*********************************************************************/
  5012. //* */
  5013. //* Function Name: CheckListIntegrity */
  5014. //* */
  5015. //* Descriptive Name: Checks the integrity of a DLIST. All link */
  5016. //* nodes in the list are checked, as are all */
  5017. //* fields in the list control block. */
  5018. //* */
  5019. //* Input: DLIST ListToCheck - The list whose integrity is to be */
  5020. //* checked. */
  5021. //* */
  5022. //* Output: The function return value will be TRUE if all of the */
  5023. //* elements in the DLIST are correct. If this function */
  5024. //* returns FALSE, then the DLIST being checked has been */
  5025. //* corrupted! */
  5026. //* */
  5027. //* Error Handling: If this function encounters an error in a DLIST,*/
  5028. //* it will return FALSE. */
  5029. //* */
  5030. //* Side Effects: None. */
  5031. //* */
  5032. //* Notes: None. */
  5033. //* */
  5034. //*********************************************************************/
  5035. BOOLEAN _System CheckListIntegrity(DLIST ListToCheck);
  5036. {$endif}
  5037. Implementation
  5038. End.