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