summaryrefslogtreecommitdiffstats
path: root/qapi
diff options
context:
space:
mode:
authorJohn Snow <jsnow@redhat.com>2016-01-22 15:50:58 -0500
committerTimothy Pearson <tpearson@raptorengineering.com>2019-11-29 19:29:54 -0600
commit395baef63fff1d5b5761219d6b4c1f23c76ff924 (patch)
treefa80163f2bdbd7d97fd3bbd5609048a21f62a607 /qapi
parent2a42a37abfb8365d91c89405905262660f971094 (diff)
downloadhqemu-395baef63fff1d5b5761219d6b4c1f23c76ff924.zip
hqemu-395baef63fff1d5b5761219d6b4c1f23c76ff924.tar.gz
fdc: Throw an assertion on misconfigured fd_formats table
pick_geometry is a convoluted function that makes it difficult to tell at a glance what QEMU's current behavior for choosing a floppy drive type is when it can't quite identify the diskette. The code iterates over all entries in the candidate geometry table ("fd_formats") and if our specific drive type matches a row in the table, then either "match" is set to that entry (an exact match) and the loop exits, or "first_match" will be non-negative (the first such entry that shares the same drive type), and the loop continues. If our specific drive type is NONE, then all drive types in the candidate geometry table are considered. After iteration, if "match" was not set, we fall back to "first match". This means that either "match" was set, or we exited the loop without an exact match, in which case: - If drive type is NONE, the default is truly fd_formats[0], a 1.44MB type, because "first_match" will always get set to the first item. - If drive type is not NONE, pick_geometry's iteration was fussier and only looked at rows that matched our drive type. However, since all possible drive types are represented in the table, we still know that "first match" was set. - If drive type is not NONE and the fd_formats table lists no options for our drive type, we choose fd_formats[1], an incomprehensibly bizarre choice that can never happen anyway. Correct this: If first_match is -1, it can ONLY mean we didn't edit our fd_formats table correctly. Throw an assertion instead. Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 1453495865-9649-6-git-send-email-jsnow@redhat.com
Diffstat (limited to 'qapi')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud