Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MGfpU-0005qo-AU for qemu-devel@nongnu.org; Tue, 16 Jun 2009 17:04:28 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MGfpP-0005pk-Qv for qemu-devel@nongnu.org; Tue, 16 Jun 2009 17:04:27 -0400 Received: from [199.232.76.173] (port=46219 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MGfpP-0005pX-IH for qemu-devel@nongnu.org; Tue, 16 Jun 2009 17:04:23 -0400 Received: from smtp1-g21.free.fr ([212.27.42.1]:49803) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MGfpO-0000vt-Gg for qemu-devel@nongnu.org; Tue, 16 Jun 2009 17:04:23 -0400 Received: from smtp1-g21.free.fr (localhost [127.0.0.1]) by smtp1-g21.free.fr (Postfix) with ESMTP id 315A6940051 for ; Tue, 16 Jun 2009 23:04:18 +0200 (CEST) Received: from jcd-laptop.localnet (unknown [78.235.240.156]) by smtp1-g21.free.fr (Postfix) with ESMTP id 121249401A4 for ; Tue, 16 Jun 2009 23:04:16 +0200 (CEST) From: "Jean-Christophe Dubois" Subject: Re: [Qemu-devel] [PATCH] avoid compilation warning/errors on up to date compilers Date: Tue, 16 Jun 2009 22:01:35 +0200 References: <200906160530.37086.jcd@tribudubois.net> <20090616150343.GA4350@kos.to> <20090616182359.GA17188@miranda.arrow> In-Reply-To: <20090616182359.GA17188@miranda.arrow> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200906162201.36012.jcd@tribudubois.net> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Le mardi 16 juin 2009 20:23:59 Stuart Brady, vous avez =E9crit : > On Tue, Jun 16, 2009 at 06:03:43PM +0300, Riku Voipio wrote: > > Which tree against did you make these changes? the qemu-ndb.c bit didn't > > apply against HEAD. It is whatever you get when cloning the qemu tree with "git clone=20 git://git.savannah.nongnu.org/qemu.git" as proposed on the savannah web sit= e. > > Also, there are some whitespace/tab issues. See the > > CODING_STYLE doc. Functionally I can verify it removes compiler warnings > > when using a modenr glibc (2.9). I'll have a look at the CODING_STYLE but I was under the impression I didn'= t=20 use the tab stuff. I'll double check. > Unfortunately, some of the changes don't look right. > > For instance: > > > - read(s->fd, &bitmap_entry, 1); > > > + if (read(s->fd, &bitmap_entry, 1) !=3D 1) > > > + return -1; // not allocated > > If read() returns -1 and errno is set to EINTR, then the read() should > be reattempted. I can agree with this. However you will have to admit that even if this=20 particular error case is not handled as it should be it is still a big=20 improvement as there was no error handling at all previously. The main goal= =20 here is to allow that qemu compilation on up to date systems like Ubuntu 9.= 04=20 (my case). > > > - write(cow_fd, &cow_header, sizeof(cow_header)); > > > + if (write(cow_fd, &cow_header, sizeof(cow_header)) =3D=3D > > > sizeof(cow_header)) + goto fail; > > Doesn't write(...) =3D=3D sizeof(cow_header) indicate success? OOPS, my bad. I'll fix it. > Also, I gather partial reads/writes need to be supported. Once again, previously there was no error handling at all. What I propose i= s=20 not perfect but at least it does some error handling and allow the qemu=20 compilation on my system. Supporting partial read/write would certainly require a lot more code=20 refactoring.