[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH V8 14/14] Allow to provide inital TPM state

From: Michael S. Tsirkin
Subject: Re: [Qemu-devel] [PATCH V8 14/14] Allow to provide inital TPM state
Date: Sun, 4 Sep 2011 19:38:14 +0300
User-agent: Mutt/1.5.21 (2010-09-15)

On Thu, Sep 01, 2011 at 11:00:56PM -0400, Stefan Berger wrote:
> >Do we really have to hand-craft file reading?
> >If not too large, we can just allocate that
> >and do a single fread call?
> Yes, I could do that, too.
> >Or, we rely on glib now - can we use
> >g_io_channel_read_to_end () or something like that?
> >
> >
> GIOStatus   g_io_channel_read_to_end        (GIOChannel *channel,
>                                              gchar **str_return,
>                                              gsize *length,
>                                              GError **error);
> I'd rather not use it. Presumably it uses g_malloc() to internally
> allocate the str_return. However, the buffer we are allocating in
> this function is given to the libtpms, which in turn will call plain
> free() on it. I don't want this to cause a problem if not g_free()
> is called on this buffer.

Well, copy the data and malloc, or do something else,
must be easier than this manual loop.

> >>+
> >Separate options for fd and for file mode would be better.
> >
> initstate_fd=base64:<file descriptor>
> initstate_fd=bin:<file descriptor>
> initstate=base64:<path to file>
> initstate=bin:<path to file>
> Along these lines?


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 ...

> Yes, that's a problem. Above would require bin:file:<path to blob>
> to be understood.
>    Stefan

So avoid it. Give each option it's own flag.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]