From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:38424) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QMvvo-00010D-HJ for qemu-devel@nongnu.org; Thu, 19 May 2011 01:37:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QMvvn-0008Im-HU for qemu-devel@nongnu.org; Thu, 19 May 2011 01:37:56 -0400 Received: from mail-yi0-f45.google.com ([209.85.218.45]:40536) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QMvvn-0008Ic-DW for qemu-devel@nongnu.org; Thu, 19 May 2011 01:37:55 -0400 Received: by yib19 with SMTP id 19so921741yib.4 for ; Wed, 18 May 2011 22:37:54 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <4DD41301.5060804@linux.vnet.ibm.com> References: <1305661431-21289-1-git-send-email-jvrao@linux.vnet.ibm.com> <1305661431-21289-7-git-send-email-jvrao@linux.vnet.ibm.com> <4DD41301.5060804@linux.vnet.ibm.com> Date: Thu, 19 May 2011 06:37:54 +0100 Message-ID: From: Stefan Hajnoczi Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [V2 06/25] [virtio-9p] coroutines for readlink List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Venkateswararao Jujjuri Cc: qemu-devel@nongnu.org On Wed, May 18, 2011 at 7:42 PM, Venkateswararao Jujjuri wrote: > On 05/18/2011 02:43 AM, Stefan Hajnoczi wrote: >> >> On Tue, May 17, 2011 at 8:43 PM, Venkateswararao Jujjuri (JV) >> =A0wrote: >>> >>> Signed-off-by: Venkateswararao Jujjuri " >>> --- >>> =A0Makefile.objs =A0 =A0 =A0 =A0 =A0 =A0| =A0 =A02 +- >>> =A0hw/9pfs/cofs.c =A0 =A0 =A0 =A0 =A0 | =A0 42 >>> ++++++++++++++++++++++++++++++++++++++++++ >>> =A0hw/9pfs/virtio-9p-coth.h | =A0 =A01 + >>> =A0hw/9pfs/virtio-9p.c =A0 =A0 =A0| =A0 27 ++++----------------------- >>> =A0hw/9pfs/virtio-9p.h =A0 =A0 =A0| =A0 =A03 ++- >>> =A05 files changed, 50 insertions(+), 25 deletions(-) >>> =A0create mode 100644 hw/9pfs/cofs.c >>> >>> diff --git a/Makefile.objs b/Makefile.objs >>> index 96f6a24..36005bb 100644 >>> --- a/Makefile.objs >>> +++ b/Makefile.objs >>> @@ -297,7 +297,7 @@ hw-obj-$(CONFIG_SOUND) +=3D $(sound-obj-y) >>> =A09pfs-nested-$(CONFIG_VIRTFS) =3D virtio-9p.o virtio-9p-debug.o >>> =A09pfs-nested-$(CONFIG_VIRTFS) +=3D =A0virtio-9p-local.o virtio-9p-xat= tr.o >>> =A09pfs-nested-$(CONFIG_VIRTFS) +=3D =A0 virtio-9p-xattr-user.o >>> virtio-9p-posix-acl.o >>> -9pfs-nested-$(CONFIG_VIRTFS) +=3D virtio-9p-coth.o >>> +9pfs-nested-$(CONFIG_VIRTFS) +=3D virtio-9p-coth.o cofs.o >>> >>> =A0hw-obj-$(CONFIG_REALLY_VIRTFS) +=3D $(addprefix 9pfs/, $(9pfs-nested= -y)) >>> =A0$(addprefix 9pfs/, $(9pfs-nested-y)): QEMU_CFLAGS+=3D$(GLIB_CFLAGS) >>> diff --git a/hw/9pfs/cofs.c b/hw/9pfs/cofs.c >>> new file mode 100644 >>> index 0000000..6d94673 >>> --- /dev/null >>> +++ b/hw/9pfs/cofs.c >>> @@ -0,0 +1,42 @@ >>> + >>> +/* >>> + * Virtio 9p backend >>> + * >>> + * Copyright IBM, Corp. 2011 >>> + * >>> + * Authors: >>> + * =A0Aneesh Kumar K.V >>> + * >>> + * This work is licensed under the terms of the GNU GPL, version 2. = =A0See >>> + * the COPYING file in the top-level directory. >>> + * >>> + */ >>> + >>> +#include "fsdev/qemu-fsdev.h" >>> +#include "qemu-thread.h" >>> +#include "qemu-coroutine.h" >>> +#include "virtio-9p-coth.h" >>> + >>> +int v9fs_co_readlink(V9fsState *s, V9fsString *path, V9fsString *buf) >>> +{ >>> + =A0 =A0int err; >>> + =A0 =A0ssize_t len; >>> + =A0 =A0V9fsString tbuf; >>> + >>> + =A0 =A0tbuf.data =3D qemu_malloc(PATH_MAX); >> >> Why introduce tbuf when the buf is available? =A0You end up having to >> copy back fields at the end of the function and load from an >> uninitialized address (tbuf.size) in the error case. > > tbuf is introduced for re-entrent purpose. > We should be calling v9fs_string_init() on this though. I see no issue here and no safety added by using a local variable. Can you explain what you're trying to do? Stefan