From: Christoph Hellwig <hch@lst.de>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 1/3] dmg: fix reading of uncompressed chunks
Date: Fri, 7 May 2010 16:55:33 +0200 [thread overview]
Message-ID: <20100507145533.GA14245@lst.de> (raw)
In-Reply-To: <20100507145519.GA14157@lst.de>
When dmg_read_chunk encounters an uncompressed chunk it currently
calls read without any previous adjustment of the file postion.
This seems very wrong, and the "reference" implementation in
dmg2img does a search to the same offset as done in the various
compression cases, so do the same here.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Index: qemu-kevin/block/dmg.c
===================================================================
--- qemu-kevin.orig/block/dmg.c 2010-05-03 13:15:34.112253995 +0200
+++ qemu-kevin/block/dmg.c 2010-05-03 13:17:40.696287171 +0200
@@ -239,7 +239,8 @@ static inline int dmg_read_chunk(BDRVDMG
return -1;
break; }
case 1: /* copy */
- ret = read(s->fd, s->uncompressed_chunk, s->lengths[chunk]);
+ ret = pread(s->fd, s->uncompressed_chunk, s->lengths[chunk],
+ s->offsets[chunk]);
if (ret != s->lengths[chunk])
return -1;
break;
next prev parent reply other threads:[~2010-05-07 14:55 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-07 14:55 [Qemu-devel] [PATCH 0/3] dmg updates Christoph Hellwig
2010-05-07 14:55 ` Christoph Hellwig [this message]
2010-05-07 14:56 ` [Qemu-devel] [PATCH 2/3] dmg: use pread Christoph Hellwig
2010-05-10 10:07 ` Kevin Wolf
2010-05-10 20:20 ` Christoph Hellwig
2010-05-11 8:00 ` Kevin Wolf
2010-05-12 14:31 ` [Qemu-devel] [PATCH 2/3 v2] " Christoph Hellwig
2010-05-07 14:56 ` [Qemu-devel] [PATCH 3/3] dmg: use qemu block API Christoph Hellwig
2010-05-12 14:31 ` [Qemu-devel] [PATCH 3/3 v2] " Christoph Hellwig
2010-05-12 15:51 ` Kevin Wolf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100507145533.GA14245@lst.de \
--to=hch@lst.de \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).