[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v8 4/6] hmp: create a throttle initialization functi
From: |
Pradeep Jagadeesh |
Subject: |
[Qemu-devel] [PATCH v8 4/6] hmp: create a throttle initialization function for code reusability |
Date: |
Tue, 29 Aug 2017 10:23:05 -0400 |
This patch creates a throttle initialization function to maximize the
code reusability. The same code is also used by fsdev.
Acked-by: Dr. David Alan Gilbert <address@hidden>
Signed-off-by: Pradeep Jagadeesh <address@hidden>
---
hmp.c | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/hmp.c b/hmp.c
index fd80dce..2dbfb80 100644
--- a/hmp.c
+++ b/hmp.c
@@ -1758,20 +1758,27 @@ void hmp_change(Monitor *mon, const QDict *qdict)
hmp_handle_error(mon, &err);
}
+static void hmp_initialize_io_throttle(IOThrottle *iot, const QDict *qdict)
+{
+ iot->bps = qdict_get_int(qdict, "bps");
+ iot->bps_rd = qdict_get_int(qdict, "bps_rd");
+ iot->bps_wr = qdict_get_int(qdict, "bps_wr");
+ iot->iops = qdict_get_int(qdict, "iops");
+ iot->iops_rd = qdict_get_int(qdict, "iops_rd");
+ iot->iops_wr = qdict_get_int(qdict, "iops_wr");
+}
+
void hmp_block_set_io_throttle(Monitor *mon, const QDict *qdict)
{
Error *err = NULL;
+ IOThrottle *iothrottle;
BlockIOThrottle throttle = {
.has_device = true,
.device = (char *) qdict_get_str(qdict, "device"),
- .bps = qdict_get_int(qdict, "bps"),
- .bps_rd = qdict_get_int(qdict, "bps_rd"),
- .bps_wr = qdict_get_int(qdict, "bps_wr"),
- .iops = qdict_get_int(qdict, "iops"),
- .iops_rd = qdict_get_int(qdict, "iops_rd"),
- .iops_wr = qdict_get_int(qdict, "iops_wr"),
};
+ iothrottle = qapi_BlockIOThrottle_base(&throttle);
+ hmp_initialize_io_throttle(iothrottle, qdict);
qmp_block_set_io_throttle(&throttle, &err);
hmp_handle_error(mon, &err);
}
--
1.8.3.1
- [Qemu-devel] [PATCH V8 5/6] fsdev: QMP interface for throttling, (continued)
- [Qemu-devel] [PATCH V8 5/6] fsdev: QMP interface for throttling, Pradeep Jagadeesh, 2017/08/07
- [Qemu-devel] [PATCH v8 0/6] fsdev: qmp interface for io throttling, Pradeep Jagadeesh, 2017/08/29
- [Qemu-devel] [PATCH v8 3/6] throttle: move out function to reuse the code, Pradeep Jagadeesh, 2017/08/29
- [Qemu-devel] [PATCH v8 5/6] fsdev: hmp interface for throttling, Pradeep Jagadeesh, 2017/08/29
- [Qemu-devel] [PATCH v8 6/6] fsdev: QMP interface for throttling, Pradeep Jagadeesh, 2017/08/29
- [Qemu-devel] [PATCH v8 1/6] throttle: factor out duplicate code, Pradeep Jagadeesh, 2017/08/29
- [Qemu-devel] [PATCH v8 2/6] qmp: Create IOThrottle structure, Pradeep Jagadeesh, 2017/08/29
- [Qemu-devel] [PATCH v8 4/6] hmp: create a throttle initialization function for code reusability,
Pradeep Jagadeesh <=
- Re: [Qemu-devel] [PATCH v8 0/6] fsdev: qmp interface for io throttling, Alberto Garcia, 2017/08/29
- Re: [Qemu-devel] [PATCH v8 0/6] fsdev: qmp interface for io throttling, Alberto Garcia, 2017/08/30
- Re: [Qemu-devel] [PATCH v8 0/6] fsdev: qmp interface for io throttling, Pradeep Jagadeesh, 2017/08/30
- Re: [Qemu-devel] [PATCH v8 0/6] fsdev: qmp interface for io throttling, Alberto Garcia, 2017/08/30
- Re: [Qemu-devel] [PATCH v8 0/6] fsdev: qmp interface for io throttling, Pradeep Jagadeesh, 2017/08/30
- Re: [Qemu-devel] [PATCH v8 0/6] fsdev: qmp interface for io throttling, Alberto Garcia, 2017/08/30
- Re: [Qemu-devel] [PATCH v8 0/6] fsdev: qmp interface for io throttling, Pradeep Jagadeesh, 2017/08/30
- Re: [Qemu-devel] [PATCH v8 0/6] fsdev: qmp interface for io throttling, Alberto Garcia, 2017/08/31
- Re: [Qemu-devel] [PATCH v8 0/6] fsdev: qmp interface for io throttling, Pradeep Jagadeesh, 2017/08/31