<< Previous | Next >>

fat_PartitionDevice

int fat_PartitionDevice( mbr_dev *dev, int pnum );

Description

This function partitions the device by modifying the master boot record (MBR), which could destroy access to information already on the device. The partition information contained in the specified mbr_dev structure must be meaningful, and the sizes and start positions must make sense (no overlapping, etc.). If this is not true, you will get an -EINVAL error code. The device being partitioned must already have been formatted and enumerated.

This function will only allow changes to one partition at a time, and this partition must either not exist or be of a FAT type.

The validity of the new partition will be verified before any changes are done to the device. All other partition information in the device structure (for those partitions that are not being modified) must match the values currently existing on the MBR. The type given for the new partition must either be zero (if you are deleting the partition) or a FAT type.

You may not use this function to create or modify a non-FAT partition.

Parameters

dev
Pointer to the device structure of the device to be partitioned.

pnum
Partition number of the partition being modified.

Return value

0: success.
-EIO: device I/O error.
-EINVAL: pnum or device structure is invalid.
-EUNFORMAT: the device is not formatted.
-EBADPART: the partition is a non-FAT partition.
-EPERM: the partition is mounted.
-EBUSY: the device is busy (Only if non-blocking).

Library

FAT.LIB

See Also

fat_FormatDevice, fat_EnumDevice, fat_FormatPartition


Dynamic C Functions << Previous | Next >> rabbit.com