]> git.proxmox.com Git - mirror_qemu.git/commit
fdc: rework pick_geometry
authorJohn Snow <jsnow@redhat.com>
Fri, 22 Jan 2016 20:51:03 +0000 (15:51 -0500)
committerJohn Snow <jsnow@redhat.com>
Mon, 25 Jan 2016 19:35:24 +0000 (14:35 -0500)
commitf31937aa8cc144f8196de91be6ec81390da92b1e
tree658cb8f204bd55d1424d0602f26101465c947cba
parent109c17bc208c09a72d9c6c237f3f7b84c6ac91a4
fdc: rework pick_geometry

This one is the crazy one.

fd_revalidate currently uses pick_geometry to tell if the diskette
geometry has changed upon an eject/insert event, but it won't allow us
to insert a 1.44MB diskette into a 2.88MB drive. This is inflexible.

The new algorithm applies a new heuristic to guessing disk geometries
that allows us to switch diskette types as long as the physical size
matches before falling back to the old heuristic.

The old one is roughly:
 - If the size (sectors) and type matches, choose it.
 - Fall back to the first geometry that matched our type.

The new one is:
 - If the size (sectors) and type matches, choose it.
 - If the size (sectors) and physical size match, choose it.
 - Fall back to the first geometry that matched our type.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 1453495865-9649-11-git-send-email-jsnow@redhat.com
hw/block/fdc.c