From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47256) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WihPo-0003vN-PS for qemu-devel@nongnu.org; Fri, 09 May 2014 05:48:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WihPi-0007nj-FD for qemu-devel@nongnu.org; Fri, 09 May 2014 05:48:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49956) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WihPi-0007nR-8E for qemu-devel@nongnu.org; Fri, 09 May 2014 05:48:22 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s499mLRa004083 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 9 May 2014 05:48:21 -0400 From: Markus Armbruster Date: Fri, 9 May 2014 11:48:13 +0200 Message-Id: <1399628898-3241-1-git-send-email-armbru@redhat.com> Subject: [Qemu-devel] [PATCH 0/5] Clean up around bdrv_getlength() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, stefanha@redhat.com Issues addressed in this series: * BlockDriver method bdrv_getlength() generally returns -errno, but some implementations return -1 instead. Fix them [PATCH 1]. * Frequent conversions between sectors and bytes complicate the code needlessly. Clean up some [PATCH 2+3]. * bdrv_getlength() always returns a multiple of BDRV_SECTOR_SIZE, but some places appear to be confused about that, and align the result up or down. Don't [PATCH 4]. * bdrv_get_geometry() hides errors. Don't use it in places where errors should be detected [PATCH 5]. Issues not addressed: * There are quite a few literals left in the code where BDRV_SECTOR_SIZE, BDRV_SECTOR_BITS or BDRV_SECTOR_MASK should be used instead. * Error handling is missing in places, but it's not always obvious whether errors can actually happen, and if yes, how to handle them. Markus Armbruster (5): raw-posix: Fix raw_getlength() to always return -errno on error block: New bdrv_nb_sectors() block: Use bdrv_nb_sectors() when sectors, not bytes are wanted block: Drop superfluous aligning of bdrv_getlength()'s value block: Avoid bdrv_get_geometry() where errors should be detected block-migration.c | 9 +++-- block.c | 81 ++++++++++++++++++++++++-------------------- block/qapi.c | 14 +++++--- block/qcow2.c | 3 +- block/raw-posix.c | 28 ++++++++++++---- block/vmdk.c | 5 ++- include/block/block.h | 1 + qemu-img.c | 93 ++++++++++++++++++++++++++++++++++----------------- 8 files changed, 147 insertions(+), 87 deletions(-) -- 1.8.1.4