On Wed, Sep 07, 2011 at 09:51:00AM -0400, Stefan Berger wrote: > On 09/07/2011 07:23 AM, Michael S. Tsirkin wrote: > >On Tue, Sep 06, 2011 at 10:45:34PM -0400, Stefan Berger wrote: > >>On 09/04/2011 12:38 PM, Michael S. Tsirkin wrote: > >>>On Thu, Sep 01, 2011 at 11:00:56PM -0400, Stefan Berger wrote: > >>> > >>>initstate_fd=<file descriptor> > >>>initstate_base64=on/off (or base64/bin if you really expect > >>> more formats in the future) > >>> > >>>and use qemu routines to get the fd so they can be > >>>passed through the monitor later ... > >>> > >>I suppose you mean monitor_get_fd(). That functions seems to only be > >>used by net.c so far and if understand the chain of functions > >>correctly that are called with the monitor as parameter it helps in > >>hotplugging net devices ? For the TPM I would like to *not* have > >>support for hotplugging since that device is supposed to be soldered > >>to the motherboard and needs to be initialized through a command > >>sequence by the (v)BIOS, so it has to be present early on during > >>machine startup. > >> > >> Stefan > >Fine, but let's reuse common functions and save code duplication, > >especially parsing functions. > > > When parsing the command line there's no Monitor being passed > around. So in case of 'net' net_handle_fd_param() (net.c) ends up > not invoking monitor_get_fd() but the else branch where strtol() is > used to convert the fd. Now I won't call net_handle_fd_param() but > could introduce tpm_handle_fd_param() also calling strtol(). Though > that would not make me call a common function but duplicating the > code there... I don't know of another function handling the parsing > of fd's. Is there one ? If not, I'll also just fall back to using > strtol(). > > Stefan
We can create a common function and use that for net and tpm. -- MST