qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH (trivial)] no need to use bdrv_pread() in format guessing code when we can use bdrv_read() directly
@ 2012-03-13 16:18 Michael Tokarev
  2012-03-13 16:22 ` Michael Tokarev
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Tokarev @ 2012-03-13 16:18 UTC (permalink / raw)
  To: qemu-devel; +Cc: Stefan Hajnoczi, Michael Tokarev

block.c:find_image_format() calls bdrv_pread() to read first 2048
bytes from the device to guess its format.  This function can use
bdrv_read() directly since the the read is done on sector boundary.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 block.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/block.c b/block.c
index b88ee90..6b5bcaf 100644
--- a/block.c
+++ b/block.c
@@ -469,7 +469,7 @@ static int find_image_format(const char *filename, BlockDriver **pdrv)
         return ret;
     }
 
-    ret = bdrv_pread(bs, 0, buf, sizeof(buf));
+    ret = bdrv_read(bs, 0, buf, sizeof(buf) / BDRV_BLOCK_SIZE);
     bdrv_delete(bs);
     if (ret < 0) {
         *pdrv = NULL;
-- 
1.7.9.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-03-14  9:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-13 16:18 [Qemu-devel] [PATCH (trivial)] no need to use bdrv_pread() in format guessing code when we can use bdrv_read() directly Michael Tokarev
2012-03-13 16:22 ` Michael Tokarev
2012-03-14  9:25   ` Stefan Hajnoczi

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).