From: Kevin Wolf <kwolf@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: pbonzini@redhat.com, aliguori@us.ibm.com, qemu-devel@nongnu.org,
stefanha@linux.vnet.ibm.com
Subject: Re: [Qemu-devel] [PATCH 04/32] vvfat: Do not clobber the user's geometry
Date: Wed, 04 Jul 2012 17:23:52 +0200 [thread overview]
Message-ID: <4FF46008.1080404@redhat.com> (raw)
In-Reply-To: <1340984094-5451-5-git-send-email-armbru@redhat.com>
Am 29.06.2012 17:34, schrieb Markus Armbruster:
> vvfat creates a virtual VFAT filesystem with a certain logical
> geometry that depends on its options. It sets the "geometry hint" to
> this geometry. It is the only block driver to do this.
>
> The geometry hint is about about *physical* geometry, and used only by
> certain hard disk device models.
>
> vvfat's hint is normally invisible for device models, because
> bdrv_open() puts a raw format on top of vvfat's fat protocol. That
> raw format is where drive_init() puts the user's geometry (if any),
> and where the device model gets it from.
>
> Nobody complained, because the default physical geometry is the same
> as vvfat's logical geometry:
>
> opts LCHS def. PCHS
> 1024,16,63 same
> :32: 1024,16,63 same
> :16: 1024,16,63 same
> :12: 64,16,63 same
>
> Except when you specify :floppy:
>
> opts LCHS def. PCHS
> :floppy: 80, 2,36 5,16,63
> :32:floppy: 80, 2,36 5,16,63
> :16:floppy: 80, 2,36 5,16,63
> :12:floppy: 80, 2,18 2,16,63
>
> Silly thing to do for use with a hard disk.
>
> However, the "raw" format can be suppressed by adding an
> redundant-looking "format=vvfat" to "file=fat:FOO". Then, vvfat's
> hint clobbers the user's geometry, i.e. -drive options cyls, heads,
> secs get silently ignored. Don't do that.
>
> No change without format=vvfat. With it, the user's hard disk
> geometry (-drive options cyls, heads, secs) is now obeyed, and the
> default hard disk geometry with :floppy: now matches the one without
> format=vvfat.
>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
For some values of "obeyed". If I understand correctly, the user defined
geometry will indeed by visible for the device emulation now, but this
still doesn't mean that vvfat also provides an image that matches this
geometry. Not sure if it is a good idea to allow such mismatches.
> @@ -1067,19 +1074,16 @@ DLOG(if (stderr == NULL) {
> else
> dirname += i+1;
>
> - bs->total_sectors=bs->cyls*bs->heads*bs->secs;
> + bs->total_sectors = cyls * heads * secs;
>
> - if(init_directories(s, dirname))
> + if (init_directories(s, dirname, heads, secs)) {
> return -1;
> + }
>
> s->sector_count = s->faked_sectors + s->sectors_per_cluster*s->cluster_count;
>
> if(s->first_sectors_number==0x40)
> - init_mbr(s);
> - else {
> - /* MS-DOS does not like to know about CHS (?). */
> - bs->heads = bs->cyls = bs->secs = 0;
> - }
> + init_mbr(s, cyls, heads, secs);
You can add braces here while touching the code.
Kevin
next prev parent reply other threads:[~2012-07-04 15:24 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1340984094-5451-1-git-send-email-armbru@redhat.com>
[not found] ` <1340984094-5451-19-git-send-email-armbru@redhat.com>
2012-07-02 12:55 ` [Qemu-devel] [PATCH 18/32] hd-geometry: Switch to uint32_t to match BlockConf Stefan Hajnoczi
2012-07-02 13:07 ` Andreas Färber
2012-07-02 14:15 ` Markus Armbruster
2012-07-02 14:34 ` Stefan Hajnoczi
2012-07-03 19:11 ` Blue Swirl
2012-07-03 20:15 ` Andreas Färber
2012-07-04 16:19 ` Paolo Bonzini
2012-07-04 16:36 ` Eric Blake
2012-07-05 18:37 ` Blue Swirl
2012-07-05 18:30 ` Blue Swirl
[not found] ` <1340984094-5451-9-git-send-email-armbru@redhat.com>
[not found] ` <CAAu8pHsKC6QMrhjUADiXT8DUrhy9HzbkN8pbYeWjM2aAE38ZwQ@mail.gmail.com>
[not found] ` <m3k3ypmjqu.fsf@blackfin.pond.sub.org>
2012-07-03 18:40 ` [Qemu-devel] [PATCH 08/32] hd-geometry: Move disk geometry guessing back from block.c Blue Swirl
2012-07-04 8:24 ` Kevin Wolf
[not found] ` <1340984094-5451-4-git-send-email-armbru@redhat.com>
[not found] ` <CAAu8pHtQORnuc2G8DiWTt1QcWOKbp7L8WJ=P7HMMZCNV7L-NRQ@mail.gmail.com>
2012-07-04 15:17 ` [Qemu-devel] [PATCH 03/32] vvfat: Fix partition table Kevin Wolf
2012-07-05 9:23 ` Markus Armbruster
2012-07-05 9:55 ` Kevin Wolf
2012-07-05 11:10 ` Markus Armbruster
2012-07-05 11:14 ` Kevin Wolf
[not found] ` <1340984094-5451-5-git-send-email-armbru@redhat.com>
2012-07-04 15:23 ` Kevin Wolf [this message]
2012-07-04 16:25 ` [Qemu-devel] [PATCH 04/32] vvfat: Do not clobber the user's geometry Paolo Bonzini
2012-07-05 7:06 ` Kevin Wolf
2012-07-05 9:16 ` Markus Armbruster
2012-07-05 11:13 ` Markus Armbruster
[not found] ` <1340984094-5451-6-git-send-email-armbru@redhat.com>
2012-07-05 8:29 ` [Qemu-devel] [PATCH 05/32] qtest: Tidy up temporary files properly Kevin Wolf
2012-07-05 9:27 ` Markus Armbruster
[not found] ` <1340984094-5451-14-git-send-email-armbru@redhat.com>
2012-07-05 9:16 ` [Qemu-devel] [PATCH 13/32] hd-geometry: Clean up confusing use of prior translation hint Kevin Wolf
2012-07-05 9:28 ` Markus Armbruster
[not found] ` <1340984094-5451-23-git-send-email-armbru@redhat.com>
2012-07-05 11:33 ` [Qemu-devel] [PATCH 22/32] qtest: Cover qdev properties for disk geometry Kevin Wolf
2012-07-05 12:08 ` Markus Armbruster
[not found] ` <1340984094-5451-33-git-send-email-armbru@redhat.com>
2012-07-05 15:27 ` [Qemu-devel] [PATCH 32/32] Relax IDE CHS limits from 16383, 16, 63 to 65535, 16, 255 Kevin Wolf
2012-07-05 16:20 ` Markus Armbruster
2012-07-05 16:39 ` Markus Armbruster
2012-07-06 8:50 ` Kevin Wolf
2012-07-11 13:10 ` Markus Armbruster
2012-07-06 14:50 ` Alexander Graf
2012-07-06 18:15 ` Markus Armbruster
2012-07-06 6:57 [Qemu-devel] [PATCH 00/32] Disk geometry cleanup Markus Armbruster
2012-07-06 6:57 ` [Qemu-devel] [PATCH 04/32] vvfat: Do not clobber the user's geometry Markus Armbruster
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4FF46008.1080404@redhat.com \
--to=kwolf@redhat.com \
--cc=aliguori@us.ibm.com \
--cc=armbru@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@linux.vnet.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).