From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48985) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XEbZ6-0001rz-0G for qemu-devel@nongnu.org; Tue, 05 Aug 2014 06:02:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XEbZ0-00028R-HS for qemu-devel@nongnu.org; Tue, 05 Aug 2014 06:01:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35550) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XEbZ0-00028H-3B for qemu-devel@nongnu.org; Tue, 05 Aug 2014 06:01:50 -0400 Date: Tue, 5 Aug 2014 11:01:46 +0100 From: "Richard W.M. Jones" Message-ID: <20140805100146.GA1302@redhat.com> References: <1407152873-16772-1-git-send-email-rjones@redhat.com> <1407152873-16772-2-git-send-email-rjones@redhat.com> <874mxrl0hz.fsf@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <874mxrl0hz.fsf@linaro.org> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v5 1/2] loader: Add load_image_gzipped function. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alex =?iso-8859-1?Q?Benn=E9e?= Cc: peter.maydell@linaro.org, peter.crosthwaite@xilinx.com, qemu-devel@nongnu.org On Tue, Aug 05, 2014 at 10:57:26AM +0100, Alex Benn=C3=A9e wrote: >=20 > Richard W.M. Jones writes: >=20 > > As the name suggests this lets you load a ROM/disk image that is > > gzipped. It is uncompressed before storing it in guest memory. > > > > Signed-off-by: Richard W.M. Jones > > > + /* Is it a gzip-compressed file? */ > > + if (len < 2 || > > + compressed_data[0] !=3D '\x1f' || > > + compressed_data[1] !=3D '\x8b') { > > + goto out; > > + } > >=20 > Hmm serves me right for not compiling this first. I had to explicit > literals to get this to compile: >=20 > Modified hw/core/loader.c > diff --git a/hw/core/loader.c b/hw/core/loader.c > index e773aab..83136e8 100644 > --- a/hw/core/loader.c > +++ b/hw/core/loader.c > @@ -599,8 +599,8 @@ int load_image_gzipped(const char *filename, hwaddr= addr, uint64_t max_sz) > =20 > /* Is it a gzip-compressed file? */ > if (len < 2 || > - compressed_data[0] !=3D '\x1f' || > - compressed_data[1] !=3D '\x8b') { > + compressed_data[0] !=3D 0x1f || > + compressed_data[1] !=3D 0x8b ) { > goto out; > } >=20 > Otherwise I get: > hw/core/loader.c: In function =E2=80=98load_image_gzipped=E2=80=99: > hw/core/loader.c:603:9: error: comparison is always true due to limited= range of data type [-Werror=3Dtype-limits] > compressed_data[1] !=3D '\x8b') { This is probably because I only compiled and tested this on aarch64 where char =3D=3D unsigned char (not signed char). I'll fix this in v6, thanks. Rich. --=20 Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rj= ones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://people.redhat.com/~rjones/virt-top