Message ID | 1348675011-8794-10-git-send-email-pbonzini@redhat.com |
---|---|
State | New |
Headers | show |
Am 26.09.2012 17:56, schrieb Paolo Bonzini: > The imperative will be used for the QMP command. > > Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> I would still be glad if we found a better name. Having two functions block_job_complete() and block_job_completed() sounds like a great source for confusion. Kevin
On 09/27/2012 08:30 AM, Kevin Wolf wrote: > Am 26.09.2012 17:56, schrieb Paolo Bonzini: >> The imperative will be used for the QMP command. >> >> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> > > I would still be glad if we found a better name. Having two functions > block_job_complete() and block_job_completed() sounds like a great > source for confusion. > > Kevin > If I understand correctly, what we have is: block_job_completed(): cleans up when a job is done block_job_complete(): requests that a block job be completed How about renaming both of them, respectively, to: block_job_cleanup(): cleans up when a job is done block_job_request_completion(): requests that a block job be completed I think that would remove any ambiguity.
Il 27/09/2012 22:31, Jeff Cody ha scritto: > > block_job_completed(): cleans up when a job is done It also raises a BLOCK_JOB_COMPLETED event. > block_job_complete(): requests that a block job be completed > > How about renaming both of them, respectively, to: > > block_job_cleanup(): cleans up when a job is done > block_job_request_completion(): requests that a block job be completed > > I think that would remove any ambiguity. I'll keep this patch for now, since it doesn't introduce any ambiguity yet. I could rename block_job_complete to block_job_request_completion as you suggested, but it would be inconsistent with the QMP command block-job-complete, so there are downsides as well. Paolo
diff --git a/block/stream.c b/block/stream.c index 57e4be7..a8f585a 100644 --- a/block/stream.c +++ b/block/stream.c @@ -84,7 +84,7 @@ static void coroutine_fn stream_run(void *opaque) s->common.len = bdrv_getlength(bs); if (s->common.len < 0) { - block_job_complete(&s->common, s->common.len); + block_job_completed(&s->common, s->common.len); return; } @@ -167,7 +167,7 @@ wait: } qemu_vfree(buf); - block_job_complete(&s->common, ret); + block_job_completed(&s->common, ret); } static void stream_set_speed(BlockJob *job, int64_t speed, Error **errp) diff --git a/blockjob.c b/blockjob.c index 6c65521..884bd2b 100644 --- a/blockjob.c +++ b/blockjob.c @@ -71,7 +71,7 @@ void *block_job_create(const BlockJobType *job_type, BlockDriverState *bs, return job; } -void block_job_complete(BlockJob *job, int ret) +void block_job_completed(BlockJob *job, int ret) { BlockDriverState *bs = job->bs; diff --git a/blockjob.h b/blockjob.h index a2bacba..a0d1b5c 100644 --- a/blockjob.h +++ b/blockjob.h @@ -132,14 +132,14 @@ void *block_job_create(const BlockJobType *job_type, BlockDriverState *bs, void block_job_sleep_ns(BlockJob *job, QEMUClock *clock, int64_t ns); /** - * block_job_complete: + * block_job_completed: * @job: The job being completed. * @ret: The status code. * * Call the completion function that was registered at creation time, and * free @job. */ -void block_job_complete(BlockJob *job, int ret); +void block_job_completed(BlockJob *job, int ret); /** * block_job_set_speed:
The imperative will be used for the QMP command. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> --- block/stream.c | 4 ++-- blockjob.c | 2 +- blockjob.h | 4 ++-- 3 file modificati, 5 inserzioni(+), 5 rimozioni(-)