Received: from eggs.gnu.org ([208.118.235.92]:45565) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S7UUz-00072g-Gv for qemu-devel@nongnu.org; Tue, 13 Mar 2012 12:22:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S7UUx-0008Nc-Ns for qemu-devel@nongnu.org; Tue, 13 Mar 2012 12:22:57 -0400 Received: from isrv.corpit.ru ([86.62.121.231]:34457) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S7UUx-0008NK-GW for qemu-devel@nongnu.org; Tue, 13 Mar 2012 12:22:55 -0400 From: Michael Tokarev Date: Tue, 13 Mar 2012 20:22:51 +0400 Message-Id: <1331655771-10868-1-git-send-email-mjt@msgid.tls.msk.ru> In-Reply-To: <1331655521-5986-1-git-send-email-mjt@msgid.tls.msk.ru> References: <1331655521-5986-1-git-send-email-mjt@msgid.tls.msk.ru> Subject: [Qemu-devel] [PATCH (trivial)] no need to use bdrv_pread() in format guessing code when we can use bdrv_read() directly List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Stefan Hajnoczi , Michael Tokarev [Sorry - sent the wrong patch, should have been BDRV_SECTOR_SIZE, not BDRV_BLOCK_SIZE....] 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 --- block.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/block.c b/block.c index b88ee90..b3af1f6 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_SECTOR_SIZE); bdrv_delete(bs); if (ret < 0) { *pdrv = NULL; -- 1.7.9.1