From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KqDvO-0001or-4q for qemu-devel@nongnu.org; Wed, 15 Oct 2008 17:28:58 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KqDvN-0001oV-JH for qemu-devel@nongnu.org; Wed, 15 Oct 2008 17:28:57 -0400 Received: from [199.232.76.173] (port=49050 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KqDvN-0001oQ-8d for qemu-devel@nongnu.org; Wed, 15 Oct 2008 17:28:57 -0400 Received: from wr-out-0506.google.com ([64.233.184.232]:3611) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KqDvN-0001X0-3g for qemu-devel@nongnu.org; Wed, 15 Oct 2008 17:28:57 -0400 Received: by wr-out-0506.google.com with SMTP id c46so1781540wra.18 for ; Wed, 15 Oct 2008 14:28:55 -0700 (PDT) Message-ID: <5d6222a80810151428x206cd069ka815c4cf776b7ae6@mail.gmail.com> Date: Wed, 15 Oct 2008 19:28:55 -0200 From: "Glauber Costa" Subject: Re: [Qemu-devel] Re: [PATCH 05/21] turn info kqemu into generic info accelerator In-Reply-To: <20081015.152317.-795139439.imp@bsdimp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <1224107718-19128-1-git-send-email-glommer@redhat.com> <1224107718-19128-6-git-send-email-glommer@redhat.com> <48F651B0.8030502@us.ibm.com> <20081015.152317.-795139439.imp@bsdimp.com> Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: aliguori@us.ibm.com, jan.kiszka@siemens.com, glommer@redhat.com, jes@sgi.com, avi@qumranet.com, gcosta@redhat.com, dmitry.baryshkov@siemens.com On Wed, Oct 15, 2008 at 7:23 PM, M. Warner Losh wrote: > In message: <48F651B0.8030502@us.ibm.com> > Anthony Liguori writes: > : Glauber Costa wrote: > : > From: Glauber Costa > : > > : > Yet another accel field: info. > : > From this point on, "info kqemu" is no more. "info accelerator" should > : > be used instead. > : > > : > Signed-off-by: Glauber Costa > : > --- > : > accel.c | 6 ++++++ > : > accel.h | 6 ++++++ > : > kqemu.c | 24 ++++++++++++++++++++++++ > : > monitor.c | 36 +++++++++++++----------------------- > : > 4 files changed, 49 insertions(+), 23 deletions(-) > : > > : > diff --git a/accel.c b/accel.c > : > index 6776244..466fe67 100644 > : > --- a/accel.c > : > +++ b/accel.c > : > @@ -8,6 +8,11 @@ int _accel_nop(void) > : > return 0; > : > } > : > > : > +int noaccel_info(CPUState *env, char *buf) > : > +{ > : > + return sprintf(buf, "no accelerator present.\n"); > : > > : > : sprintf() is evil and never should be used. You should refactor this > : patch for the info callback to take a buffer size and use snprintf(). > > why use sprintf for this? Accelerators probably want to display something on their own. Returning a pointer to a string seems even worse to me. > > Warner > > > -- Glauber Costa. "Free as in Freedom" http://glommer.net "The less confident you are, the more serious you have to act."