Il 22/04/2013 18:49, Anthony Liguori ha scritto: >> We've been adding fields to types since 0.15, sometimes in the middle of >> a struct (since 1.2). > > You can safely add fields to the end of a struct.
For QEMU->user structs it is. For user->QEMU structs you need to add a sizeof() at the beginning, or ensure that everything is heap-allocated (and zero-initialized). At that point you could also use structs to pass arguments to the functions (in the C client API) that execute a QMP command. That's similar to having keyword arguments in C. > Well this is all well and good in abstract, in practice, we want a new > screendump command anyway. > > It'd be *much* nicer to return the screenshot data via the QMP session > instead of writing it to a file. So let's take the opportunity to fix > the command. That's debatable... the "nicest" way could also be to pass a pipe fd and retrieve the dump from that fd. That's quite easy to do with fdsets. The choice is between implementing SCM_RIGHTS sendfd and a base64 decoder. > We can also introduce a "format" parameter to allow specifying formats > othe than PPM. True, but I'm not sure we want to go there. We'd need to add support for options like JPG quality factor etc. Paolo