source: branches/branch-1-0/include/helpers/lvm.h@ 428

Last change on this file since 428 was 41, checked in by umoeller, 24 years ago

Updated timers.

  • Property svn:eol-style set to CRLF
  • Property svn:keywords set to Author Date Id Revision
File size: 111.5 KB
Line 
1
2/*
3 *@@sourcefile lvm.h:
4 * header file for lvm.c. See remarks there.
5 *
6 *@@include #include "helpers\lvm.h"
7 */
8
9/*
10 * Copyright (C) 2000 Ulrich M”ller.
11 * This file is part of the "XWorkplace helpers" source package.
12 * This is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published
14 * by the Free Software Foundation, in version 2 as it comes in the
15 * "COPYING" file of the XWorkplace main distribution.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 */
21
22#if __cplusplus
23extern "C" {
24#endif
25
26#ifndef LVM_HEADER_INCLUDED
27 #define LVM_HEADER_INCLUDED
28
29 /* An INTEGER number is a whole number, either positive or negative.
30 The number appended to the INTEGER key word indicates the number of bits
31 used to represent an INTEGER of that type. */
32 typedef short int INTEGER16;
33 typedef long int INTEGER32;
34 typedef int INTEGER; /* Use compiler default. */
35
36 /* In accordance with its mathematical definition, a CARDINAL number is a positive integer >= 0.
37 The number appended to the CARDINAL key word indicates the number of bits
38 used to represent a CARDINAL of that type. */
39
40 typedef unsigned short int CARDINAL16;
41 typedef unsigned long CARDINAL32;
42 typedef unsigned int CARDINAL; /* Use compiler default. */
43
44 /* A BYTE is 8 bits of memory with no interpretation attached. */
45 // typedef unsigned char BYTE;
46
47 /* A BOOLEAN variable is one which is either TRUE or FALSE. */
48 typedef unsigned char BOOLEAN;
49 /* #define TRUE 1
50 #define FALSE 0; */
51
52 /* An ADDRESS variable is one which holds the address of a location in memory. */
53 // typedef void * ADDRESS;
54
55 /* pSTRING is a pointer to an array of characters. */
56 typedef char * pSTRING;
57
58 /* 4 bytes */
59 // typedef unsigned long DoubleUSHORT;
60
61 /* 2 bytes */
62 // typedef short unsigned int USHORT;
63
64 /* Define a Partition Sector Number. A Partition Sector Number is relative to the start of a partition.
65 The first sector in a partition is PSN 0. */
66 typedef unsigned long PSN;
67
68 /* Define a Logical Sector Number. A Logical Sector Number is relative to the start of a volume.
69 The first sector in a volume is LSN 0. */
70 typedef unsigned long LSN;
71
72 /* Define a Logical Block Address. A Logical Block Address is relative to the start of a
73 physical device - a disk drive. The first sector on a disk drive is LBA 0. */
74 typedef unsigned long LBA;
75
76 /* ******************************************************************
77 *
78 * Partition definitions
79 *
80 ********************************************************************/
81
82 /* The disk structure used to create and control partitions on a
83 physical disk drive is the partition table. The partition
84 table is itself embedded in two other structures: the Master
85 Boot Record (MBR) and the Extended Boot Record (EBR). There
86 is only one MBR per physical disk drive, and it is always
87 located in the first sector of the physical disk drive.
88 It contains code and a partition table. An EBR is similar
89 to an MBR except that an EBR generally does not contain code,
90 and may appear multiple times on a physical disk drive. */
91
92 /* The following definitions define the format of a partition table and the Master Boot Record (MBR). */
93 typedef struct _Partition_Record
94 {
95 BYTE Boot_Indicator; /* 80h = active partition. */
96 BYTE Starting_Head;
97 BYTE Starting_Sector; /* Bits 0-5 are the sector. Bits 6 and 7 are the high
98 order bits of the starting cylinder. */
99 BYTE Starting_Cylinder; /* The cylinder number is a 10 bit value. The high order
100 bits of the 10 bit value come from bits 6 & 7 of the
101 Starting_Sector field. */
102 BYTE Format_Indicator; /* An indicator of the format/operation system on this
103 partition. */
104 BYTE Ending_Head;
105 BYTE Ending_Sector;
106 BYTE Ending_Cylinder;
107 ULONG Sector_Offset; /* The number of sectors on the disk which are prior to
108 the start of this partition. */
109 ULONG Sector_Count; /* The number of sectors in this partition. */
110 } Partition_Record;
111
112 typedef struct _Master_Boot_Record
113 {
114 BYTE Reserved[446];
115 Partition_Record Partition_Table[4];
116 USHORT Signature; /* AA55h in this field indicates that this
117 is a valid partition table/MBR. */
118 } Master_Boot_Record;
119 typedef Master_Boot_Record Extended_Boot_Record;
120
121 /* The following is the signature used for a Master Boot Record, an Extended Boot Record, and a Boot Sector. */
122 #define MBR_EBR_SIGNATURE 0xAA55
123
124 /* The following list of definitions defines the values of interest for the Format_Indicator in a Partition_Record. */
125 #define EBR_INDICATOR 0x5
126 #define UNUSED_INDICATOR 0x0
127 #define IFS_INDICATOR 0x7
128 #define FAT12_INDICATOR 0x1
129 #define FAT16_SMALL_PARTITION_INDICATOR 0x4
130 #define FAT16_LARGE_PARTITION_INDICATOR 0x6
131 #define BOOT_MANAGER_HIDDEN_PARTITION_FLAG 0x10
132 #define LVM_PARTITION_INDICATOR 0x35
133 #define BOOT_MANAGER_INDICATOR 0x0A
134
135 /* ******************************************************************
136 *
137 * Drive Letter Assignment Table (DLAT)
138 *
139 ********************************************************************/
140
141 /* In addition to the standard structures for controlling the
142 partitioning of a physical disk drive, LVM introduces a new
143 structure: the Drive Letter Assignment Table, or DLAT for short.
144 The DLAT is used to associate drive letters with volumes, associate
145 names with volumes, partitions, and physical disk drives, indicate
146 which volumes and partitions are on the Boot Manager Menu, and to
147 hold the information required to turn a partition into a compatibility
148 volume.
149
150 Volumes come in two types: Compatibility and LVM. Compatibility
151 volumes are comprised of a single partition, and are usable by older
152 versions of OS/2 as well as other operating systems. LVM volumes
153 are not compatible with other operating systems or older versions
154 of OS/2. However, since they do not have to be compatible, they
155 can support extra features that compatibility volumes can not,
156 such as drive linking and bad block relocation. The data required
157 to implement the various features found on LVM volumes is stored
158 within the partitions that comprise the volume. However, this trick
159 can not be employed for compatibility volumes so the data required
160 for the features found on compatibility volumes must be stored
161 elsewhere: the DLAT.
162
163 DLAT tables are fixed in size, and there is one DLAT for each MBR
164 or EBR on a physical disk drive. The DLAT table resides in an area
165 of the disk which is not currently used due to the rules that govern
166 the creation of partitions. Currently, in the DOS/Windows/OS/2
167 world, partitions must start on track boundaries. Extended partitions
168 must start on cylinder boundaries. Since an MBR or EBR occupy one
169 sector and must always be the first sector of a track, the remaining
170 sectors on a track containing an MBR or EBR are unused. The DLAT
171 table for an MBR/EBR is stored in one of these unused sectors,
172 specifically, the last sector on the track. Thus, for any MBR/EBR,
173 the MBR/EBR will be the first sector of a track and its corresponding
174 DLAT table will be the last sector of the same track. */
175
176 /* The following definitions define the drive letter assignment table
177 used by LVM.
178 For each partition table on the disk, there will be a drive letter
179 assignment table in the last sector of the track containing the partition
180 table. */
181
182 /* NOTE: DLA stands for Drive Letter Assignment. */
183
184 /* Define the signature values to be used for a DLA Table. */
185 #define DLA_TABLE_SIGNATURE1 0x424D5202L
186 #define DLA_TABLE_SIGNATURE2 0x44464D50L
187
188 /* Define the size of a Partition Name.
189 Partition Names are user defined names given to a partition. */
190 #define PARTITION_NAME_SIZE 20
191
192 /* Define the size of a volume name. Volume Names are user defined
193 names given to a volume. */
194 #define VOLUME_NAME_SIZE 20
195
196 /* Define the size of a disk name. Disk Names are user defined names
197 given to physical disk drives in the system. */
198 #define DISK_NAME_SIZE 20
199
200 /* Define the structure of an entry in a DLAT. */
201 typedef struct _DLA_Entry
202 {
203 ULONG Volume_Serial_Number; /* The serial number of the volume
204 that this partition belongs to. */
205 ULONG Partition_Serial_Number; /* The serial number of this partition. */
206 ULONG Partition_Size; /* The size of the partition, in sectors. */
207 LBA Partition_Start; /* The starting sector of the partition. */
208 BOOLEAN On_Boot_Manager_Menu; /* Set to TRUE if this volume/partition
209 is on the Boot Manager Menu. */
210 BOOLEAN Installable; /* Set to TRUE if this volume is the one
211 to install the operating system on. */
212 char Drive_Letter; /* The drive letter assigned to the
213 volume, or 0h if the volume is hidden. */
214 BYTE Reserved;
215 char Volume_Name[VOLUME_NAME_SIZE]; /* The name assigned to the volume by
216 the user. */
217 char Partition_Name[PARTITION_NAME_SIZE]; /* The name assigned to the partition. */
218 } DLA_Entry;
219
220 /* Define the contents of the sector used to hold a DLAT. */
221 typedef struct _DLA_Table_Sector
222 {
223 ULONG DLA_Signature1; /* The magic signature (part 1) of a
224 Drive Letter Assignment Table. */
225 ULONG DLA_Signature2; /* The magic signature (part 2) of a
226 Drive Letter Assignment Table. */
227 ULONG DLA_CRC; /* The 32 bit CRC for this sector.
228 Calculated assuming that this
229 field and all unused space in
230 the sector is 0. */
231 ULONG Disk_Serial_Number; /* The serial number assigned to
232 this disk. */
233 ULONG Boot_Disk_Serial_Number; /* The serial number of the disk used to
234 boot the system. This is for conflict
235 resolution when multiple volumes want
236 the same drive letter. Since LVM.EXE
237 will not let this situation happen, the
238 only way to get this situation is for the
239 disk to have been altered by something other
240 than LVM.EXE, or if a disk drive has been
241 moved from one machine to another. If the
242 drive has been moved, then it should have a
243 different Boot_Disk_Serial_Number. Thus,
244 we can tell which disk drive is the "foreign"
245 drive and therefore reject its claim for the
246 drive letter in question. If we find that
247 all of the claimaints have the same
248 Boot_Disk_Serial_Number, then we must assign
249 drive letters on a first come, first serve
250 basis. */
251 CARDINAL32 Install_Flags; /* Used by the Install program. */
252 CARDINAL32 Cylinders; /* Used by OS2DASD.DMD */
253 CARDINAL32 Heads_Per_Cylinder; /* Used by OS2DASD.DMD */
254 CARDINAL32 Sectors_Per_Track; /* Used by OS2DASD.DMD */
255 char Disk_Name[DISK_NAME_SIZE]; /* The name assigned to the disk containing
256 this sector. */
257 BOOLEAN Reboot; /* For use by Install. Used to keep track of
258 reboots initiated by install. */
259 BYTE Reserved[3]; /* Alignment. */
260 DLA_Entry DLA_Array[4]; /* These are the four entries which correspond
261 to the entries in the partition table. */
262 } DLA_Table_Sector;
263
264 /* ******************************************************************
265 *
266 * LVM Volume Signature Sectors
267 *
268 ********************************************************************/
269
270 /* As mentioned earlier, LVM Volumes have extra features that Compatibility
271 Volumes do not. The data required to implement these features is stored
272 inside of the partitions that comprise the LVM Volume. Specifically,
273 the last sector of each partition that is part of an LVM Volume contains
274 an LVM Signature Sector. The LVM Signature Sector indicates which features
275 are active on the volume that the partition is a part of, and where on the
276 partition the data for those features may be found. It also contains a
277 duplicate copy of the DLAT information for the partition. The following
278 definitions are used by LVM.DLL for the LVM Signature Sector: */
279
280 /* The following definitions define the LVM signature sector which will appear
281 as the last sector in an LVM partition. */
282
283 #define LVM_PRIMARY_SIGNATURE 0x4A435332L
284 #define LVM_SECONDARY_SIGNATURE 0x4252444BL
285
286 #define CURRENT_LVM_MAJOR_VERSION_NUMBER 1 /* Define as appropriate. */
287 #define CURRENT_LVM_MINOR_VERSION_NUMBER 0 /* Define as appropriate. */
288
289 /* The following definitions limit the number of LVM features that
290 can be applied to a volume, as well as defining a "NULL"
291 feature for use in feature table entries that are not being used. */
292 #define MAX_FEATURES_PER_VOLUME 10 /* The maximum number of LVM features that can be applied to a volume. */
293 #define NULL_FEATURE 0 /* No feature. Used in all unused entries of the feature array in the LVM Signature
294 sector. */
295
296 /* The following structure is used to hold the location of the feature
297 specific data for LVM features. */
298 typedef struct _LVM_Feature_Data
299 {
300 ULONG Feature_ID; /* The ID of the feature. */
301 PSN Location_Of_Primary_Feature_Data; /* The PSN of the starting sector of
302 the private data for this feature.*/
303 PSN Location_Of_Secondary_Feature_Data; /* The PSN of the starting sector of
304 the backup copy of the private
305 data for this feature. */
306 ULONG Feature_Data_Size; /* The number of sectors used by this
307 feature for its private data. */
308 USHORT Feature_Major_Version_Number; /* The integer portion of the version
309 number of this feature. */
310 USHORT Feature_Minor_Version_Number; /* The decimal portion of the version
311 number of this feature. */
312 BOOLEAN Feature_Active; /* TRUE if this feature is active on
313 this partition/volume, FALSE
314 otherwise. */
315 BYTE Reserved[3]; /* Alignment. */
316 } LVM_Feature_Data;
317
318
319 /* The following structure defines the LVM Signature Sector. This is the
320 last sector of every partition which is part of an LVM volume. It gives
321 vital information about the version of LVM used to create the LVM volume
322 that it is a part of, as well as which LVM features (BBR, drive linking,
323 etc.) are active on the volume that this partition is a part of. */
324#if 0
325 typedef struct _LVM_Signature_Sector
326 {
327 ULONG LVM_Signature1; /* The first part of the
328 magic LVM signature. */
329 ULONG LVM_Signature2; /* The second part of
330 the magic LVM
331 signature. */
332 ULONG Signature_Sector_CRC; /* 32 bit CRC for this
333 sector. Calculated
334 using 0 for this
335 field. */
336 ULONG Partition_Serial_Number; /* The LVM assigned
337 serial number for this
338 partition. */
339 LBA Partition_Start; /* LBA of the first
340 sector of this
341 partition. */
342 LBA Partition_End; /* LBA of the last sector
343 of this partition. */
344 ULONG Partition_Sector_Count; /* The number of sectors
345 in this partition. */
346 ULONG LVM_Reserved_Sector_Count; /* The number of sectors
347 reserved for use by
348 LVM. */
349 ULONG Partition_Size_To_Report_To_User; /* The size of the
350 partition as the user
351 sees it - i.e. (the
352 actual size of the
353 partition - LVM
354 reserved sectors)
355 rounded to a track
356 boundary. */
357 ULONG Boot_Disk_Serial_Number; /* The serial number of
358 the boot disk for the
359 system. If the system
360 contains Boot Manager,
361 then this is the
362 serial number of the
363 disk containing the
364 active copy of Boot
365 Manager. */
366 ULONG Volume_Serial_Number; /* The serial number of
367 the volume that this
368 partition belongs to.*/
369 CARDINAL32 Fake_EBR_Location; /* The location, on disk,
370 of a Fake EBR, if one
371 has been allocated. */
372 USHORT LVM_Major_Version_Number; /* Major version number
373 of the LVM that
374 created this
375 partition. */
376 USHORT LVM_Minor_Version_Number; /* Minor version number
377 of the LVM that
378 created this
379 partition. */
380 char Partition_Name[PARTITION_NAME_SIZE]; /* User defined partition
381 name. */
382 char Volume_Name[VOLUME_NAME_SIZE]; /* The name of the volume
383 that this partition
384 belongs to. */
385 LVM_Feature_Data LVM_Feature_Array[MAX_FEATURES_PER_VOLUME]; /* The feature array.
386 This indicates which
387 LVM features, if any,
388 are active on this
389 volume and what order
390 they should be applied
391 in. */
392 char Drive_Letter; /* The drive letter
393 assigned to the volume
394 that this partition is
395 part of. */
396 BOOLEAN Fake_EBR_Allocated; /* If TRUE, then a fake
397 EBR has been
398 allocated. */
399 char Comment[COMMENT_SIZE]; /* User comment. */
400 /* The remainder of the sector is reserved for future use and should be all zero or
401 else the CRC will not come out correctly. */
402 } LVM_Signature_Sector;
403#endif
404
405 /* ******************************************************************
406 *
407 * Boot Manager
408 *
409 ********************************************************************/
410
411 /* In addition to dealing with partitions and volumes, LVM.DLL must also
412 deal with Boot Manager. Boot Manager has several data areas which must
413 be modified by LVM.DLL when LVM.DLL installs Boot Manager, or when it
414 upgrades an existing Boot Manager installation. The structures which
415 define these areas are listed below: */
416
417 /* Structure used to hold the values for INT13 calls to access the disk. */
418 typedef struct _INT13_Record
419 {
420 unsigned short AX; /* AH = 02, always. AL = number of sectors to read. */
421 unsigned short CX; /* CH = top 8 bits of cylinder number. CL bits 0 - 5 = sector number,
422 bits 6 and 7 are high order bits of cylinder number. */
423 unsigned short DX; /* DH = head number. DL = drive number. Note: Bit 7 must always be set.*/
424 } INT13_Record;
425
426 #define INT13_TABLE_SIZE 11
427
428 /* Boot Manager Boot Structure. */
429 typedef struct _Boot_Manager_Boot_Record
430 {
431 unsigned char Boot_jmp[3];
432 unsigned char Boot_OEM[8];
433 struct Extended_BPB Boot_BPB;
434 unsigned char Boot_DriveNumber;
435 unsigned char Boot_CurrentHead;
436 unsigned char Boot_Sig; /* 41 indicates extended boot */
437 unsigned char Boot_Serial[4];
438 unsigned char Boot_Vol_Label[11];
439 unsigned char Boot_System_ID[8];
440 unsigned long Reserved1; /* _SectorBase */
441 unsigned short Reserved2; /* CurrentTrack */
442 unsigned char Reserved3; /* CurrentSector */
443 unsigned short Reserved4; /* SectorCount */
444 unsigned long Reserved5; /* lsnSaveChild */
445 unsigned char BootPathDrive;
446 unsigned char BootPathHead;
447 unsigned char BootPathSector; /* Bits 0 - 5 are sector,
448 bits 6 and 7 are high order
449 bits of Cylinder. */
450 unsigned char BootPathCylinder; /* Lower 8 bits of cylinder. */
451 INT13_Record INT13_Table[INT13_TABLE_SIZE];
452 } Boot_Manager_Boot_Record;
453
454 #define BOOT_MANAGER_PATH_SECTOR_OFFSET 1
455
456 /* Boot Manager Alias entry. */
457 #define ALIAS_NAME_LENGTH 8
458 typedef struct _Alias_Entry
459 {
460 unsigned char Reserved[4];
461 unsigned char Name[ALIAS_NAME_LENGTH];
462 } Alias_Entry;
463
464 /* The next structure defines the Boot Manager BootPath record. */
465 #define MAX_ALIAS_ENTRIES 6
466 typedef struct _Boot_Path_Record
467 {
468 unsigned char Drive;
469 unsigned char Head;
470 unsigned char Sector;
471 unsigned char Cylinder;
472 unsigned short Migration_Flag; /* ??? */
473 unsigned short TimeOut; /* Time out value in 1/18 of a second increments. */
474 unsigned char Boot_Index;
475 unsigned char Advanced_Mode; /* If 0, then Boot Manager operates in Normal Mode.
476 If 1, then Boot Manager operates in advanced mode. */
477 unsigned char Immediate_Boot_Drive_Letter;
478 unsigned char Reboot_Flag;
479 unsigned char Reserved[4];
480 Alias_Entry Alias_Array[MAX_ALIAS_ENTRIES];
481 } Boot_Path_Record;
482
483 #define DEFAULT_ALIAS_ENTRY 0
484 #define LAST_ALIAS_BOOTED 5
485 #define IMMEDIATE_BOOT_ALIAS 4
486
487 /* Boot Manager Alias Table Information.
488 The Alias Table is a two dimensional array of structures.
489 The array is 24 by 4, and is composed of Alias_Table_Entry structures.
490 It is used to hold the Boot Manager name of any primary
491 partitions residing on the first 24 drives in the system. */
492
493 #define ALIAS_TABLE_SECTOR_OFFSET 3
494 #define SECTORS_PER_ALIAS_TABLE 3
495 #define ALIAS_TABLE_DRIVE_LIMIT 24
496 #define ALIAS_TABLE_PARTITION_LIMIT 4
497
498 /* The following structure is used in the creation of the
499 Boot Manager Alias Table. */
500 typedef struct _Alias_Table_Entry
501 {
502 unsigned char Drive; /* BIOS Drive ID of the partition this entry
503 represents. */
504
505 /* Head, Sector, and Cylinder are the CHS address of the partition this entry represents. */
506
507 unsigned char Head;
508 unsigned char Sector;
509 unsigned char Cylinder;
510
511 unsigned char Bootable; /* ?? Assumed to be 0 if not bootable. */
512 char Name[ALIAS_NAME_LENGTH]; /* Boot Manager name for the partition represented
513 by this entry. */
514
515 /* Padding. */
516 unsigned char Reserved[3];
517 } Alias_Table_Entry;
518
519 /* ******************************************************************
520 *
521 * LVM API declarations
522 *
523 ********************************************************************/
524
525 /* The following are invariant for a disk drive. */
526 typedef struct _Drive_Control_Record
527 {
528 CARDINAL32 Drive_Number; /* OS/2 Drive Number for this drive. */
529 CARDINAL32 Drive_Size; /* The total number of sectors on the drive. */
530 ULONG Drive_Serial_Number; /* The serial number assigned to this drive.
531 For info. purposes only. */
532 PVOID Drive_Handle; /* Handle used for operations on the disk that
533 this record corresponds to. */
534 CARDINAL32 Cylinder_Count; /* The number of cylinders on the drive. */
535 CARDINAL32 Heads_Per_Cylinder; /* The number of heads per cylinder for this drive. */
536 CARDINAL32 Sectors_Per_Track; /* The number of sectors per track for this drive. */
537 BOOLEAN Drive_Is_PRM; /* Set to TRUE if this drive is a PRM. */
538 BYTE Reserved[3]; /* Alignment. */
539 } Drive_Control_Record;
540
541 /* The following structure is returned by the Get_Drive_Control_Data function. */
542 typedef struct _Drive_Control_Array
543 {
544 Drive_Control_Record * Drive_Control_Data; /* An array of drive control records. */
545 CARDINAL32 Count; /* The number of entries in the array
546 of drive control records. */
547 } Drive_Control_Array;
548
549
550 /* The following structure defines the information that can be changed for a specific disk drive. */
551 typedef struct _Drive_Information_Record
552 {
553 CARDINAL32 Total_Available_Sectors; /* The number of sectors on the disk
554 which are not currently assigned to
555 a partition. */
556 CARDINAL32 Largest_Free_Block_Of_Sectors; /* The number of sectors in the largest
557 contiguous block of available sectors. */
558 BOOLEAN Corrupt_Partition_Table; /* If TRUE, then the partitioning
559 information found on the drive is
560 incorrect! */
561 BOOLEAN Unusable; /* If TRUE, the drive's MBR is not
562 accessible and the drive can not be
563 partitioned. */
564 BOOLEAN IO_Error; /* If TRUE, then the last I/O operation
565 on this drive failed! */
566 BYTE Reserved;
567 char Drive_Name[DISK_NAME_SIZE]; /* User assigned name for this disk
568 drive. */
569 } Drive_Information_Record;
570
571 typedef struct _Partition_Information_Record
572 {
573 PVOID Partition_Handle; /* The handle used to perform
574 operations on this partition. */
575 PVOID Volume_Handle; /* If this partition is part
576 of a volume, this will be the
577 handle of the volume. If
578 this partition is NOT
579 part of a volume, then
580 this handle will be 0. */
581 PVOID Drive_Handle; /* The handle for the drive
582 this partition resides on. */
583 ULONG Partition_Serial_Number; /* The serial number assigned
584 to this partition. */
585 CARDINAL32 Partition_Start; /* The LBA of the first
586 sector of the partition. */
587 CARDINAL32 True_Partition_Size; /* The total number of
588 sectors comprising the partition. */
589 CARDINAL32 Usable_Partition_Size; /* The size of the partition
590 as reported to the IFSM. This is the
591 size of the partition less
592 any LVM overhead. */
593 CARDINAL32 Boot_Limit; /* The maximum number of
594 sectors from this block
595 of free space that can be
596 used to create a bootable
597 partition if you allocate
598 from the beginning of the block
599 of free space. */
600 BOOLEAN Spanned_Volume; /* TRUE if this partition is
601 part of a multi-partition
602 volume. */
603 BOOLEAN Primary_Partition; /* True or False. Any
604 non-zero value here indicates
605 that this partition is
606 a primary partition. Zero
607 here indicates that this
608 partition is a "logical drive"
609 - i.e. it resides inside of
610 an extended partition. */
611 BYTE Active_Flag; /* 80 = Partition is marked
612 as being active.
613 0 = Partition is not
614 active. */
615 BYTE OS_Flag; /* This field is from the
616 partition table. It is
617 known as the OS flag, the
618 Partition Type Field,
619 Filesystem Type, and
620 various other names.
621
622 Values of interest
623
624 If this field is: (values
625 are in hex)
626
627 07 = The partition is a
628 compatibility
629 partition formatted
630 for use with an
631 installable
632 filesystem, such as
633 HPFS or JFS.
634 00 = Unformatted partition
635 01 = FAT12 filesystem is
636 in use on this
637 partition.
638 04 = FAT16 filesystem is
639 in use on this
640 partition.
641 0A = OS/2 Boot Manager
642 Partition
643 35 = LVM partition
644 06 = OS/2 FAT16 partition */
645 BYTE Partition_Type; /* 0 = Free Space
646 1 = LVM Partition (Part of
647 an LVM Volume.)
648 2 = Compatibility Partition
649 All other values are reserved
650 for future use. */
651 BYTE Partition_Status; /* 0 = Free Space
652 1 = In Use - i.e. already
653 assigned to a volume.
654 2 = Available - i.e. not
655 currently assigned
656 to a volume. */
657 BOOLEAN On_Boot_Manager_Menu; /* Set to TRUE if this
658 partition is not part of
659 a Volume yet is on the
660 Boot Manager Menu. */
661 BYTE Reserved; /* Alignment. */
662 char Volume_Drive_Letter; /* The drive letter assigned
663 to the volume that this
664 partition is a part of. */
665 char Drive_Name[DISK_NAME_SIZE]; /* User assigned name for
666 this disk drive. */
667 char File_System_Name[FILESYSTEM_NAME_SIZE];/* The name of the filesystem
668 in use on this partition,
669 if it is known. */
670 char Partition_Name[PARTITION_NAME_SIZE]; /* The user assigned name for
671 this partition. */
672 char Volume_Name[VOLUME_NAME_SIZE]; /* If this partition is part
673 of a volume, then this
674 will be the name of the
675 volume that this partition
676 is a part of. If this record
677 represents free space,
678 then the Volume_Name will be
679 "FS xx", where xx is a unique
680 numeric ID generated by
681 LVM.DLL. Otherwise it
682 will be an empty string. */
683 } Partition_Information_Record;
684
685 /* The following defines are for use with the Partition_Type field in the Partition_Information_Record. */
686 #define FREE_SPACE_PARTITION 0
687 #define LVM_PARTITION 1
688 #define COMPATIBILITY_PARTITION 2
689
690 /* The following defines are for use with the Partition_Status field in the Partition_Information_Record. */
691 #define PARTITION_IS_IN_USE 1
692 #define PARTITION_IS_AVAILABLE 2
693 #define PARTITION_IS_FREE_SPACE 0
694
695
696 /* The following structure is returned by various functions in the LVM Engine. */
697 typedef struct _Partition_Information_Array
698 {
699 Partition_Information_Record * Partition_Array; /* An array of Partition_Information_Records. */
700 CARDINAL32 Count; /* The number of entries in the Partition_Array. */
701 } Partition_Information_Array;
702
703 /* The following items are invariant for a volume. */
704 typedef struct _Volume_Control_Record
705 {
706 ULONG Volume_Serial_Number; /* The serial number assigned to this volume. */
707 PVOID Volume_Handle; /* The handle used to perform operations on this volume. */
708 BOOLEAN Compatibility_Volume; /* TRUE indicates that this volume is compatible with older versions of OS/2.
709 FALSE indicates that this is an LVM specific volume and can not be used without OS2LVM.DMD. */
710 BOOLEAN On_PRM; /* Set to TRUE if this volume resides on a PRM. Set to FALSE otherwise. */
711 BYTE Reserved[2]; /* Alignment. */
712 } Volume_Control_Record;
713
714 /* The following structure is returned by the Get_Volume_Control_Data function. */
715 typedef struct _Volume_Control_Array
716 {
717 Volume_Control_Record * Volume_Control_Data; /* An array of volume control records. */
718 CARDINAL32 Count; /* The number of entries in the array of volume control records. */
719 } Volume_Control_Array;
720
721 /* The following information about a volume can (and often does) vary. */
722 typedef struct _Volume_Information_Record
723 {
724 CARDINAL32 Volume_Size; /* The number of sectors comprising the volume. */
725 CARDINAL32 Partition_Count; /* The number of partitions which comprise this volume. */
726 CARDINAL32 Drive_Letter_Conflict; /* 0 indicates that the drive letter preference for this volume is unique.
727 1 indicates that the drive letter preference for this volume
728 is not unique, but this volume got its preferred drive letter anyway.
729 2 indicates that the drive letter preference for this volume
730 is not unique, and this volume did NOT get its preferred drive letter.
731 4 indicates that this volume is currently "hidden" - i.e. it has
732 no drive letter preference at the current time. */
733 BOOLEAN Compatibility_Volume; /* TRUE if this is for a compatibility volume, FALSE otherwise. */
734 BOOLEAN Bootable; /* Set to TRUE if this volume appears on the Boot Manager menu, or if it is
735 a compatibility volume and its corresponding partition is the first active
736 primary partition on the first drive. */
737 char Drive_Letter_Preference; /* The drive letter that this volume desires to be. */
738 BYTE Status; /* 0 = None.
739 1 = Bootable
740 2 = Startable
741 3 = Installable. */
742 char Volume_Name[VOLUME_NAME_SIZE]; /* The user assigned name for this volume. */
743 char File_System_Name[FILESYSTEM_NAME_SIZE];/* The name of the filesystem in use on this partition, if it is known. */
744 } Volume_Information_Record;
745
746 /* The following structure defines an item on the Boot Manager Menu. */
747 typedef struct _Boot_Manager_Menu_Item
748 {
749 PVOID Handle; /* A Volume or Partition handle. */
750 BOOLEAN Volume; /* If TRUE, then Handle is the handle of a Volume. Otherwise, Handle is the handle of a partition. */
751 } Boot_Manager_Menu_Item;
752
753 /* The following structure is used to get a list of the items on the
754 partition manager menu. */
755 typedef struct _Boot_Manager_Menu
756 {
757 Boot_Manager_Menu_Item * Menu_Items;
758 CARDINAL32 Count;
759 } Boot_Manager_Menu;
760
761 /* The following preprocessor directives define the operations that
762 can be performed on a partition, volume, or a block of free space.
763 These definitions represent bits in a 32 bit value returned by the
764 Get_Valid_Options function. */
765
766 #define CREATE_PRIMARY_PARTITION 1
767 #define CREATE_LOGICAL_DRIVE 2
768 #define DELETE_PARTITION 4
769 #define SET_ACTIVE_PRIMARY 8
770 #define SET_PARTITION_ACTIVE 0x10
771 #define SET_PARTITION_INACTIVE 0x20
772 #define SET_STARTABLE 0x40
773 #define INSTALL_BOOT_MANAGER 0x80
774 #define REMOVE_BOOT_MANAGER 0x100
775 #define SET_BOOT_MANAGER_DEFAULTS 0x200
776 #define ADD_TO_BOOT_MANAGER_MENU 0x400
777 #define REMOVE_FROM_BOOT_MANAGER_MENU 0x800
778 #define DELETE_VOLUME 0x1000
779 #define HIDE_VOLUME 0x2000
780 #define EXPAND_VOLUME 0x4000
781 #define SET_VOLUME_INSTALLABLE 0x8000
782 #define ASSIGN_DRIVE_LETTER 0x10000
783 #define CAN_BOOT_PRIMARY 0x20000 /* If a primary is created from this block of free space, then it can be made bootable. */
784 #define CAN_BOOT_LOGICAL 0x40000 /* 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. */
785 #define CAN_SET_NAME 0x80000
786
787 /* The following enumeration defines the allocation strategies used
788 by the Create_Partition function. */
789 typedef enum _Allocation_Algorithm
790 {
791 Automatic, /* Let LVM decide which block of free space to use to create the partition. */
792 Best_Fit, /* Use the block of free space which is closest in size to the partition being created. */
793 First_Fit, /* Use the first block of free space on the disk which is large enough to hold a partition of the specified size. */
794 Last_Fit, /* Use the last block of free space on the disk which is large enough to hold a partition of the specified size. */
795 From_Largest, /* Find the largest block of free space and allocate the partition from that block of free space. */
796 From_Smallest, /* Find the smallest block of free space that can accommodate a partition of the size specified. */
797 All /* Turn the specified drive or block of free space into a single partition. */
798 } Allocation_Algorithm;
799
800 /* Error codes returned by the LVM Engine. */
801 #define LVM_ENGINE_NO_ERROR 0
802 #define LVM_ENGINE_OUT_OF_MEMORY 1
803 #define LVM_ENGINE_IO_ERROR 2
804 #define LVM_ENGINE_BAD_HANDLE 3
805 #define LVM_ENGINE_INTERNAL_ERROR 4
806 #define LVM_ENGINE_ALREADY_OPEN 5
807 #define LVM_ENGINE_NOT_OPEN 6
808 #define LVM_ENGINE_NAME_TOO_BIG 7
809 #define LVM_ENGINE_OPERATION_NOT_ALLOWED 8
810 #define LVM_ENGINE_DRIVE_OPEN_FAILURE 9
811 #define LVM_ENGINE_BAD_PARTITION 10
812 #define LVM_ENGINE_CAN_NOT_MAKE_PRIMARY_PARTITION 11
813 #define LVM_ENGINE_TOO_MANY_PRIMARY_PARTITIONS 12
814 #define LVM_ENGINE_CAN_NOT_MAKE_LOGICAL_DRIVE 13
815 #define LVM_ENGINE_REQUESTED_SIZE_TOO_BIG 14
816 #define LVM_ENGINE_1024_CYLINDER_LIMIT 15
817 #define LVM_ENGINE_PARTITION_ALIGNMENT_ERROR 16
818 #define LVM_ENGINE_REQUESTED_SIZE_TOO_SMALL 17
819 #define LVM_ENGINE_NOT_ENOUGH_FREE_SPACE 18
820 #define LVM_ENGINE_BAD_ALLOCATION_ALGORITHM 19
821 #define LVM_ENGINE_DUPLICATE_NAME 20
822 #define LVM_ENGINE_BAD_NAME 21
823 #define LVM_ENGINE_BAD_DRIVE_LETTER_PREFERENCE 22
824 #define LVM_ENGINE_NO_DRIVES_FOUND 23
825 #define LVM_ENGINE_WRONG_VOLUME_TYPE 24
826 #define LVM_ENGINE_VOLUME_TOO_SMALL 25
827 #define LVM_ENGINE_BOOT_MANAGER_ALREADY_INSTALLED 26
828 #define LVM_ENGINE_BOOT_MANAGER_NOT_FOUND 27
829 #define LVM_ENGINE_INVALID_PARAMETER 28
830 #define LVM_ENGINE_BAD_FEATURE_SET 29
831 #define LVM_ENGINE_TOO_MANY_PARTITIONS_SPECIFIED 30
832 #define LVM_ENGINE_LVM_PARTITIONS_NOT_BOOTABLE 31
833 #define LVM_ENGINE_PARTITION_ALREADY_IN_USE 32
834 #define LVM_ENGINE_SELECTED_PARTITION_NOT_BOOTABLE 33
835 #define LVM_ENGINE_VOLUME_NOT_FOUND 34
836 #define LVM_ENGINE_DRIVE_NOT_FOUND 35
837 #define LVM_ENGINE_PARTITION_NOT_FOUND 36
838 #define LVM_ENGINE_TOO_MANY_FEATURES_ACTIVE 37
839 #define LVM_ENGINE_PARTITION_TOO_SMALL 38
840 #define LVM_ENGINE_MAX_PARTITIONS_ALREADY_IN_USE 39
841 #define LVM_ENGINE_IO_REQUEST_OUT_OF_RANGE 40
842 #define LVM_ENGINE_SPECIFIED_PARTITION_NOT_STARTABLE 41
843 #define LVM_ENGINE_SELECTED_VOLUME_NOT_STARTABLE 42
844 #define LVM_ENGINE_EXTENDFS_FAILED 43
845 #define LVM_ENGINE_REBOOT_REQUIRED 44
846
847 /* ******************************************************************
848 *
849 * LVM API prototypes
850 *
851 ********************************************************************/
852
853 /* LVM.DLL exports both 16 bit and 32 bit functions.
854 The 16 bit functions are just wrappers for the 32 bit functions.
855 Their purpose is to provide 16 bit entry points for 16 bit components
856 using LVM.DLL (such as Base Install).
857 They basically thunk their input arguments and then call the
858 corresponding 32 bit function. The following 32 bit functions are
859 defined by LVM.DLL for use by other components: */
860
861 /* ******************************************************************
862 *
863 * Functions relating to the LVM Engine itself
864 *
865 ********************************************************************/
866
867 /*
868 *@@ Open_LVM_Engine:
869 * opens the LVM Engine and readies it for use.
870 *
871 * Input:
872 * -- BOOLEAN Ignore_CHS:
873 * If TRUE, then the LVM engine will not check the CHS values in the
874 * MBR/EBR partition tables for validity. This is useful if there
875 * are drive geometry problems, such as the drive was partitioned and
876 * formatted with one geometry and then moved to a different machine
877 * which uses a different geometry for the drive. This would cause
878 * the starting and ending CHS values in the partition tables to
879 * be inconsistent with the size and partition offset entries in the
880 * partition tables. Setting Ignore_CHS to TRUE will disable the
881 * LVM Engine's CHS consistency checks, thereby allowing the drive
882 * to be partitioned.
883 * -- CARDINAL32 * Error_Code:
884 * The address of a CARDINAL32 in which to store an error code,
885 * should an error occur.
886 *
887 * Error Handling:
888 *
889 * If this function aborts with an error, all memory allocated during the course
890 * of this function will be released. Disk read errors will be reported to the
891 * user via pop-up error messages. Disk read errors will only cause this
892 * function to abort if none of the disk drives in the system could be
893 * successfully read.
894 *
895 * Side Effects:
896 *
897 * The LVM Engine will be initialized. The partition tables for all OS2DASD
898 * controlled disk drives will be read into memory. Memory will be allocated for
899 * the data structures used by the LVM Engine.
900 */
901
902 void _System Open_LVM_Engine(BOOLEAN Ignore_CHS,
903 CARDINAL32* Error_Code);
904
905 /*
906 *@@ Commit_Changes:
907 * saves any changes made to the partitioning information
908 * of the OS2DASD controlled disk drives in the system.
909 *
910 * Output:
911 *
912 * The function return value will be TRUE if all of the
913 * partitioning/volume changes made were successfully
914 * written to disk. Also, *Error_Code will be 0 if no
915 * errors occur.
916 *
917 * If an error occurs, then the furnction return value
918 * will be FALSE and *Error_Code will contain a non-zero
919 * error code.
920 *
921 * Error Handling:
922 *
923 * If an error occurs, the function return value
924 * will be false and *Error_Code will be > 0.
925 *
926 * Disk read and write errors will be indicated by setting
927 * the IO_Error field of the Drive_Information_Record to TRUE.
928 * Thus, if the function return value is FALSE, and *Error_Code
929 * indicates an I/O error, the caller of this function should
930 * call the Get_Drive_Status function on each drive to determine
931 * which drives had I/O errors.
932 *
933 * If a read or write error occurs, then the engine may not
934 * have been able to create a partition or volume. Thus,
935 * the caller may want to refresh all partition and volume
936 * data to see what the engine was and was not able to create.
937 *
938 * Side Effects:
939 *
940 * The partitioning information of the disk drives in the system
941 * may be altered.
942 */
943
944 BOOLEAN _System Commit_Changes(CARDINAL32* Error_Code);
945
946
947 /*
948 *@@ Close_LVM_Engine:
949 * closes the LVM Engine and frees any memory held by the
950 * LVM Engine.
951 */
952
953 void _System Close_LVM_Engine ( void );
954
955
956 /* ******************************************************************
957 *
958 * Functions relating to Drives
959 *
960 ********************************************************************/
961
962 /*
963 *@@ Get_Drive_Control_Data:
964 * This function returns an array of Drive_Control_Records.
965 * These records provide important information about the
966 * drives in the system and provide the handles required to
967 * access them.
968 *
969 * Output:
970 *
971 * A Drive_Control_Array structure is returned. If no
972 * errors occur, Drive_Control_Data will be non-NULL,
973 * Count will be greater than zero, and *Error_Code will
974 * be 0.
975 *
976 * Error Handling:
977 *
978 * If an error occurs, the Drive_Control_Array returned
979 * by this function will have NULL for Drive_Control_Data,
980 * and 0 for Count. *Error_Code will be greater than 0.
981 *
982 * Notes:
983 *
984 * The caller becomes responsible for the memory allocated
985 * for the array of Drive_Control_Records pointed to by
986 * Drive_Control_Data pointer in the Drive_Control_Array
987 * structure returned by this function. The caller should
988 * free this memory when they are done using it.
989 */
990
991 Drive_Control_Array _System Get_Drive_Control_Data( CARDINAL32 * Error_Code );
992
993 /*
994 *@@ Get_Drive_Status:
995 * returns the Drive_Information_Record for the drive
996 * specified by Drive_Handle.
997 *
998 * Input:
999 *
1000 * -- PVOID Drive_Handle: The handle of the drive to use.
1001 * Drive handles are obtained through the
1002 * Get_Drive_Control_Data function.
1003 *
1004 * Output:
1005 *
1006 * This function returns the Drive_Information_Record for
1007 * the drive associated with the specified Drive_Handle.
1008 * If no errors occur, *Error_Code will be set to 0. If an
1009 * error does occur, then *Error_Code will be non-zero.
1010 *
1011 * Error Handling:
1012 *
1013 * If an error occurs, then *Error_Code will be non-zero.
1014 */
1015
1016 Drive_Information_Record _System Get_Drive_Status( PVOID Drive_Handle, CARDINAL32 * Error_Code );
1017
1018 /* ******************************************************************
1019 *
1020 * Functions relating to Partitions
1021 *
1022 ********************************************************************/
1023
1024 /*
1025 *@@ Get_Partitions:
1026 * returns an array of partitions associated with the
1027 * object specified by Handle.
1028 *
1029 * Input:
1030 *
1031 * -- PVOID Handle: This is the handle of a drive or volume.
1032 * Drive handles are obtained through the
1033 * Get_Drive_Control_Data function. Volume
1034 * handles are obtained through the
1035 * Get_Volume_Control_Data function.
1036 *
1037 * Output:
1038 *
1039 * This function returns a structure. The structure has
1040 * two components: an array of partition information
1041 * records and the number of entries in the array. If
1042 * Handle is the handle of a disk drive, then the returned
1043 * array will contain a partition information record for
1044 * each partition and block of free space on that drive.
1045 * If Handle is the handle of a volume, then the returned
1046 * array will contain a partition information record for
1047 * each partition which is part of the specified volume.
1048 *
1049 * If no errors occur, then *Error_Code will be 0. If an
1050 * error does occur, then *Error_Code will be non-zero.
1051 *
1052 * Error Handling:
1053 *
1054 * Any memory allocated for the return value will be freed.
1055 * The Partition_Information_Array returned by this function
1056 * will contain a NULL pointer for Partition_Array, and have a
1057 * Count of 0. *Error_Code will be non-zero.
1058 *
1059 * If Handle is non-NULL and is invalid, a trap is likely.
1060 *
1061 * Side Effects:
1062 *
1063 * Memory will be allocated to hold the array returned by this
1064 * function.
1065 *
1066 * Notes:
1067 *
1068 * The caller becomes responsible for the memory allocated
1069 * for the array of Partition_Information_Records pointed
1070 * to by Partition_Array pointer in the
1071 * Partition_Information_Array structure returned by this
1072 * function. The caller should free this memory when they
1073 * are done using it.
1074 */
1075
1076 Partition_Information_Array _System Get_Partitions( PVOID Handle, CARDINAL32 * Error_Code );
1077
1078 /*
1079 *@@ Get_Partition_Handle:
1080 * returns the handle of the partition whose serial number
1081 * matches the one provided.
1082 *
1083 * Input:
1084 *
1085 * -- CARDINAL32 Serial_Number: This is the serial number to
1086 * look for. If a partition with a matching serial number
1087 * is found, its handle will be returned.
1088 *
1089 * Output:
1090 *
1091 * If a partition with a matching serial number is found,
1092 * then the function return value will be the handle
1093 * of the partition found. If no matching partition is
1094 * found, then the function return value will be NULL.
1095 *
1096 * Error Handling:
1097 *
1098 * If no errors occur, *Error_Code will be LVM_ENGINE_NO_ERROR.
1099 * If an error occurs, then *Error_Code will be a non-zero error
1100 * code.
1101 */
1102
1103 PVOID _System Get_Partition_Handle( CARDINAL32 Serial_Number, CARDINAL32 * Error_Code );
1104
1105 /*
1106 *@@ Get_Partition_Information:
1107 * returns the Partition_Information_Record for the partition
1108 * specified by Partition_Handle.
1109 *
1110 * Input:
1111 *
1112 * -- PVOID Partition_Handle:
1113 * The handle associated with the partition for which the
1114 * Partition_Information_Record is desired.
1115 *
1116 * Output:
1117 * A Partition_Information_Record is returned. If there
1118 * is no error, then *Error_Code will be 0. If an error
1119 * occurs, *Error_Code will be non-zero.
1120 *
1121 * Error Handling:
1122 * If the Partition_Handle is not a valid handle, a trap
1123 * could result. If it is a handle for something other than
1124 * a partition, an error code will be returned in *Error_Code.
1125 */
1126
1127 Partition_Information_Record _System Get_Partition_Information( PVOID Partition_Handle, CARDINAL32 * Error_Code );
1128
1129 /*
1130 *@@ Create_Partition:
1131 * creates a partition on a disk drive.
1132 *
1133 * Input:
1134 *
1135 * -- PVOID Handle: The handle of a disk drive or a block
1136 * of free space.
1137 *
1138 * -- CARDINAL32 Size: The size, in sectors, of the
1139 * partition to create.
1140 *
1141 * -- char Name[]: The name to give to the newly created
1142 * partition.
1143 *
1144 * -- Allocation_Algorithm algorithm: If Handle is a drive,
1145 * then the engine will find a block of free space to use
1146 * to create the partition. This tells the engine which
1147 * memory management algorithm to use.
1148 *
1149 * -- BOOLEAN Bootable: If TRUE, then the engine will
1150 * only create the partition if it can be booted from.
1151 * If Primary_Partition is FALSE, then it is assumed that
1152 * OS/2 is the operating system that will be booted.
1153 *
1154 * -- BOOLEAN Primary_Partition: If TRUE, then the engine
1155 * will create a primary partition. If FALSE, then the
1156 * engine will create a logical drive.
1157 *
1158 * -- BOOLEAN Allocate_From_Start: If TRUE, then the engine
1159 * will allocate the new partition from the beginning of
1160 * the selected block of free space. If FALSE, then the
1161 * partition will be allocated from the end of the selected
1162 * block of free space.
1163 *
1164 * Output:
1165 *
1166 * The function return value will be the handle of the partition
1167 * created. If the partition could not be created, then NULL will
1168 * be returned. *Error_Code will be 0 if the partition was created.
1169 * *Error_Code will be > 0 if the partition could not be created.
1170 *
1171 * Error Handling:
1172 *
1173 * If the partition can not be created, then any memory allocated
1174 * by this function will be freed and the partitioning of the disk in
1175 * question will be unchanged.
1176 *
1177 * If Handle is not a valid handle, then a trap may result.
1178 *
1179 * If Handle represents a partition or volume, then the function
1180 * will abort and set *Error_Code to a non-zero value.
1181 *
1182 * Side Effects:
1183 *
1184 * A partition may be created on a disk drive.
1185 */
1186
1187 PVOID _System Create_Partition( PVOID Handle,
1188 CARDINAL32 Size,
1189 char Name[ PARTITION_NAME_SIZE ],
1190 Allocation_Algorithm algorithm,
1191 BOOLEAN Bootable,
1192 BOOLEAN Primary_Partition,
1193 BOOLEAN Allocate_From_Start,
1194 CARDINAL32 * Error_Code
1195 );
1196
1197 /*
1198 *@@ Delete_Partition:
1199 * deletes the partition specified by Partition_Handle.
1200 *
1201 * Input:
1202 *
1203 * -- PVOID Partition_Handle: The handle associated with the*
1204 * partition to be deleted.
1205 *
1206 * Output:
1207 * *Error_Code will be 0 if the partition was deleted successfully.
1208 * *Error_Code will be > 0 if the partition could not be deleted.
1209 *
1210 * Error Handling:
1211 * If the partition can not be deleted, then *Error_Code will be > 0.
1212 *
1213 * If Partition_Handle is not a valid handle, a trap may result.
1214 *
1215 * If Partition_Handle is a volume or drive handle, then this
1216 * function will abort and set *Error_Code to a non-zero value.
1217 *
1218 * Side Effects:
1219 * A partition on a disk drive may be deleted.
1220 *
1221 * Notes: A partition can not be deleted if it is part of a
1222 * volume!
1223 */
1224
1225 void _System Delete_Partition( PVOID Partition_Handle, CARDINAL32 * Error_Code );
1226
1227 /*
1228 *@@ Set_Active_Flag:
1229 * sets the Active Flag field for a partition.
1230 *
1231 * Input:
1232 *
1233 * -- PVOID Partition_Handle: The handle of the partition
1234 * whose Active Flag is to be set.
1235 *
1236 * -- BYTE Active_Flag: The new value for the Active Flag.
1237 *
1238 *
1239 * Output:
1240 *
1241 * *Error_Code will be 0 if the Active Flag was successfully set,
1242 * otherwise *Error_Code will contain a non-zero error code
1243 * indicating what went wrong.
1244 *
1245 * Error Handling:
1246 *
1247 * If the Active Flag can not be set, this function will abort
1248 * without changing any disk structures.
1249 *
1250 * If Partition_Handle is not a valid handle, a trap may result.
1251 *
1252 * If Partition_Handle is a volume or drive handle, then this
1253 * function will abort and set *Error_Code to a non-zero value.
1254 *
1255 * Side Effects:
1256 *
1257 * The Active Flag for a partition may be modified.
1258 */
1259
1260 void _System Set_Active_Flag ( PVOID Partition_Handle,
1261 BYTE Active_Flag,
1262 CARDINAL32 * Error_Code
1263 );
1264
1265 /*
1266 *@@ Set_OS_Flag:
1267 * sets the OS Flag field for a partition. This field
1268 * is typically used to indicate the filesystem used on
1269 * the partition, which generally gives an indication of
1270 * which OS is using that partition.
1271 *
1272 * Input:
1273 *
1274 * -- PVOID Partition_Handle: The handle of the partition
1275 * whose Active Flag is to be set.
1276 * -- BYTE OS_Flag - The new value for the OS Flag.
1277 *
1278 * Output:
1279 *
1280 * *Error_Code will be 0 if the OS Flag was successfully
1281 * set, otherwise *Error_Code will contain a non-zero error
1282 * code indicating what went wrong.
1283 *
1284 * Error Handling:
1285 *
1286 * If the OS Flag can not be set, this function will abort
1287 * without changing any disk structures.
1288 *
1289 * If Partition_Handle is not a valid handle, a
1290 * trap may result.
1291 *
1292 * If Partition_Handle is a volume or drive handle,
1293 * then this function will abort and set
1294 * *Error_Code to a non-zero value.
1295 *
1296 * Side Effects:
1297 *
1298 * The OS Flag for a partition may be modified.
1299 */
1300
1301 void _System Set_OS_Flag ( PVOID Partition_Handle,
1302 BYTE OS_Flag,
1303 CARDINAL32 * Error_Code
1304 );
1305
1306 /* ******************************************************************
1307 *
1308 * Functions relating to Volumes
1309 *
1310 ********************************************************************/
1311
1312 /*
1313 *@@ Get_Volume_Control_Data:
1314 * returns a structure containing an array of Volume_Control_Records.
1315 * These records contain information about volumes which is
1316 * invariant - i.e. will not change for as long as the volume exists.
1317 * One of the items in the Volume_Control_Record is the handle for
1318 * the volume. This handle must be used on all accesses to the volume.
1319 *
1320 *
1321 * Output:
1322 *
1323 * A Volume_Control_Array structure is returned.
1324 *
1325 * If there are no errors, then the Volume_Control_Data
1326 * pointer in the Volume_Control_Array will be non-NULL,
1327 * the Count field of the Volume_Control_Array will be
1328 * >= 0, and *Error_Code will be 0.
1329 *
1330 * If an error does occur, then the Volume_Control_Data
1331 * pointer in the the Volume_Control_Array will be NULL,
1332 * the Count field of the Volume_Control_Array will be 0,
1333 * and *Error_Code will be > 0.
1334 *
1335 * Error Handling:
1336 *
1337 * If an error occurs, then any memory allocated by this
1338 * function will be freed.
1339 *
1340 * Side Effects:
1341 * Memory for the returned array is allocated.
1342 *
1343 * Notes: The caller becomes responsible for the memory allocated
1344 * for the array of Volume_Control_Records pointed to by
1345 * Volume_Control_Data pointer in the Volume_Control_Array
1346 * structure returned by this function. The caller should
1347 * free this memory when they are done using it.
1348 */
1349
1350 Volume_Control_Array _System Get_Volume_Control_Data( CARDINAL32 * Error_Code );
1351
1352
1353 /*
1354 *@@ Get_Volume_Information:
1355 * returns the Volume_Information_Record for the volume
1356 * associated with Volume_Handle.
1357 *
1358 * Input:
1359 *
1360 * -- PVOID Volume_Handle: The handle of the volume about
1361 * which information is desired.
1362 *
1363 * Output: This function returns a Volume_Information_Record.
1364 *
1365 * If this function is successful, then *Error_Code will be 0.
1366 *
1367 * If this function fails, then *Error_Code will be > 0.
1368 *
1369 * Error Handling:
1370 *
1371 * If Volume_Handle is not a valid handle, a trap will be likely.
1372 * If Volume_Handle is a drive or partition handle, *Error_Code
1373 * will be > 0.
1374 */
1375
1376 Volume_Information_Record _System Get_Volume_Information( PVOID Volume_Handle, CARDINAL32 * Error_Code );
1377
1378 /*
1379 *@@ Create_Volume:
1380 * creates a volume from a list of partitions. The partitions
1381 * are specified by their corresponding handles.
1382 *
1383 * Input:
1384 * -- char Name[]: The name to assign to the newly created volume.
1385 *
1386 * -- BOOLEAN Create_LVM_Volume: If TRUE, then an LVM volume is
1387 * created, otherwise a compatibility volume is created.
1388 *
1389 * -- BOOLEAN Bootable: If TRUE, the volume will not be created
1390 * unless OS/2 can be booted from it.
1391 *
1392 * -- char Drive_Letter_Preference: This is the drive letter to
1393 * use for accessing the newly created volume.
1394 *
1395 * -- CARDINAL32 FeaturesToUse: This is currently reserved for
1396 * future use and should always be set to 0.
1397 *
1398 * -- CARDINAL32 Partition_Count: The number of partitions to
1399 * link together to form the volume being created.
1400 *
1401 * -- PVOID Partition_Handles[]: An array of partition handles
1402 * with one entry for each partition that is to become part
1403 * of the volume being created.
1404 *
1405 * Output:
1406 *
1407 * *Error_Code will be 0 if the volume was created. *Error_Code will
1408 * be > 0 if the volume could not be created.
1409 *
1410 * Error Handling:
1411 *
1412 * If any of the handles in the partition handles array is not valid,
1413 * then a trap is likely. If Partition_Count is greater than the
1414 * number of entries in the partition handles array, then a trap is
1415 * likely. If any of the handles in the partition array are not
1416 * partition handles, then *Error_Code will be > 0. If the volume
1417 * can NOT be created, then *Error_Code will be > 0 and any
1418 * memory allocated by this function will be freed. If the volume
1419 * can NOT be created, then the existing partition/volume structure
1420 * of the disk will be unchanged.
1421 *
1422 * Side Effects:
1423 *
1424 * A volume may be created.
1425 */
1426
1427 void _System Create_Volume( char Name[VOLUME_NAME_SIZE],
1428 BOOLEAN Create_LVM_Volume,
1429 BOOLEAN Bootable,
1430 char Drive_Letter_Preference,
1431 CARDINAL32 FeaturesToUse,
1432 CARDINAL32 Partition_Count,
1433 PVOID Partition_Handles[],
1434 CARDINAL32 * Error_Code
1435 );
1436
1437 /*
1438 *@@ Delete_Volume:
1439 * deletes the volume specified by Volume_Handle.
1440 *
1441 * Input:
1442 *
1443 * -- PVOID Volume_Handle: The handle of the volume to
1444 * delete. All partitions which are
1445 * part of the specified volume will
1446 * be deleted also.
1447 *
1448 *
1449 * Output:
1450 *
1451 * *Error_Code will be 0 if the volume and its partitions
1452 * are successfully deleted. Otherwise, *Error_Code will
1453 * be > 0.
1454 *
1455 * Error Handling:
1456 *
1457 * *Error_Code will be > 0 if an error occurs. If the
1458 * volume or any of its partitions can not be deleted,
1459 * then any changes made by this function will be undone.
1460 *
1461 * If Volume_Handle is not a valid handle, a trap may result.
1462 *
1463 * If Volume_Handle is a partition or drive handle, then
1464 * this function will abort and set *Error_Code to a non-zero value.
1465 *
1466 * Side Effects:
1467 *
1468 * A volume and its partitions may be deleted. System memory
1469 * may be freed as the internal structures used to track the
1470 * deleted volume are no longer required.
1471 */
1472
1473 void _System Delete_Volume( PVOID Volume_Handle, CARDINAL32 * Error_Code );
1474
1475 /*
1476 *@@ Hide_Volume:
1477 * "hides" a volume from OS/2 by removing its drive letter
1478 * assignment. Without a drive letter assignment, OS/2 can not
1479 * access (or "see") the volume.
1480 *
1481 * Input:
1482 *
1483 * -- PVOID Volume_Handle: The handle of the volume to hide.
1484 *
1485 * Output:
1486 *
1487 * *Error_Code will be 0 if the volume was successfully
1488 * hidden. If the volume could not be hidden, then
1489 * *Error_Code will be > 0.
1490 *
1491 * Error Handling:
1492 * *Error_Code will be > 0 if the volume can not be hidden.
1493 * If the volume can not be hidden, then nothing will be altered.
1494 *
1495 * If Volume_Handle is not a valid handle, a trap may result.
1496 *
1497 * If Volume_Handle is a partition or drive handle, then this
1498 * function will abort and set *Error_Code to a non-zero value.
1499 */
1500
1501 void _System Hide_Volume( PVOID Volume_Handle, CARDINAL32 * Error_Code );
1502
1503 /*
1504 *@@ Expand_Volume:
1505 * expands an existing volume by linking additional partitions to it.
1506 *
1507 * Input:
1508 *
1509 * -- PVOID Volume_Handle: The handle of the volume to be
1510 * expanded.
1511 *
1512 * -- CARDINAL32 Partition_Count - The number of partitions or
1513 * volumes to be added to the volume being expanded.
1514 *
1515 * -- PVOID Partition_Handles[] - An array of handles. Each
1516 * handle in the array is the handle of a partition which
1517 * is to be added to the volume being expanded.
1518 *
1519 * Output:
1520 *
1521 * *Error_Code will be 0 if the volume is successfully expanded.
1522 * If the volume can not be expanded, *Error_Code will be > 0.
1523 *
1524 * Error Handling:
1525 *
1526 * If the volume can not be expanded, the state of the volume
1527 * is unchanged and any memory allocated by this function is freed.
1528 *
1529 * If Volume_Handle is not a valid handle, a trap may result.
1530 *
1531 * If Volume_Handle is a partition or drive handle, then this
1532 * function will abort and set *Error_Code to a non-zero value.
1533 *
1534 * If any of the partition handles in the Partition_handles
1535 * array are not valid handles, then a trap may result.
1536 *
1537 * If any of the partition handles in the Partition_Handles
1538 * array are actually drive handles, then this function will
1539 * abort and set *Error_Code to a non-zero value.
1540 *
1541 * If Partition_Count is greater than the number of entries in
1542 * the Partition_Handles array, a trap may result.
1543 *
1544 * Side Effects:
1545 *
1546 * A volume may be expanded. If the volume is expanded using
1547 * another volume, the partitions on the second volume will be
1548 * linked to those of the first volume and all data on the second
1549 * volume will be lost.
1550 */
1551
1552 void _System Expand_Volume ( PVOID Volume_Handle,
1553 CARDINAL32 Partition_Count,
1554 PVOID Partition_Handles[],
1555 CARDINAL32 * Error_Code
1556 );
1557
1558 /*
1559 *@@ Assign_Drive_Letter:
1560 * assigns a drive letter to a volume.
1561 *
1562 * Input:
1563 *
1564 * -- PVOID Volume_Handle: The handle of the volume which
1565 * is to have its assigned drive letter changed.
1566 *
1567 * -- char New_Drive_Preference: The new drive letter to
1568 * assign to the volume.
1569 *
1570 * Output:
1571 * *Error_Code will be 0 if the drive letter was assigned
1572 * successfully; otherwise *Error_Code will be > 0.
1573 *
1574 * Error Handling:
1575 *
1576 * If the drive letter assignment can not be made, the
1577 * volume will not be altered.
1578 *
1579 * If Volume_Handle is not a valid handle, a trap may result.
1580 *
1581 * If Volume_Handle is a partition or drive handle, then
1582 * this function will abort and set *Error_Code to a non-zero
1583 * value.
1584 *
1585 * Side Effects:
1586 *
1587 * A volume may have its drive letter assignment changed.
1588 *
1589 * Notes: If the drive letter being assigned is already in use by
1590 * volume which does not lie on removable media, then the
1591 * drive assignment will NOT be made.
1592 */
1593
1594 void _System Assign_Drive_Letter( PVOID Volume_Handle,
1595 char New_Drive_Preference,
1596 CARDINAL32 * Error_Code
1597 );
1598
1599 /*
1600 *@@ Set_Installable:
1601 * marks a volume as being the volume to install OS/2 on.
1602 *
1603 * Input:
1604 *
1605 * -- PVOID Volume_Handle: The handle of the volume to which
1606 * OS/2 should be installed.
1607 *
1608 * Output:
1609 *
1610 * If the volume is successfully marked as installable,
1611 * *Error_Code will be 0; otherwise *Error_Code will be > 0.
1612 *
1613 * Error Handling:
1614 *
1615 * If Volume_Handle is not a valid handle, a trap may result.
1616 *
1617 * If Volume_Handle is a partition or drive handle, then this
1618 * function will abort and set *Error_Code to a non-zero value.
1619 *
1620 * Side Effects:
1621 *
1622 * The specified volume may be marked as installable.
1623 */
1624
1625 void _System Set_Installable ( PVOID Volume_Handle, CARDINAL32 * Error_Code );
1626
1627 /*
1628 *@@ Get_Installable_Volume:
1629 * returns the volume currently marked as installable.
1630 *
1631 * Output:
1632 *
1633 * If a volume is marked installable, its information will be
1634 * returned and *Error_Code will be LVM_ENGINE_NO_ERROR.
1635 * If there is no volume marked installable, then
1636 * *Error_Code will be > 0.
1637 */
1638
1639 Volume_Information_Record _System Get_Installable_Volume ( CARDINAL32 * Error_Code );
1640
1641 /* ******************************************************************
1642 *
1643 * Functions relating to Partitions, Drives, and Volumes
1644 *
1645 ********************************************************************/
1646
1647 /*
1648 *@@ Set_Name:
1649 * sets the name of a volume, drive, or partition.
1650 *
1651 * Input:
1652 *
1653 * -- PVOID Handle: The handle of the drive, partition, or
1654 * volume which is to have its name set.
1655 *
1656 * -- char New_Name[]: The new name for the drive/partition/volume.
1657 *
1658 * Output:
1659 *
1660 * *Error_Code will be 0 if the name is set as specified.
1661 * If the name can not be set, *Error_Code will be > 0.
1662 *
1663 * Error Handling:
1664 * If the name can not be set, then drive/volume/partition is
1665 * not modified.
1666 *
1667 * If Handle is not a valid handle, a trap may result.
1668 *
1669 * Side Effects: A drive/volume/partition may have its name set.
1670 *
1671 */
1672
1673 void _System Set_Name ( PVOID Handle,
1674 char New_Name[],
1675 CARDINAL32 * Error_Code
1676 );
1677
1678 /*
1679 *@@ Set_Startable:
1680 * sets the specified volume or partition startable.
1681 * If a volume is specified, it must be a compatibility
1682 * volume whose partition is a primary partition on the
1683 * first drive. If a partition is specified, it must be
1684 * a primary partition on the first drive in the system.
1685 *
1686 * Input:
1687 *
1688 * -- PVOID Handle: The handle of the partition or volume
1689 * which is to be set startable.
1690 *
1691 * Output:
1692 *
1693 * *Error_Code will be 0 if the specified volume or
1694 * partition was set startable. If the name can not be set,
1695 * *Error_Code will be > 0.
1696 *
1697 * Error Handling:
1698 *
1699 * If the volume or partition could not be set startable,
1700 * then nothing in the system is changed.
1701 *
1702 * If Handle is not a valid handle, a trap may result.
1703 *
1704 * Side Effects:
1705 *
1706 * Any other partition or volume which is marked startable
1707 * will have its startable flag cleared.
1708 */
1709
1710 void _System Set_Startable ( PVOID Handle,
1711 CARDINAL32 * Error_Code
1712 );
1713
1714 /*
1715 *@@ Get_Valid_Options:
1716 * returns a bitmap where each bit in the bitmap
1717 * corresponds to a possible operation that the LVM
1718 * Engine can perform. Those bits which are 1 represent
1719 * operations which can be performed on the item specified
1720 * by Handle. Those bits which are 0 are not allowed on the
1721 * item specified by Handle.
1722 *
1723 * Input:
1724 *
1725 * -- PVOID Handle: This is any valid drive, volume, or
1726 * partition handle.
1727 *
1728 * Output:
1729 *
1730 * A bitmap indicating which operations are valid on the
1731 * item specified by Handle.
1732 *
1733 * If no errors occur, *Error_Code will be 0, otherwise
1734 * *Error_Code will be > 0.
1735 *
1736 * Error Handling:
1737 *
1738 * If Handle is not valid, a trap will be likely.
1739 *
1740 * Notes:
1741 *
1742 * The values of the various bits in the bitmap returned
1743 * by this function are defined near the beginning of this
1744 * file, immediately after all of the structure
1745 * definitions.
1746 */
1747
1748 CARDINAL32 _System Get_Valid_Options( PVOID Handle, CARDINAL32 * Error_Code );
1749
1750 /* ******************************************************************
1751 *
1752 * Functions relating to Boot Manager
1753 *
1754 ********************************************************************/
1755
1756 /*
1757 *@@ Boot_Manager_Is_Installed:
1758 * indicates whether or not Boot Manager is installed
1759 * on the first or second hard drives in the system.
1760 *
1761 * Output:
1762 *
1763 * TRUE is returned if Boot Manager is found.
1764 * FALSE is returned if Boot Manager is not found or if an
1765 * error occurs.
1766 * *Error_Code will be 0 if no errors occur; otherwise it
1767 * will be > 0.
1768 */
1769
1770 BOOLEAN _System Boot_Manager_Is_Installed( CARDINAL32 * Error_Code);
1771
1772 /*
1773 *@@ Add_To_Boot_Manager:
1774 * adds the volume/partition to the Boot Manager menu.
1775 *
1776 * Input:
1777 *
1778 * -- PVOID Handle: The handle of a partition or volume that
1779 * is to be added to the Boot Manager menu.
1780 *
1781 * Output:
1782 *
1783 * *Error_Code will be 0 if the partition or volume was
1784 * successfully added to the Boot Manager menu; otherwise
1785 * *Error_Code will be > 0.
1786 *
1787 * Error Handling:
1788 * If the partition/volume can not be added to the Boot
1789 * Manager menu, no action is taken and *Error_Code will
1790 * contain a non-zero error code.
1791 *
1792 * If Handle is not a valid handle, a trap may
1793 * result.
1794 *
1795 * If Handle represents a drive, then this function will
1796 * abort and set *Error_Code to a non-zero value.
1797 *
1798 * Side Effects:
1799 *
1800 * The Boot Manager menu may be altered.
1801 */
1802
1803 void _System Add_To_Boot_Manager ( PVOID Handle, CARDINAL32 * Error_Code );
1804
1805 /*
1806 *@@ Remove_From_Boot_Manager:
1807 * removes the specified partition or volume from the
1808 * Boot Manager menu.
1809 *
1810 * Output:
1811 *
1812 * *Error_Code will be 0 if the partition or volume was
1813 * successfully removed to the Boot Manager menu;
1814 * otherwise *Error_Code will be > 0.
1815 *
1816 * Error Handling:
1817 *
1818 * If Handle is not a valid handle, a trap may result.
1819 *
1820 * If Handle represents a drive, or if Handle represents
1821 * a volume or partition which is NOT on the boot manager
1822 * menu, then this function will abort and set *Error_Code
1823 * to a non-zero value.
1824 *
1825 * Side Effects:
1826 *
1827 * The Boot Manager menu may be altered.
1828 */
1829
1830 void _System Remove_From_Boot_Manager ( PVOID Handle, CARDINAL32 * Error_Code );
1831
1832 /*
1833 *@@ Get_Boot_Manager_Menu:
1834 * returns an array containing the handles of the partitions
1835 * and volumes appearing on the Boot Manager menu.
1836 *
1837 * Output:
1838 *
1839 * The function returns a Boot_Manager_Menu structure.
1840 * This structure contains two items: a pointer to an array
1841 * of Boot_Manager_Menu_Items and a count of how many items
1842 * are in the array. Each Boot_Manager_Menu_Item contains
1843 * a handle and a BOOLEAN variable to indicate whether the
1844 * handle is for a partition or a volume.
1845 *
1846 * If this function is successful, then *Error_Code will
1847 * be 0.
1848 *
1849 * If an error occurs, the Count field in the Boot_Manager_Menu
1850 * will be 0 and the corresponding pointer will be NULL. *Error_Code will be > 0.
1851 *
1852 * Error Handling:
1853 *
1854 * If an error occurs, *Error_Code will be > 0. Any memory
1855 * allocated by this function will be freed.
1856 */
1857
1858 Boot_Manager_Menu _System Get_Boot_Manager_Menu ( CARDINAL32 * Error_Code);
1859
1860 /*
1861 *@@ Install_Boot_Manager:
1862 * this function installs Boot Manager. It can be used
1863 * to replace an existing Boot Manager as well.
1864 *
1865 * Input:
1866 *
1867 * -- CARDINAL32 Drive_Number: The number of the drive to
1868 * install Boot Manager on. Must be 1 or 2.
1869 *
1870 * Output:
1871 *
1872 * If this function is successful, then *Error_Code will be 0;
1873 * otherwise it will be > 0.
1874 *
1875 * Error Handling:
1876 * If an error occurs, *Error_Code will be set to a non-zero
1877 * value. Depending upon the error, it is possible that the
1878 * Boot Manager partition can be left in an unusuable state
1879 * (such as for a write error).
1880 *
1881 * Side Effects:
1882 *
1883 * Boot Manager may be installed on drive 1 or 2. The MBR for
1884 * drive 1 may be altered.
1885 */
1886
1887 void _System Install_Boot_Manager ( CARDINAL32 Drive_Number, CARDINAL32 * Error_Code );
1888
1889 /*
1890 *@@ Remove_Boot_Manager:
1891 * removes Boot Manager from the system.
1892 *
1893 * Output:
1894 *
1895 * *Error_Code will be 0 if Boot Manager was successfully
1896 * removed from the system; otherwise *Error_Code will
1897 * be 0.
1898 *
1899 * Error Handling:
1900 *
1901 * If an error occurs, *Error_Code will be > 0.
1902 *
1903 * Side Effects:
1904 * Boot Manager will be removed from the system.
1905 */
1906
1907 void _System Remove_Boot_Manager( CARDINAL32 * Error_Code );
1908
1909 /*
1910 *@@ Set_Boot_Manager_Options:
1911 * sets the Boot Managers Options. The options that can
1912 * be set are: whether or not the time-out timer is
1913 * active, how long the timer-out is, the partition to
1914 * boot by default, and whether or not Boot Manager should
1915 * display its menu using default mode or advanced mode.
1916 *
1917 * Input:
1918 *
1919 * -- PVOID Handle - The handle of the partition or volume
1920 * to boot if the time-out timer is active and the time-out
1921 * value is reached.
1922 *
1923 * -- BOOLEAN Timer_Active - If TRUE, then the time-out timer
1924 * is active.
1925 *
1926 * -- CARDINAL32 Time_Out_Value - If the time-out timer is
1927 * active, this is the time-out value, in seconds.
1928 *
1929 * -- BOOLEAN Advanced_Mode - If TRUE, then Boot Manager will
1930 * operate in advanced mode. If FALSE, then normal mode
1931 * will be in effect.
1932 *
1933 * Output:
1934 *
1935 * *Error_Code will be 0 if no errors occur. If an error
1936 * does occur, then *Error_Code will be > 0.
1937 *
1938 * Error Handling:
1939 *
1940 * If an error occurs, no changes will be made to Boot Manager
1941 * and *Error_Code will be set a non-zero error code.
1942 *
1943 * Side Effects:
1944 *
1945 * Boot Manager may be modified.
1946 */
1947
1948 void _System Set_Boot_Manager_Options( PVOID Handle,
1949 BOOLEAN Timer_Active,
1950 CARDINAL32 Time_Out_Value,
1951 BOOLEAN Advanced_Mode,
1952 CARDINAL32 * Error_Code
1953 );
1954
1955 /*
1956 *@@ Get_Boot_Manager_Options:
1957 * returns the current Boot Manager settings for the
1958 * various Boot Manager options.
1959 *
1960 * Input:
1961 *
1962 * -- PVOID * Handle - The handle for the default boot
1963 * volume or partition.
1964 *
1965 * -- BOOLEAN * Handle_Is_Volume - If TRUE, then Handle
1966 * represents a volume. If FALSE, then Handle
1967 * represents a partition.
1968 *
1969 * -- BOOLEAN * Timer_Active - If TRUE, then the time-out
1970 * timer is active. If FALSE, then the time-out timer
1971 * is not active.
1972 *
1973 * -- CARDINAL32 * Time_Out_Value - If the time-out timer
1974 * is active, then this is the number of seconds that
1975 * Boot Manager will wait for user input before booting
1976 * the default volume/partition.
1977 *
1978 * -- BOOLEAN * Advanced_Mode - If TRUE, the Boot Manager is
1979 * operating in advanced mode. If FALSE, then Boot Manager
1980 * is operating in normal mode.
1981 *
1982 * Output:
1983 *
1984 * *Handle, *Handle_Is_Volume, *Timer_Active, *Time_out_value,
1985 * *Advanced_Mode, and *Error_Code are all set by this function.
1986 * If there are no errors, then *Error_Code will be set to 0.
1987 * If any errors occur, then *Error_Code will be > 0.
1988 *
1989 * Error Handling:
1990 *
1991 * If any of the parameters are invalid, then a trap is likely.
1992 * If Boot Manager is not installed, then *Error_Code will be > 0.
1993 */
1994
1995 void _System Get_Boot_Manager_Options( PVOID * Handle,
1996 BOOLEAN * Handle_Is_Volume,
1997 BOOLEAN * Timer_Active,
1998 CARDINAL32 * Time_Out_Value,
1999 BOOLEAN * Advanced_Mode,
2000 CARDINAL32 * Error_Code
2001 );
2002
2003 /* ******************************************************************
2004 *
2005 * Other Functions
2006 *
2007 ********************************************************************/
2008
2009 /*
2010 *@@ Free_Engine_Memory:
2011 * frees a memory object created by LVM.DLL and returned
2012 * to a user of LVM.DLL.
2013 *
2014 * Input:
2015 *
2016 * -- PVOID Object: The address of the memory object to
2017 * free. This could be the Drive_Control_Data field of
2018 * a Drive_Control_Record, the Partition_Array field of
2019 * a Partition_Information_Array structure, or any other
2020 * dynamically allocated memory object created by LVM.DLL
2021 * and returned by a function in LVM.DLL.
2022 *
2023 * Notes:
2024 *
2025 * A trap or exception could occur if a bad address is passed
2026 * into this function.
2027 */
2028
2029 void _System Free_Engine_Memory( PVOID Object );
2030
2031 /*
2032 *@@ New_MBR:
2033 * this function lays down a new MBR on the specified drive.
2034 *
2035 * Input:
2036 *
2037 * -- PVOID Drive_Handle - The handle of the drive on which
2038 * the new MBR is to be placed.
2039 *
2040 * Output:
2041 *
2042 * *Error_Code will be 0 if the new MBR was successfully
2043 * placed on the specified drive. If the operation failed
2044 * for any reason, then *Error_Code will contain a non-zero
2045 * error code.
2046 *
2047 * Error Handling:
2048 *
2049 * If an error occurs, then the existing MBR is not altered
2050 * and *Error_Code will be > 0.
2051 *
2052 * Side Effects:
2053 *
2054 * A new MBR may be placed on the specified drive.
2055 */
2056
2057 void _System New_MBR( PVOID Drive_Handle, CARDINAL32 * Error_Code );
2058
2059 /*
2060 *@@ Get_Available_Drive_Letters:
2061 * returns a bitmap indicating which drive letters are
2062 * available for use.
2063 *
2064 * Output:
2065 *
2066 * This function returns a bitmap of the available drive
2067 * letters. If this function is successful, then
2068 * *Error_Code will be set to 0. Otherwise, *Error_Code
2069 * will be > 0 and the bitmap returned will have all bits
2070 * set to 0.
2071 *
2072 * Error Handling:
2073 *
2074 * If an error occurs, *Error_Code will be > 0.
2075 *
2076 * Notes:
2077 * A drive letter is available if it is not associated
2078 * with a volume located on a disk drive controlled
2079 * by OS2DASD.
2080 */
2081
2082 CARDINAL32 _System Get_Available_Drive_Letters ( CARDINAL32 * Error_Code ) ;
2083
2084 /*
2085 *@@ Reboot_Required:
2086 * this function indicates whether or not any changes
2087 * were made to the partitioning of the disks in the
2088 * system which would require a reboot to make functional.
2089 *
2090 * Output:
2091 *
2092 * The function return value will be TRUE if the system
2093 * must be rebooted as a result of disk partitioning
2094 * changes.
2095 */
2096
2097 BOOLEAN _System Reboot_Required ( void );
2098
2099 /*
2100 *@@ Set_Reboot_Flag:
2101 * this function sets the Reboot Flag. The Reboot
2102 * Flag is a special flag on the boot disk used by
2103 * the install program to keep track of whether or
2104 * not the system was just rebooted. It is used by
2105 * the various phases of install.
2106 *
2107 * Input:
2108 *
2109 * -- BOOLEAN Reboot: The new value for the Reboot Flag.
2110 * If TRUE, then the reboot flag will be set. If
2111 * FALSE, then the reboot flag will be cleared.
2112 *
2113 * Output:
2114 *
2115 * *Error_Code will be set to 0 if there are no errors.
2116 * *Error_Code will be > 0 if an error occurs.
2117 *
2118 * Error Handling:
2119 *
2120 * If an error occurs, then the value of the Reboot
2121 * Flag will be unchanged.
2122 *
2123 * Side Effects:
2124 * The value of the Reboot Flag may be changed.
2125 */
2126
2127 void _System Set_Reboot_Flag( BOOLEAN Reboot, CARDINAL32 * Error_Code );
2128
2129 /*
2130 *@@ Get_Reboot_Flag:
2131 * this function returns the value of the Reboot Flag.
2132 * The Reboot Flag is a special flag on the boot disk
2133 * used by the install program to keep track of whether
2134 * or not the system was just rebooted. It is used by
2135 * the various phases of install.
2136 *
2137 * Output:
2138 *
2139 * The function return value will be TRUE if no errors
2140 * occur and the Reboot Flag is set. *Error_Code will be
2141 * 0 under these conditions. If an error occurs, the
2142 * function return value will be FALSE and *Error_Code
2143 * will be > 0.
2144 *
2145 * Error Handling:
2146 *
2147 * If an error occurs, *Error_Code will be > 0. The value
2148 * of the reboot flag will be unchanged.
2149 */
2150
2151 BOOLEAN _System Get_Reboot_Flag( CARDINAL32 * Error_Code );
2152
2153 /*
2154 *@@ Set_Install_Flags:
2155 * this function sets the value of the Install Flags.
2156 * The Install Flags reside in a 32 bit field in the
2157 * LVM dataspace. These flags are not used by LVM,
2158 * thereby leaving Install free to use them for whatever it wants.
2159 *
2160 * Input:
2161 *
2162 * -- CARDINAL32 Install_Flags: The new value for the Install
2163 * Flags.
2164 *
2165 * Output:
2166 *
2167 * *Error_Code will be set to 0 if there are no errors.
2168 * *Error_Code will be > 0 if an error occurs.
2169 *
2170 * Error Handling:
2171 *
2172 * If an error occurs, then the value of the Install Flags
2173 * will be unchanged.
2174 *
2175 * Side Effects:
2176 *
2177 * The value of the Install Flags may be changed.
2178 */
2179
2180 void _System Set_Install_Flags( CARDINAL32 Install_Flags, CARDINAL32 * Error_Code );
2181
2182 /*
2183 *@@ Get_Install_Flags:
2184 * returns the value of the Install Flags. The Install
2185 * Flags reside in a 32 bit field in the LVM dataspace.
2186 * These flags are not used by LVM, thereby leaving Install
2187 * free to use them for whatever it wants.
2188 *
2189 * Output:
2190 *
2191 * The function returns the current value of the Install
2192 * Flags stored in the LVM Dataspace.
2193 * *Error_Code will be LVM_ENGINE_NO_ERROR if the function
2194 * is successful. If an error occurs, the function will
2195 * return 0 and *Error_Code will be > 0.
2196 *
2197 * Error Handling:
2198 *
2199 * If an error occurs, *Error_Code will be > 0.
2200 */
2201
2202 CARDINAL32 _System Get_Install_Flags( CARDINAL32 * Error_Code );
2203
2204 /*
2205 *@@ Set_Min_Install_Size:
2206 * this function tells the LVM Engine how big a
2207 * partition/volume must be in order for it to marked
2208 * installable. If this function is not used to set the
2209 * minimum size for an installable partition/volume, the
2210 * LVM Engine will use a default value of 300 MB.
2211 *
2212 * Input:
2213 *
2214 * -- CARDINAL32 Min_Sectors: The minimum size, in sectors,
2215 * that a partition must be in order for it to be marked
2216 * as installable.
2217 */
2218
2219 void _System Set_Min_Install_Size ( CARDINAL32 Min_Sectors );
2220
2221 /*
2222 *@@ Set_Free_Space_Threshold:
2223 * this function tells the LVM Engine not to report
2224 * blocks of free space which are less than the size
2225 * specified. The engine defaults to not reporting
2226 * blocks of free space which are smaller than 2048
2227 * sectors (1 MB).
2228 *
2229 * Input:
2230 *
2231 * -- CARDINAL32 Min_Sectors: The minimum size, in sectors,
2232 * that a block of free space must be in order for the
2233 * LVM engine to report it.
2234 */
2235
2236 void _System Set_Free_Space_Threshold( CARDINAL32 Min_Sectors );
2237
2238 /*
2239 *@@ Read_Sectors:
2240 * reads one or more sectors from the specified drive and
2241 * places the data read in Buffer.
2242 *
2243 * Input:
2244 *
2245 * -- CARDINAL32 Drive_Number: The number of the hard drive
2246 * to read from. The drives in the system are numbered
2247 * from 1 to n, where n is the total number of hard drives
2248 * in the system.
2249 *
2250 * -- LBA Starting_Sector: The first sector to read from.
2251 *
2252 * -- CARDINAL32 Sectors_To_Read : The number of sectors to
2253 * read into memory.
2254 *
2255 * -- PVOID Buffer : The location to put the data read into.
2256 *
2257 * Output:
2258 *
2259 * If successful, then the data read will be placed in memory
2260 * starting at Buffer, and *Error will be LVM_ENGINE_NO_ERROR.
2261 *
2262 * If unsuccessful, then *Error will be > 0 and the contents
2263 * of memory starting at Buffer is undefined.
2264 *
2265 * Error Handling:
2266 *
2267 * *Error will be > 0 if an error occurs.
2268 *
2269 * Side Effects:
2270 *
2271 * Data may be read into memory starting at Buffer.
2272 */
2273
2274 void _System Read_Sectors ( CARDINAL32 Drive_Number,
2275 LBA Starting_Sector,
2276 CARDINAL32 Sectors_To_Read,
2277 PVOID Buffer,
2278 CARDINAL32 * Error);
2279
2280 /*
2281 *@@ Write_Sectors:
2282 * writes data from memory to one or more sectors on the
2283 * specified drive.
2284 *
2285 * Input:
2286 *
2287 * -- CARDINAL32 Drive_Number: The number of the hard drive to
2288 * write to. The drives in the system are numbered from 1
2289 * to n, where n is the total number of hard drives in the system.
2290 *
2291 * -- LBA Starting_Sector : The first sector to write to.
2292 *
2293 * -- CARDINAL32 Sectors_To_Read : The number of sectors to
2294 * be written.
2295 *
2296 * -- PVOID Buffer : The location of the data to be written
2297 * to disk.
2298 *
2299 * Output:
2300 *
2301 * If successful, then the data at Buffer will be placed on the
2302 * disk starting at the sector specified, and *Error will be
2303 * LVM_ENGINE_NO_ERROR.
2304 * If unsuccessful, then *Error will be > 0 and the contents
2305 * of the disk starting at sector Starting_Sector is undefined.
2306 *
2307 * Error Handling:
2308 *
2309 * *Error will be > 0 if an error occurs.
2310 *
2311 * Side Effects:
2312 *
2313 * Data may be written to disk.
2314 */
2315
2316 void _System Write_Sectors ( CARDINAL32 Drive_Number,
2317 LBA Starting_Sector,
2318 CARDINAL32 Sectors_To_Write,
2319 PVOID Buffer,
2320 CARDINAL32 * Error);
2321
2322 /*
2323 *@@ Start_Logging:
2324 * enables the LVM Engine logging. Once enabled, the LVM
2325 * Engine logging function will log all LVM Engine activity
2326 * to the specified log file. The data is logged in a binary
2327 * format for compactness and speed.
2328 *
2329 * Input:
2330 *
2331 * -- char * Filename: The filename of the file to use as the
2332 * log file.
2333 *
2334 * Output:
2335 *
2336 * If the logging file was successfully created, then
2337 * *Error_Code will be 0. If the log file could not be
2338 * created, then *Error_Code will be > 0.
2339 *
2340 * Error Handling:
2341 *
2342 * If the log file can not be created, then *Error_Code will
2343 * be > 0.
2344 *
2345 * Side Effects:
2346 *
2347 * A file may be created/opened for logging of LVM Engine actions.
2348 */
2349
2350 void _System Start_Logging( char * Filename, CARDINAL32 * Error_Code );
2351
2352 /*
2353 *@@ Stop_Logging:
2354 * this function ends LVM Engine logging and closes the log file.
2355 *
2356 * Output: *Error_Code will be 0 if this function completes
2357 * successfully; otherwise it will be > 0.
2358 *
2359 * Error Handling: If the log file is not currently opened, or if
2360 * the close operation fails on the log file, then
2361 * *Error_Code will be > 0.
2362 *
2363 * Side Effects: The log file may be closed.
2364 */
2365
2366 void _System Stop_Logging ( CARDINAL32 * Error_Code );
2367
2368 /*
2369 *@@ Export_Configuration:
2370 * this function creates a file containing all of the LVM
2371 * commands necessary to recreate all partitions and volumes
2372 * of this machine on another machine.
2373 *
2374 * Input:
2375 *
2376 * -- char * Filename: The pathname of the file to be created.
2377 *
2378 * Output:
2379 *
2380 * A file containing LVM commands. *Error_Code will be 0
2381 * if this function completed successfully; otherwise
2382 * *Error_code will be > 0.
2383 *
2384 * Error Handling:
2385 *
2386 * If the output file can not be created, or if there is
2387 * some other error, then *Error_Code will be > 0.
2388 *
2389 * Side Effects: A file may be created.
2390 */
2391
2392 void _System Export_Configuration( char * Filename, CARDINAL32 * Error_Code );
2393 /* Creates a file containing LVM.EXE commands that can be used to replicate
2394 the partitioning of the current machine on another machine. */
2395
2396
2397#endif
2398
2399#if __cplusplus
2400}
2401#endif
2402
Note: See TracBrowser for help on using the repository browser.