Re: ioctl to get partitions infos

Andries Brouwer (aebr@win.tue.nl)
Thu, 17 Apr 2003 14:23:28 +0200


On Thu, Apr 17, 2003 at 12:01:32PM +0200, Ludovic Drolez wrote:

> As I need more than 'cat /proc/partitions', I wondered if there's an
> ioctl in 2.4 or 2.5 which will kindly return me all the information the
> kernel knows about partition (start sector, length, type) ? (pls, don't
> say that I need the parse the partition table myself ;-( )

There are ioctls that will tell you start sector and length.
HDIO_GETGEO gives you start
BLKGETSIZE gives you length

I do not know what you mean by type, but the kernel doesn't know it.

(A partition may be found from a DOS-type or BSD-type or Amiga-type
or ... partition table. Each has its own ways of indicating a type
of partition. A partition can also be created by ioctl where no
partition table is involved. Then there is no type at all.
No type is used by the kernel, roughly speaking.)

Andries

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/