[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v10 06/17] qemu-io: Don't open-code QEMU_IS_ALIGNED
From: |
Eric Blake |
Subject: |
[Qemu-devel] [PATCH v10 06/17] qemu-io: Don't open-code QEMU_IS_ALIGNED |
Date: |
Wed, 26 Apr 2017 20:46:15 -0500 |
Manual comparison against 0x1ff is not as clean as using our
alignment macros from osdep.h.
Suggested-by: Philippe Mathieu-Daudé <address@hidden>
Signed-off-by: Eric Blake <address@hidden>
---
v10: new patch
---
qemu-io-cmds.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/qemu-io-cmds.c b/qemu-io-cmds.c
index 21af9e6..fabc394 100644
--- a/qemu-io-cmds.c
+++ b/qemu-io-cmds.c
@@ -740,12 +740,12 @@ static int read_f(BlockBackend *blk, int argc, char
**argv)
}
if (bflag) {
- if (offset & 0x1ff) {
+ if (!QEMU_IS_ALIGNED(offset, BDRV_SECTOR_SIZE)) {
printf("offset %" PRId64 " is not sector aligned\n",
offset);
return 0;
}
- if (count & 0x1ff) {
+ if (!QEMU_IS_ALIGNED(count, BDRV_SECTOR_SIZE)) {
printf("count %"PRId64" is not sector aligned\n",
count);
return 0;
@@ -1050,13 +1050,13 @@ static int write_f(BlockBackend *blk, int argc, char
**argv)
}
if (bflag || cflag) {
- if (offset & 0x1ff) {
+ if (!QEMU_IS_ALIGNED(offset, BDRV_SECTOR_SIZE)) {
printf("offset %" PRId64 " is not sector aligned\n",
offset);
return 0;
}
- if (count & 0x1ff) {
+ if (!QEMU_IS_ALIGNED(count, BDRV_SECTOR_SIZE)) {
printf("count %"PRId64" is not sector aligned\n",
count);
return 0;
@@ -1769,7 +1769,7 @@ static int alloc_f(BlockBackend *blk, int argc, char
**argv)
if (offset < 0) {
print_cvtnum_err(offset, argv[1]);
return 0;
- } else if (offset & 0x1ff) {
+ } else if (!QEMU_IS_ALIGNED(offset, BDRV_SECTOR_SIZE)) {
printf("offset %" PRId64 " is not sector aligned\n",
offset);
return 0;
--
2.9.3
- [Qemu-devel] [PATCH v10 00/17] add blkdebug tests, Eric Blake, 2017/04/26
- [Qemu-devel] [PATCH v10 02/17] qcow2: Correctly report status of preallocated zero clusters, Eric Blake, 2017/04/26
- [Qemu-devel] [PATCH v10 01/17] block: Update comments on BDRV_BLOCK_* meanings, Eric Blake, 2017/04/26
- [Qemu-devel] [PATCH v10 03/17] qcow2: Reuse preallocated zero clusters, Eric Blake, 2017/04/26
- [Qemu-devel] [PATCH v10 06/17] qemu-io: Don't open-code QEMU_IS_ALIGNED,
Eric Blake <=
- [Qemu-devel] [PATCH v10 04/17] qcow2: Optimize zero_single_l2() to minimize L2 churn, Eric Blake, 2017/04/26
- [Qemu-devel] [PATCH v10 07/17] qemu-io: Switch 'alloc' command to byte-based length, Eric Blake, 2017/04/26