[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 08/15] curl: Use bdrv_open options instead of fi
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH 08/15] curl: Use bdrv_open options instead of filename |
Date: |
Mon, 15 Apr 2013 13:57:52 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130402 Thunderbird/17.0.5 |
On 04/12/2013 02:48 PM, Kevin Wolf wrote:
> Signed-off-by: Kevin Wolf <address@hidden>
> ---
> block/curl.c | 153
> +++++++++++++++++++++++++++++++++++++++--------------------
> 1 file changed, 102 insertions(+), 51 deletions(-)
>
> @@ -369,29 +364,78 @@ static int curl_open(BlockDriverState *bs, const char
> *filename,
> ra_val = ra + 1;
> ra -= strlen(RA_OPTSTR) - 1;
> *ra = '\0';
> - s->readahead_size = atoi(ra_val);
Good riddance - atoi() is evil because it can't detect overflow.
> - break;
> - } else {
> - break;
> + qdict_put(options, "readahead",
> qstring_from_str(ra_val));
So now we just pass the string on to the option parser,...
> +static QemuOptsList runtime_opts = {
> + .name = "curl",
> + .head = QTAILQ_HEAD_INITIALIZER(runtime_opts.head),
> + .desc = {
> + {
> + .name = "url",
> + .type = QEMU_OPT_STRING,
> + .help = "URL to open",
> + },
> + {
> + .name = "readahead",
> + .type = QEMU_OPT_SIZE,
> + .help = "Readahead size",
...and this new option lets QEMU_OPT_SIZE detect crazy strings that were
previously treated as '0' by the old atoi(). You should probably
mention this bug fix in the commit message as being intentional.
> @@ -568,63 +614,68 @@ static int64_t curl_getlength(BlockDriverState *bs)
> }
>
> static BlockDriver bdrv_http = {
> - .format_name = "http",
> - .protocol_name = "http",
> + .format_name = "http",
> + .protocol_name = "http",
>
> - .instance_size = sizeof(BDRVCURLState),
> - .bdrv_file_open = curl_open,
> - .bdrv_close = curl_close,
> - .bdrv_getlength = curl_getlength,
> + .instance_size = sizeof(BDRVCURLState),
> + .bdrv_parse_filename = curl_parse_filename,
> + .bdrv_file_open = curl_open,
> + .bdrv_close = curl_close,
> + .bdrv_getlength = curl_getlength,
>
> - .bdrv_aio_readv = curl_aio_readv,
> + .bdrv_aio_readv = curl_aio_readv,
On this patch, you reindented ALL callbacks to the same width. But in
6/15 and 7/15, you reindented only the callbacks in the
.bdrv_parse_filename section. You should probably be consistent between
patches (I actually prefer indenting the entire BlockDriver
initialization consistently, as done in this patch, but didn't ding
patch 6 or 7 at the time because they looked innocuous enough in isolation).
Since I only called out whitespace issues (and even then, only for
commits other than this) and a weakness in the commit message, the code
itself deserves:
Reviewed-by: Eric Blake <address@hidden>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- Re: [Qemu-devel] [PATCH 03/15] block: Enable filename option, (continued)
- [Qemu-devel] [PATCH 04/15] raw-posix: Use bdrv_open options instead of filename, Kevin Wolf, 2013/04/12
- [Qemu-devel] [PATCH 05/15] raw-win32: Use bdrv_open options instead of filename, Kevin Wolf, 2013/04/12
- [Qemu-devel] [PATCH 06/15] blkdebug: Use bdrv_open options instead of filename, Kevin Wolf, 2013/04/12
- [Qemu-devel] [PATCH 07/15] blkverify: Use bdrv_open options instead of filename, Kevin Wolf, 2013/04/12
- [Qemu-devel] [PATCH 08/15] curl: Use bdrv_open options instead of filename, Kevin Wolf, 2013/04/12
- Re: [Qemu-devel] [PATCH 08/15] curl: Use bdrv_open options instead of filename,
Eric Blake <=
- [Qemu-devel] [PATCH 09/15] gluster: Use bdrv_open options instead of filename, Kevin Wolf, 2013/04/12
- [Qemu-devel] [PATCH 10/15] iscsi: Use bdrv_open options instead of filename, Kevin Wolf, 2013/04/12
- [Qemu-devel] [PATCH 11/15] rbd: Use bdrv_open options instead of filename, Kevin Wolf, 2013/04/12
- [Qemu-devel] [PATCH 12/15] sheepdog: Use bdrv_open options instead of filename, Kevin Wolf, 2013/04/12
- [Qemu-devel] [PATCH 13/15] vvfat: Use bdrv_open options instead of filename, Kevin Wolf, 2013/04/12