Get the partition entry
#include <sys/dcmd_blk.h> #define DCMD_BLK_PARTENTRY __DIOF(_DCMD_BLK, 1, struct partition_entry)
| 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 |
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.
None.
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:
partition_entry_t *prt;
memset(&prt, 0, sizeof(prt));
if(devctl(fd, DCMD_BLK_PARTENTRY, prt, sizeof(*prt), 0) == EOK) {
...
}