At 04/19/2011 03:43 PM, KAMEZAWA Hiroyuki Write:
qemudDomainAttachDeviceFlags()/qemudDomainDetachFlags()/
qemudDomainUpdateDeviceFlags() has similar logics and copied codes.
This patch series tries to unify them to use shared code when it can.
At first, clean up At(De)tachDeviceFlags() and devide it into functions.
By this, this patch pulls out shared components between functions.
Based on patch series by Eric Blake, I added some modification as
switch-case.
From: Eric Blake <eblake(a)redhat.com>
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu(a)jp.fujitsu.com>
* src/qemu/qemu_driver.c
(qemudDomainAttachDeviceFlags) : pulled out to qemudDomainModifyDeviceFlags()
(qemudDomainModifyDeviceFlags) : impelements a generic codes for modify domain.
(qemudDomainAttachDeviceFlagsLive) : codes for attaching devices to domain
in live, no changes in logic from old code.
(qemudDomainDetachDeviceFlagsLive) : codes for detaching devices to domain
in live, no changes in logic from old code.
You introduce some functions qemudDomainAttachXXXLive() and qemudDomainDetachXXXLive()
to make qemudDomainAttachDeviceFlags() and qemudDomainDetachDeviceFlags() to be small.
You should log them in commit messages.
---
src/qemu/qemu_driver.c | 429 ++++++++++++++++++++++++++----------------------
1 files changed, 234 insertions(+), 195 deletions(-)