* [Qemu-devel] [PATCH v2 0/1] vdi: Use a literal number of bytes for @ 2018-11-04 18:09 Leonid Bloch 2018-11-04 18:09 ` [Qemu-devel] [PATCH v2 1/1] vdi: Use a literal number of bytes for DEFAULT_CLUSTER_SIZE Leonid Bloch 2018-11-05 14:29 ` [Qemu-devel] [PATCH v2 0/1] vdi: Use a literal number of bytes for Kevin Wolf 0 siblings, 2 replies; 4+ messages in thread From: Leonid Bloch @ 2018-11-04 18:09 UTC (permalink / raw) To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Stefan Weil, Kevin Wolf, Max Reitz, Leonid Bloch Please see the commit message for the rationale. Difference from v1: * Format string is fixed. Leonid Bloch (1): vdi: Use a literal number of bytes for DEFAULT_CLUSTER_SIZE block/vdi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.17.1 ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Qemu-devel] [PATCH v2 1/1] vdi: Use a literal number of bytes for DEFAULT_CLUSTER_SIZE 2018-11-04 18:09 [Qemu-devel] [PATCH v2 0/1] vdi: Use a literal number of bytes for Leonid Bloch @ 2018-11-04 18:09 ` Leonid Bloch 2018-11-04 19:10 ` Stefan Weil 2018-11-05 14:29 ` [Qemu-devel] [PATCH v2 0/1] vdi: Use a literal number of bytes for Kevin Wolf 1 sibling, 1 reply; 4+ messages in thread From: Leonid Bloch @ 2018-11-04 18:09 UTC (permalink / raw) To: qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Stefan Weil, Kevin Wolf, Max Reitz, Leonid Bloch If an expression is used to define DEFAULT_CLUSTER_SIZE, when compiled, it will be embedded as a literal expression in the binary (as the default value) because it is stringified to mark the size of the default value. Now this is fixed by using a defined number to define this value. Signed-off-by: Leonid Bloch <lbloch@janustech.com> --- block/vdi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/block/vdi.c b/block/vdi.c index 6555cffb88..d996793f1c 100644 --- a/block/vdi.c +++ b/block/vdi.c @@ -85,7 +85,7 @@ #define BLOCK_OPT_STATIC "static" #define SECTOR_SIZE 512 -#define DEFAULT_CLUSTER_SIZE (1 * MiB) +#define DEFAULT_CLUSTER_SIZE S_1MiB #if defined(CONFIG_VDI_DEBUG) #define VDI_DEBUG 1 @@ -432,7 +432,7 @@ static int vdi_open(BlockDriverState *bs, QDict *options, int flags, goto fail; } else if (header.block_size != DEFAULT_CLUSTER_SIZE) { error_setg(errp, "unsupported VDI image (block size %" PRIu32 - " is not %" PRIu64 ")", + " is not %" PRIu32 ")", header.block_size, DEFAULT_CLUSTER_SIZE); ret = -ENOTSUP; goto fail; -- 2.17.1 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH v2 1/1] vdi: Use a literal number of bytes for DEFAULT_CLUSTER_SIZE 2018-11-04 18:09 ` [Qemu-devel] [PATCH v2 1/1] vdi: Use a literal number of bytes for DEFAULT_CLUSTER_SIZE Leonid Bloch @ 2018-11-04 19:10 ` Stefan Weil 0 siblings, 0 replies; 4+ messages in thread From: Stefan Weil @ 2018-11-04 19:10 UTC (permalink / raw) To: Leonid Bloch, qemu-devel@nongnu.org Cc: qemu-block@nongnu.org, Kevin Wolf, Max Reitz On 04.11.18 19:09, Leonid Bloch wrote: > If an expression is used to define DEFAULT_CLUSTER_SIZE, when compiled, > it will be embedded as a literal expression in the binary (as the > default value) because it is stringified to mark the size of the default > value. Now this is fixed by using a defined number to define this value. > > Signed-off-by: Leonid Bloch <lbloch@janustech.com> > --- > block/vdi.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/block/vdi.c b/block/vdi.c > index 6555cffb88..d996793f1c 100644 > --- a/block/vdi.c > +++ b/block/vdi.c > @@ -85,7 +85,7 @@ > #define BLOCK_OPT_STATIC "static" > > #define SECTOR_SIZE 512 > -#define DEFAULT_CLUSTER_SIZE (1 * MiB) > +#define DEFAULT_CLUSTER_SIZE S_1MiB > > #if defined(CONFIG_VDI_DEBUG) > #define VDI_DEBUG 1 > @@ -432,7 +432,7 @@ static int vdi_open(BlockDriverState *bs, QDict *options, int flags, > goto fail; > } else if (header.block_size != DEFAULT_CLUSTER_SIZE) { > error_setg(errp, "unsupported VDI image (block size %" PRIu32 > - " is not %" PRIu64 ")", > + " is not %" PRIu32 ")", > header.block_size, DEFAULT_CLUSTER_SIZE); > ret = -ENOTSUP; > goto fail; > "%u" would have be sufficient for printing the DEFAULT_CLUSTER_SIZE (maybe this can be changed when merging this commit), but PRIu32 also works. Reviewed-by: Stefan Weil <sw@weilnetz.de> Thank you, Stefan ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH v2 0/1] vdi: Use a literal number of bytes for 2018-11-04 18:09 [Qemu-devel] [PATCH v2 0/1] vdi: Use a literal number of bytes for Leonid Bloch 2018-11-04 18:09 ` [Qemu-devel] [PATCH v2 1/1] vdi: Use a literal number of bytes for DEFAULT_CLUSTER_SIZE Leonid Bloch @ 2018-11-05 14:29 ` Kevin Wolf 1 sibling, 0 replies; 4+ messages in thread From: Kevin Wolf @ 2018-11-05 14:29 UTC (permalink / raw) To: Leonid Bloch Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org, Stefan Weil, Max Reitz Am 04.11.2018 um 19:09 hat Leonid Bloch geschrieben: > Please see the commit message for the rationale. > > Difference from v1: > * Format string is fixed. Thanks, applied to the block branch. Kevin ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-11-05 14:34 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2018-11-04 18:09 [Qemu-devel] [PATCH v2 0/1] vdi: Use a literal number of bytes for Leonid Bloch 2018-11-04 18:09 ` [Qemu-devel] [PATCH v2 1/1] vdi: Use a literal number of bytes for DEFAULT_CLUSTER_SIZE Leonid Bloch 2018-11-04 19:10 ` Stefan Weil 2018-11-05 14:29 ` [Qemu-devel] [PATCH v2 0/1] vdi: Use a literal number of bytes for Kevin Wolf
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).