summaryrefslogtreecommitdiffstats
path: root/fsdev
diff options
context:
space:
mode:
authorGreg Kurz2019-10-10 11:36:05 +0200
committerGreg Kurz2019-10-10 11:36:05 +0200
commitea52cdd443840448c198fec48e5a9ea5f40564f0 (patch)
treed88cea8dd8a30f705f01e41492a403e37b2c7274 /fsdev
parent9p: Simplify error path of v9fs_device_realize_common() (diff)
downloadqemu-ea52cdd443840448c198fec48e5a9ea5f40564f0.tar.gz
qemu-ea52cdd443840448c198fec48e5a9ea5f40564f0.tar.xz
qemu-ea52cdd443840448c198fec48e5a9ea5f40564f0.zip
fsdev: Add return value to fsdev_throttle_parse_opts()
It is more convenient to use the return value of the function to notify errors, rather than to be tied up setting up the &local_err boilerplate. Signed-off-by: Greg Kurz <groug@kaod.org>
Diffstat (limited to 'fsdev')
-rw-r--r--fsdev/qemu-fsdev-throttle.c4
-rw-r--r--fsdev/qemu-fsdev-throttle.h2
2 files changed, 3 insertions, 3 deletions
diff --git a/fsdev/qemu-fsdev-throttle.c b/fsdev/qemu-fsdev-throttle.c
index fe1d76dc76..5c83a1cc09 100644
--- a/fsdev/qemu-fsdev-throttle.c
+++ b/fsdev/qemu-fsdev-throttle.c
@@ -31,7 +31,7 @@ static void fsdev_throttle_write_timer_cb(void *opaque)
qemu_co_enter_next(&fst->throttled_reqs[true], NULL);
}
-void fsdev_throttle_parse_opts(QemuOpts *opts, FsThrottle *fst, Error **errp)
+int fsdev_throttle_parse_opts(QemuOpts *opts, FsThrottle *fst, Error **errp)
{
throttle_config_init(&fst->cfg);
fst->cfg.buckets[THROTTLE_BPS_TOTAL].avg =
@@ -75,7 +75,7 @@ void fsdev_throttle_parse_opts(QemuOpts *opts, FsThrottle *fst, Error **errp)
fst->cfg.op_size =
qemu_opt_get_number(opts, "throttling.iops-size", 0);
- throttle_is_valid(&fst->cfg, errp);
+ return throttle_is_valid(&fst->cfg, errp) ? 0 : -1;
}
void fsdev_throttle_init(FsThrottle *fst)
diff --git a/fsdev/qemu-fsdev-throttle.h b/fsdev/qemu-fsdev-throttle.h
index c98e2feab5..a21aecddc7 100644
--- a/fsdev/qemu-fsdev-throttle.h
+++ b/fsdev/qemu-fsdev-throttle.h
@@ -26,7 +26,7 @@ typedef struct FsThrottle {
CoQueue throttled_reqs[2];
} FsThrottle;
-void fsdev_throttle_parse_opts(QemuOpts *, FsThrottle *, Error **);
+int fsdev_throttle_parse_opts(QemuOpts *, FsThrottle *, Error **);
void fsdev_throttle_init(FsThrottle *);