]> git.proxmox.com Git - mirror_qemu.git/commitdiff
fsdev: Add return value to fsdev_throttle_parse_opts()
authorGreg Kurz <groug@kaod.org>
Thu, 10 Oct 2019 09:36:05 +0000 (11:36 +0200)
committerGreg Kurz <groug@kaod.org>
Thu, 10 Oct 2019 09:36:05 +0000 (11:36 +0200)
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>
fsdev/qemu-fsdev-throttle.c
fsdev/qemu-fsdev-throttle.h
hw/9pfs/9p-local.c

index fe1d76dc76e74535805a372e3d3edfccf5163a72..5c83a1cc09c3521dd1f23aba8a8eff3ee7f31753 100644 (file)
@@ -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)
index c98e2feab553e3f5dac794ab21a7da6b8fffd7c9..a21aecddc73406d50d18c31abc2b9887281adb5a 100644 (file)
@@ -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 *);
 
index 6f7309f4e69127b3cf3cb3fc5cfd0eccf6a499dd..5c7f4cd9c7b081675201f8abe42e050b079b23d3 100644 (file)
@@ -1511,8 +1511,7 @@ static int local_parse_opts(QemuOpts *opts, FsDriverEntry *fse, Error **errp)
         return -1;
     }
 
-    fsdev_throttle_parse_opts(opts, &fse->fst, &local_err);
-    if (local_err) {
+    if (fsdev_throttle_parse_opts(opts, &fse->fst, &local_err)) {
         error_propagate_prepend(errp, local_err,
                                 "invalid throttle configuration: ");
         return -1;