On 06/04/2012 11:01 AM, Kevin Wolf wrote:
Am 04.06.2012 15:10, schrieb Corey Bryant:This sample server opens image files and passes the fds to QEMU. The paths for two image files are passed as parameters, the first being the boot image, and the second being an image to be hot-attached. The server will open the files and pass the fds to QEMU in one of two ways: 1) Over the command line (using -drive file=/dev/fd/X) or 2) Via the QMP monitor with the getfd command (using SCM_RIGHTS) followed by drive_add (using file=/dev/fd/X) and then device_add. Usage: gcc -Wall -o test-fd-passing test-fd-passing.c -L/usr/local/lib -ljson ./test-fd-passing /path/hda.img /path/hdb.img Note: This requires json-c and json-c-devel packages. Signed-off-by: Corey Bryant<[email protected]> --- test-fd-passing.c | 321 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 321 insertions(+) create mode 100644 test-fd-passing.cIs this meant to be applied or just for reference?
This was just for reference. It was the majority of my code (unit test) so I figured I'd share it. :)
Maybe we can make a proper test case out of it that runs during make check? Would probably require that the json-c dependency is dropped, though. Maybe we should rewrite it in Python, as we already have QMP bindings for that (and there are already tests that use them).
I won't promise anything but if I get a chance to convert to a Python test I will.
-- Regards, Corey
