All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>
Cc: "Clément Chigot" <chigot@adacore.com>,
	qemu-devel@nongnu.org, hreitz@redhat.com, qemu-block@nongnu.org
Subject: Re: [PATCH 5/5] vvfat: add support for "size" options
Date: Fri, 07 Nov 2025 09:06:28 +0100	[thread overview]
Message-ID: <875xbme06z.fsf@pond.sub.org> (raw)
In-Reply-To: <aQsafmFOrfEmOc0M@redhat.com> (Kevin Wolf's message of "Wed, 5 Nov 2025 10:35:58 +0100")

Kevin Wolf <kwolf@redhat.com> writes:

> Am 05.11.2025 um 08:08 hat Markus Armbruster geschrieben:
>> Kevin Wolf <kwolf@redhat.com> writes:
>> 
>> [...]
>> 
>> > To me it looks a bit like what we really want is an enum for floppy
>> > sizes (though is there any real reason why we have only those two?), but
>> > an arbitrary size for hard disks.
>> >
>> > Without the enum, obviously, users could specify 1440k and that would do
>> > the right thing. Maybe special casing whatever 1.44M and 2.88M result
>> > in and translating them into 1440k and 2880k could be more justifiable
>> > than special casing 1M and 2M, but it would still be ugly.
>> >
>> > Markus, do you have any advice how this should be represented in QAPI?
>> 
>> Still want answers here?
>
> Yes, I'm still not sure how we could best represent both hard disk and
> floppy sizes in vvfat in a way that isn't completely counterintuitive
> for users, that also isn't just arbitrary magic and that works on the
> command line.
>
> Unless the need for different sizes has gone away, but I don't think we
> found any other solution for the problem that would not require a
> configurable disk/file system size?

Let me recap the problem.  Please correct my misunderstandings, if any.

Hard disks can have almost arbitrary sizes.  Almost, because it still
needs to be a multiple of the block size.

Floppy disks have one of a small set of well-known sizes.

I vaguely recall that we generally derive the device's actual size from
the backend's size.

Some devices reject certain sizes.  For instance, SD cards require a
power of 2.

Most devices seem to accept anything.  I can create an IDE, SCSI, or
floppy disk backed by a raw image of one byte.  I have no idea how it
would behave.

As is, the vvfat backend can only do certain sizes, configurable with
parameters @floppy and @fat-type.  They work for floppies, but not for
SD cards, since they're not powers of two.

Instead of deriving size and CHS from @floppy and @fat-type, Clément
proposes to specify the size (and derive fat-type and CHS[*]?).

In QMP, we specify the size in bytes.  This is fine regardless of size;
management applications don't mind sending things like "size": 1474560.

In HMP and the command line, big byte sizes are inconvenient.  That's
why we support suffixes there.  size=256M is a fine way to pick an SD
card's size.

The size suffixes seem inconvenient for floppies, though.  For instance,
2 heads * 80 tracks * 18 sectors * 512 bytes = 1474560 bytes = 1440
KiBytes, but size=1.44M does not work: 1.44 MiBytes = 1509949.44 Bytes.
However, size=1440K does.

This leads me to suggest to simply stick to numeric size, and use
appropriate suffixes.  These are obvious enough for anything but
floppies.  So advise users "use K for floppies"[**].

If this isn't good enough, I can help you explore fancier parts of QAPI,
such as alternate types.




[*] I guess we could support specifying an optional fat-type in addition
to size, and derive only CHS then.

[**] Even for a hypothetical floppy with an odd number of 512 byte
sectors: .5K works, because .5 * 1024 is an integer.



  parent reply	other threads:[~2025-11-07  8:07 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-03  7:57 [PATCH 0/5] block/vvfat: introduce "size" option Clément Chigot
2025-09-03  7:57 ` [PATCH 1/5] vvfat: introduce no-mbr option Clément Chigot
2025-10-23 18:20   ` Kevin Wolf
2025-10-29  8:37     ` Clément Chigot
2025-10-29 10:56       ` Kevin Wolf
2025-10-29 13:44         ` Clément Chigot
2025-09-03  7:57 ` [PATCH 2/5] vvfat: move fat_type check prior to size setup Clément Chigot
2025-10-23 18:39   ` Kevin Wolf
2025-10-29 13:48     ` Clément Chigot
2025-10-29 13:58       ` BALATON Zoltan
2025-10-29 16:05         ` Kevin Wolf
2025-09-03  7:57 ` [PATCH 3/5] vvfat: add a define for SECTOR_SIZE Clément Chigot
2025-10-23 18:47   ` Kevin Wolf
2025-09-03  7:57 ` [PATCH 4/5] vvfat: move size parameters within driver structure Clément Chigot
2025-09-03  7:57 ` [PATCH 5/5] vvfat: add support for "size" options Clément Chigot
2025-10-23 19:29   ` Kevin Wolf
2025-10-24  8:30     ` Markus Armbruster
2025-10-24  9:23       ` Clément Chigot
2025-10-27 12:09         ` Markus Armbruster
2025-10-28 14:54           ` Clément Chigot
2025-10-31  7:46             ` Markus Armbruster
2025-10-31  9:47               ` Clément Chigot
2025-10-31 11:56                 ` Kevin Wolf
2025-10-31 13:07                   ` Clément Chigot
2025-11-05  7:06                     ` Markus Armbruster
2025-11-05  7:08     ` Markus Armbruster
2025-11-05  9:35       ` Kevin Wolf
2025-11-05 10:15         ` Clément Chigot
2025-11-07  8:06         ` Markus Armbruster [this message]
2025-09-15  8:47 ` [PATCH 0/5] block/vvfat: introduce "size" option Clément Chigot
2025-10-07  7:43 ` Clément Chigot
2025-11-12 12:38 ` Richard W.M. Jones
2025-11-12 13:09   ` Clément Chigot
2025-11-13  8:41   ` Kevin Wolf
2025-11-13  9:13     ` Richard W.M. Jones
2025-11-13 13:13       ` Kevin Wolf

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=875xbme06z.fsf@pond.sub.org \
    --to=armbru@redhat.com \
    --cc=chigot@adacore.com \
    --cc=hreitz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.