fdisk informations

Which c function should I call to get information about partition on flash
disk. I need to know which partition is bootable. Should I try to open
/dev/hd0.

OS Start End _Number Size Boot
name type Cylinder Cylinder Cylinders Blocks

  1. QNX ( 77) 0 245 246 62944 30 MB *
  2. QNY ( 78) 246 489 244 62464 30 MB
  3. ------ (—) ----- ----- ----- -------- -----
  4. ------ (—) ----- ----- ----- -------- -----

Thanks.
Rejean Senecal

Rejean Senecal <rsenecal@oerlikon.ca-no-spam> wrote:

Which c function should I call to get information about partition on
flash disk. I need to know which partition is bootable. Should I try
to open /dev/hd0.

Look in <sys/disk.h> and <sys/dcmd_blk.h> and the DCMD_BLK_PARTENTRY
devctl() and the partition_entry_t type. The “boot_ind” field indicates
if the partition is bootable or not. But since this devctl() works
on a partition, the trick is to discover/open all partitions on the
disk (/dev/hd0t77 etc) - this can be done. Hmm, assuming that parsing
the output of “fdisk /dev/hd0 show” looking for the ‘*’ is no good, you
could go directly to the raw disk itself (read block 0 of /dev/hd0, if
the disk is partitioned then there is an array[4] of these partition
structures at offset 0x1BE, you want non-0 “os_type” and “boot_ind”).