next up previous contents index
Next: 21.5.2 diskpart_read_func: read a Up: 21.5 API reference Previous: 21.5 API reference

21.5.1 diskpart_get_partition: initialize an array of partition entries

 

SYNOPSIS

#include <oskit/diskpart/diskpart.h>

int diskpart_get_partition(void *driver_info, int (*diskpart_read_func)(), struct diskpart *array, int array_size, int disk_size);

DESCRIPTION

This function initializes an array of struct diskpart entries. The caller must provide a pointer to a struct diskpart array, and a function to read the disk.

PARAMETERS

driver_info
A pointer to an initialized structure of user-defined type which is passed unmodified to diskpart_read_func.
diskpart_read_func
A function pointer provided by the user which can read a sector given driver_info.
array
Array of struct diskpart.
array_size
integer containing the number of allocated entries in the array.
disk_size
Size of the whole disk, in sectors.

RETURNS

Returns an integer count of the number of partition entries that were filled by the library. If there were more partitions found than space available, this will be array_size. Empty partitions (unused entries in a BSD disklabel, for example) occupy an entry the same as `used' entries.

For example, a PC-DOS partition with a single filled entry would still report 4 partitions, as that is the size of the DOS partition table.

RELATED INFORMATION

diskpart_read_func



University of Utah Flux Research Group