DCMD_BLK_PARTENTRY

Get the partition entry

Synopsis:

#include <sys/dcmd_blk.h>

#define DCMD_BLK_PARTENTRY    __DIOF(_DCMD_BLK, 1, struct partition_entry)

Arguments to devctl():

Argument Value
filedes A file descriptor that you obtained by opening the device.
dcmd DCMD_BLK_PARTENTRY
dev_data_ptr A pointer to a struct partition_entry that the device can fill in (see below)
n_bytes sizeof(struct partition_entry)
dev_info_ptr NULL

Description:

This command gets the partition entry for the device associated with the given file descriptor. It's used by x86 disk partitions with harddisk-based filesystems.

Input:

None.

Output:

The struct partition_entry (or partition_entry_t) is defined in <sys/disk.h> as follows:

typedef struct partition_entry {
    unsigned char   boot_ind,
                    beg_head,
                    beg_sector,
                    beg_cylinder,
                    os_type,
                    end_head,
                    end_sector,
                    end_cylinder;
    uint32_t        part_offset,
                    part_size;
} partition_entry_t;

The members include:

boot_ind
0x80 if the partition is bootable, 0x00 if it isn't.
beg_head
The beginning head number.
beg_sector
The beginning sector number.
beg_cylinder
The beginning cylinder number.
os_type
The partition type; see Partitions in the Filesystems chapter of the System Architecture guide.
end_head
The end head number.
end_sector
The end sector number.
end_cylinder
The end cylinder number.
part_offset
The offset of the partition, in bytes.
part_size
The number of sectors in the partition.

Example:

partition_entry_t *prt;

memset(&prt, 0, sizeof(prt));
if(devctl(fd, DCMD_BLK_PARTENTRY, prt, sizeof(*prt), 0) == EOK) {
   ...
}

See also:

DCMD_BLK_PART_DESCRIPTION

devctl() in the QNX Neutrino C Library Reference

fdisk in the QNX Neutrino Utilities Reference