[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 04/47] block: add block_job_query
From: |
Kevin Wolf |
Subject: |
Re: [Qemu-devel] [PATCH 04/47] block: add block_job_query |
Date: |
Tue, 31 Jul 2012 10:47:34 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120605 Thunderbird/13.0 |
Am 30.07.2012 17:05, schrieb Paolo Bonzini:
> Il 30/07/2012 16:47, Kevin Wolf ha scritto:
>>>> +BlockJobInfo *block_job_query(BlockJob *job)
>>>> +{
>>>> + BlockJobInfo *info = g_new(BlockJobInfo, 1);
>>>> + info->type = g_strdup(job->job_type->job_type);
>>>> + info->device = g_strdup(bdrv_get_device_name(job->bs));
>>>> + info->len = job->len;
>>>> + info->offset = job->offset;
>>>> + info->speed = job->speed;
>>>> + return info;
>>>> +}
>> Why did you convert the initialisation to separate statement? If you
>> really want to do this, I think using g_new0 would be safer now, but I
>> actually like compound literals better.
>
> Later on I will have some more initialization beyond the list of fields,
> so I preferred an explicit list. I can change it back if you prefer.
What I'm really interested in is having zero-initialisation for any not
explicitly initialised fields, just to be on the safe side. You can do
that with g_new0() or with compound literals, that's a matter of taste.
My taste happens to prefer the latter, but I won't criticise a patch
based on taste as long as it's doing the same thing functionally.
Kevin
- [Qemu-devel] [PATCH 02/47] qerror/block: introduce QERR_BLOCK_JOB_NOT_ACTIVE, (continued)
[Qemu-devel] [PATCH 05/47] block: add support for job pause/resume, Paolo Bonzini, 2012/07/24
[Qemu-devel] [PATCH 04/47] block: add block_job_query, Paolo Bonzini, 2012/07/24
[Qemu-devel] [PATCH 06/47] qmp: add block-job-pause and block-job-resume, Paolo Bonzini, 2012/07/24
[Qemu-devel] [PATCH 03/47] block: move job APIs to separate files, Paolo Bonzini, 2012/07/24
[Qemu-devel] [PATCH 07/47] qemu-iotests: add test for pausing a streaming operation, Paolo Bonzini, 2012/07/24
[Qemu-devel] [PATCH 08/47] block: rename block_job_complete to block_job_completed, Paolo Bonzini, 2012/07/24
[Qemu-devel] [PATCH 10/47] block: move BlockdevOnError declaration to QAPI, Paolo Bonzini, 2012/07/24
[Qemu-devel] [PATCH 09/47] block: rename BlockErrorAction, BlockQMPEventAction, Paolo Bonzini, 2012/07/24
[Qemu-devel] [PATCH 12/47] block: sort BlockDeviceIoStatus errors by severity, Paolo Bonzini, 2012/07/24
[Qemu-devel] [PATCH 13/47] block: introduce block job error, Paolo Bonzini, 2012/07/24