Create_Partition

This function creates a new partition on an LVM-controlled disk drive.


#include <lvm_intr.h>

ADDRESS _System Create_Partition(

    ADDRESS               Handle,                        /* (I) Handle to disk or free space block */
    CARDINAL32            Size,                          /* (I) Partition size, in sectors */
    char                  Name[ PARTITION_NAME_SIZE ],   /* (I) Partition name */
    Allocation_Algorithm  Algorithm,                     /* (I) Free space selection algorithm */
    BOOLEAN               Bootable,                      /* (I) TRUE if partition must be bootable */
    BOOLEAN               Primary_Partition,             /* (I) TRUE if partition must be primary */
    BOOLEAN               Allocate_From_Start,           /* (I) TRUE to allocate from start of free space */
    CARDINAL32 *          Error_Code                     /* (O) Address where the error code will be stored */

);

Parameters

Handle
The handle of either a disk drive, or a block of free space.

In the event that a disk handle is provided, the LVM Engine will automatically determine which block of free space, out of those available on the disk, should be used to create the new partition. In this case, the Algorithm parameter will govern how this determination is to be made.

Size
The size, in sectors, of the partition to create.
Name
The name to give to the newly-created partition.
Algorithm
If Handle is the handle of a disk drive, this parameter tells the LVM Engine which algorithm should be used to find a suitable block of free space for the new partition. The available algorithms are described under the Allocation_Algorithm type.
Bootable
If TRUE, then the new partition must be made bootable. This means that:

If the partition cannot be made bootable according to the above criteria, the partition will not be created, and the value pointed to by Error_Code will be non-zero.

If the Primary_Partition parameter is set to FALSE, then it is assumed that OS/2 is the operating system that will be booted.

Primary_Partition
If TRUE, then a primary partition will be created.
If FALSE, then the engine will create a logical partition.
Allocate_From_Start
If TRUE, then the engine will allocate the new partition from the beginning of the selected block of free space. If FALSE, then the partition will be allocated from the end of the block of free space.
Error_Code
The address of a CARDINAL32 in which to store an error code should an error occur.

Returns

The function return value will be the handle of the partition created. If the partition could not be created, then NULL will be returned, and the value pointed to by Error_Code will be non-zero.

Errors

If an error occurs, the value pointed to by Error_Code will be greater than 0.

If the partition cannot be created, then any memory allocated by this function will be freed, and the partitioning of the disk in question will be unchanged.

Side Effects

A partition may be created on a disk drive.

Notes

If Handle is not a valid handle, then a trap may result.

If Handle is the handle of a partition or volume, then the function will abort, and the value pointed to by Error_Code will be non-zero.

16-Bit Equivalent:

CARDINAL32 _Far16 _Pascal _loadds CREATE_PARTITION16(
        CARDINAL32           Handle,
        CARDINAL32           Size,
        char  *     _Seg16   Name,
        Allocation_Algorithm Algorithm,
        BOOLEAN              Bootable,
        BOOLEAN              Primary_Partition,
        BOOLEAN              Allocate_From_Start,
        CARDINAL32 * _Seg16  Error_Code
);