From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH] qemu: qemu_fopen_fd: differentiate between reader and writer user Date: Sun, 12 Oct 2008 20:17:38 +0200 Message-ID: <48F23F42.10405@redhat.com> References: <1223829030-14962-1-git-send-email-uril@qumranet.com> <48F22BF1.3000608@redhat.com> <48F23D4D.2050709@codemonkey.ws> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Uri Lublin , kvm@vger.kernel.org To: Anthony Liguori Return-path: Received: from mx2.redhat.com ([66.187.237.31]:45698 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753828AbYJLSRs (ORCPT ); Sun, 12 Oct 2008 14:17:48 -0400 In-Reply-To: <48F23D4D.2050709@codemonkey.ws> Sender: kvm-owner@vger.kernel.org List-ID: 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. -- Do not meddle in the internals of kernels, for they are subtle and quick to panic.