Avi Kivity wrote:
Anthony Liguori wrote:
The proposed patch is less that ideal IMO as it introduces
limitations on what you can do with a file. An alternative
implementation would add a read/write mode to the buffer, based on
the last access type. When switching from read to write, we drop the
buffer, and when switching from write to read, we flush it and then
drop it. This is more complex but results in a cleaner API.
I would think a better solution would introduce two buffers, one for
read and one for write. That way, you can have a proper bidirectional
stream.
Complexity goes way up. Now you need to intercept reads that go to the
write buffer, and vice versa.
Yeah, Uri: instead of passing an argument to qemu_fopen_ops, it may be
better to direct the cases where we do a write and set a flag. Then in
the fflush() function, only do the put_buffer if the is_write flag is set.
Also, having checks and the read and write functions to determine if the
is_write flag is set along with whether buf_index > 0 that fprintf()'d
and aborted would be good for debugging.
Regards,
Anthony Liguori
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html