source: trunk/include/helpers/lvm.h@ 24

Last change on this file since 24 was 14, checked in by umoeller, 25 years ago

Major updates; timers, LVM, miscellaneous.

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