On 05/15/2013 11:25 AM, Osier Yang wrote:
Since 0d70656afded, it starts to access the sysfs files to build
the qemu command line (by virSCSIDeviceGetSgName, which is to find
out the scsi generic device name by adpater:bus:target:unit), there
is no way to work around, qemu wants to see the scsi generic device
like "/dev/sg6" anyway.
And there might be other places which need to access sysfs files
when building qemu command line in future.
Then instead of the very specific callback function you've added, why
not add a "sysfsroot" that would be accessed by any commandline-building
function that needed access to sysfs?
This patch is needed to fix a regression, so this may not be the best
time to be discussing what is the optimum design, but we should try to
keep it as simple as possible, and having a callback object that must be
completely filled in by any caller seems complicated (I notice you
didn't check for the possibility of the callback pointers being NULL).
Has anyone enumerated exactly what are the actions currently performed
inside qemuBuildCommandLine() that shouldn't be there?