Or ask the Linux kernel for the geometry. Linux uses the LBA entries in the partition table only, so there's no issue for Linux. Or guess a geometry from the partition table. Or let a user specify the desired geometry explicitly. I guess they can get it from the BIOS, so this solution is usable, but a nicer one is preferable.
Geometry is a problem of the past.
It does not exist anymore. DOS does not exist anymore. I'm beginning to agree. If anyone's using DOS still, then their computer is so ancient it won't have the new BIOS stuff anyway, so it won't make a difference. It seems we don't need to care about aligning partitions to cylinder boundaries, so there's no need for geometry at all, for Windows 95 and up.