[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [PATCH v10 2/9] include: Add a lookup table of sizes
From: |
Leonid Bloch |
Subject: |
Re: [Qemu-block] [PATCH v10 2/9] include: Add a lookup table of sizes |
Date: |
Mon, 24 Sep 2018 16:42:54 +0000 |
On 9/24/18 5:09 PM, Eric Blake wrote:
> On 9/21/18 12:23 PM, Leonid Bloch wrote:
>> Adding a lookup table for the powers of two, with the appropriate size
>> prefixes. This is needed when a size has to be stringified, in which
>> case something like '(1 * KiB)' would become a literal '(1 * (1L << 10))'
>> string. Powers of two are used very often for sizes, so such a table
>> will also make it easier and more intuitive to write them.
>
> Would it be better to provide a generic util function that takes an
> arbitrary runtime value and converts it to a human-readable form?
>
The problem is that the srtingification happens at compile time, and the
literal string is written to qcow2.o (the default value). From here
comes the need for this table. And the added benefit of it are more
concise size notations for power-of-two sizes.
Leonid.
- Re: [Qemu-block] [PATCH v10 1/9] qcow2: Options' documentation fixes, (continued)
[Qemu-block] [PATCH v10 3/9] qcow2: Make sizes more humanly readable, Leonid Bloch, 2018/09/21
[Qemu-block] [PATCH v10 2/9] include: Add a lookup table of sizes, Leonid Bloch, 2018/09/21
[Qemu-block] [PATCH v10 4/9] qcow2: Avoid duplication in setting the refcount cache size, Leonid Bloch, 2018/09/21
[Qemu-block] [PATCH v10 5/9] qcow2: Assign the L2 cache relatively to the image size, Leonid Bloch, 2018/09/21
[Qemu-block] [PATCH v10 6/9] qcow2: Increase the default upper limit on the L2 cache size, Leonid Bloch, 2018/09/21
[Qemu-block] [PATCH v10 7/9] qcow2: Resize the cache upon image resizing, Leonid Bloch, 2018/09/21
[Qemu-block] [PATCH v10 9/9] qcow2: Explicit number replaced by a constant, Leonid Bloch, 2018/09/21
[Qemu-block] [PATCH v10 8/9] qcow2: Set the default cache-clean-interval to 10 minutes, Leonid Bloch, 2018/09/21