block: Remove unused masks

Replace confusing usage:

    ~BDRV_SECTOR_MASK

With more clear:

    (BDRV_SECTOR_SIZE - 1)

Remove BDRV_SECTOR_MASK and the unused BDRV_BLOCK_OFFSET_MASK which was
it's last user.

Signed-off-by: Nir Soffer <nsoffer@redhat.com>
Message-id: 20190827185913.27427-3-nsoffer@redhat.com
Reviewed-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
This commit is contained in:
Nir Soffer 2019-08-27 21:59:13 +03:00 committed by Max Reitz
parent 1bbbf32d5f
commit 8972571509
2 changed files with 1 additions and 3 deletions

View File

@ -143,7 +143,6 @@ typedef struct HDGeometry {
#define BDRV_SECTOR_BITS 9 #define BDRV_SECTOR_BITS 9
#define BDRV_SECTOR_SIZE (1ULL << BDRV_SECTOR_BITS) #define BDRV_SECTOR_SIZE (1ULL << BDRV_SECTOR_BITS)
#define BDRV_SECTOR_MASK ~(BDRV_SECTOR_SIZE - 1)
#define BDRV_REQUEST_MAX_SECTORS MIN(SIZE_MAX >> BDRV_SECTOR_BITS, \ #define BDRV_REQUEST_MAX_SECTORS MIN(SIZE_MAX >> BDRV_SECTOR_BITS, \
INT_MAX >> BDRV_SECTOR_BITS) INT_MAX >> BDRV_SECTOR_BITS)
@ -195,7 +194,6 @@ typedef struct HDGeometry {
#define BDRV_BLOCK_ALLOCATED 0x10 #define BDRV_BLOCK_ALLOCATED 0x10
#define BDRV_BLOCK_EOF 0x20 #define BDRV_BLOCK_EOF 0x20
#define BDRV_BLOCK_RECURSE 0x40 #define BDRV_BLOCK_RECURSE 0x40
#define BDRV_BLOCK_OFFSET_MASK BDRV_SECTOR_MASK
typedef QSIMPLEQ_HEAD(BlockReopenQueue, BlockReopenQueueEntry) BlockReopenQueue; typedef QSIMPLEQ_HEAD(BlockReopenQueue, BlockReopenQueueEntry) BlockReopenQueue;

View File

@ -906,7 +906,7 @@ static int block_load(QEMUFile *f, void *opaque, int version_id)
do { do {
addr = qemu_get_be64(f); addr = qemu_get_be64(f);
flags = addr & ~BDRV_SECTOR_MASK; flags = addr & (BDRV_SECTOR_SIZE - 1);
addr >>= BDRV_SECTOR_BITS; addr >>= BDRV_SECTOR_BITS;
if (flags & BLK_MIG_FLAG_DEVICE_BLOCK) { if (flags & BLK_MIG_FLAG_DEVICE_BLOCK) {