From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:44180) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UcUQf-00022V-6W for qemu-devel@nongnu.org; Wed, 15 May 2013 01:39:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UcUQe-0006Oy-4N for qemu-devel@nongnu.org; Wed, 15 May 2013 01:39:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]:7789) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UcUQd-0006On-SS for qemu-devel@nongnu.org; Wed, 15 May 2013 01:39:08 -0400 Message-ID: <51931F75.8040107@redhat.com> Date: Wed, 15 May 2013 07:39:01 +0200 From: Gerd Hoffmann MIME-Version: 1.0 References: <1368589953-22455-1-git-send-email-lilei@linux.vnet.ibm.com> In-Reply-To: <1368589953-22455-1-git-send-email-lilei@linux.vnet.ibm.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] chardev: Get filename for new qapi backend List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Lei Li Cc: aliguori@us.ibm.com, qemu-devel@nongnu.org On 05/15/13 05:52, Lei Li wrote: > This patch add the filename when the new qapi backend init from opts. > > Commit 2c5f488293c7d0cd095635c74157c2526e2c4947 add support for > qapi-based chardev initialization, but miss the filename of the > char device as below: > > (qemu) info chardev > parallel0: filename=(null) > serial0: filename=(null) > compat_monitor0: filename=(null) > @@ -3276,6 +3276,7 @@ CharDriverState *qemu_chr_new_from_opts(QemuOpts *opts, > ChardevReturn *ret = NULL; > const char *id = qemu_opts_id(opts); > const char *bid = NULL; > + char *filename = g_strdup(qemu_opt_get(opts, "backend")); > > if (qemu_opt_get_bool(opts, "mux", 0)) { > bid = g_strdup_printf("%s-base", id); > @@ -3308,6 +3309,7 @@ CharDriverState *qemu_chr_new_from_opts(QemuOpts *opts, > } > > chr = qemu_chr_find(id); > + chr->filename = filename; That should happen in qmp_chardev_add(), so filename is set consistently for every chardev no matter how it gets created. Take care to not overwrite filename, some functions (qmp_chardev_open_socket for example) do set chr->filename already. Maybe it's better to put that into the individual qmp_chardev_open_* functions anyway. cheers, Gerd