From 9e6636c72d8d6f0605e23ed820c8487686882b12 Mon Sep 17 00:00:00 2001 From: Stefan Hajnoczi Date: Wed, 25 Apr 2012 16:51:01 +0100 Subject: block: use Error mechanism instead of -errno for block_job_set_speed() There are at least two different errors that can occur in block_job_set_speed(): the job might not support setting speeds or the value might be invalid. Use the Error mechanism to report the error where it occurs. Signed-off-by: Stefan Hajnoczi Acked-by: Kevin Wolf Signed-off-by: Luiz Capitulino --- block_int.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'block_int.h') diff --git a/block_int.h b/block_int.h index e70a33e0c2..e042676be3 100644 --- a/block_int.h +++ b/block_int.h @@ -79,7 +79,7 @@ typedef struct BlockJobType { const char *job_type; /** Optional callback for job types that support setting a speed limit */ - int (*set_speed)(BlockJob *job, int64_t value); + void (*set_speed)(BlockJob *job, int64_t value, Error **errp); } BlockJobType; /** @@ -375,11 +375,12 @@ void block_job_complete(BlockJob *job, int ret); * block_job_set_speed: * @job: The job to set the speed for. * @speed: The new value + * @errp: Error object. * * Set a rate-limiting parameter for the job; the actual meaning may * vary depending on the job type. */ -int block_job_set_speed(BlockJob *job, int64_t value); +void block_job_set_speed(BlockJob *job, int64_t value, Error **errp); /** * block_job_cancel: -- cgit v1.2.3