aboutsummaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2017-08-31 15:52:43 +0100
committerPeter Maydell <peter.maydell@linaro.org>2017-08-31 15:52:43 +0100
commit223cd0e13f2e46078d7b573f0b8402bfbee339be (patch)
treefc141300eae2e20ea36d235f776e91353365c8c0 /block
parent1d2a8e0690a8b26833346c6e84e91773da66fbf4 (diff)
parente4d67e4f2e06128bc7f07263afe9acc2e2242fdc (diff)
downloadqemu-223cd0e13f2e46078d7b573f0b8402bfbee339be.zip
qemu-223cd0e13f2e46078d7b573f0b8402bfbee339be.tar.gz
qemu-223cd0e13f2e46078d7b573f0b8402bfbee339be.tar.bz2
Merge remote-tracking branch 'remotes/elmarco/tags/tidy-pull-request' into staging
# gpg: Signature made Thu 31 Aug 2017 11:29:33 BST # gpg: using RSA key 0xDAE8E10975969CE5 # gpg: Good signature from "Marc-André Lureau <marcandre.lureau@redhat.com>" # gpg: aka "Marc-André Lureau <marcandre.lureau@gmail.com>" # gpg: WARNING: This key is not certified with sufficiently trusted signatures! # gpg: It is not certain that the signature belongs to the owner. # Primary key fingerprint: 87A9 BD93 3F87 C606 D276 F62D DAE8 E109 7596 9CE5 * remotes/elmarco/tags/tidy-pull-request: (29 commits) eepro100: replace g_malloc()+memcpy() with g_memdup() test-iov: replace g_malloc()+memcpy() with g_memdup() i386: replace g_malloc()+memcpy() with g_memdup() i386: introduce ELF_NOTE_SIZE macro decnumber: use DIV_ROUND_UP kvm: use DIV_ROUND_UP i386/dump: use DIV_ROUND_UP ppc: use DIV_ROUND_UP msix: use DIV_ROUND_UP usb-hub: use DIV_ROUND_UP q35: use DIV_ROUND_UP piix: use DIV_ROUND_UP virtio-serial: use DIV_ROUND_UP console: use DIV_ROUND_UP monitor: use DIV_ROUND_UP virtio-gpu: use DIV_ROUND_UP vga: use DIV_ROUND_UP ui: use DIV_ROUND_UP vnc: use DIV_ROUND_UP vvfat: use DIV_ROUND_UP ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'block')
-rw-r--r--block/dmg.c2
-rw-r--r--block/qcow2-cluster.c2
-rw-r--r--block/vhdx-log.c2
-rw-r--r--block/vpc.c4
-rw-r--r--block/vvfat.c4
5 files changed, 7 insertions, 7 deletions
diff --git a/block/dmg.c b/block/dmg.c
index 900ae5a..6c0711f 100644
--- a/block/dmg.c
+++ b/block/dmg.c
@@ -111,7 +111,7 @@ static void update_max_chunk_size(BDRVDMGState *s, uint32_t chunk,
uncompressed_sectors = s->sectorcounts[chunk];
break;
case 1: /* copy */
- uncompressed_sectors = (s->lengths[chunk] + 511) / 512;
+ uncompressed_sectors = DIV_ROUND_UP(s->lengths[chunk], 512);
break;
case 2: /* zero */
/* as the all-zeroes block may be large, it is treated specially: the
diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c
index 8538533..0d48249 100644
--- a/block/qcow2-cluster.c
+++ b/block/qcow2-cluster.c
@@ -61,7 +61,7 @@ int qcow2_grow_l1_table(BlockDriverState *bs, uint64_t min_size,
new_l1_size = 1;
}
while (min_size > new_l1_size) {
- new_l1_size = (new_l1_size * 3 + 1) / 2;
+ new_l1_size = DIV_ROUND_UP(new_l1_size * 3, 2);
}
}
diff --git a/block/vhdx-log.c b/block/vhdx-log.c
index 14b724e..0ac4863 100644
--- a/block/vhdx-log.c
+++ b/block/vhdx-log.c
@@ -902,7 +902,7 @@ static int vhdx_log_write(BlockDriverState *bs, BDRVVHDXState *s,
}
sector_offset = offset % VHDX_LOG_SECTOR_SIZE;
- file_offset = (offset / VHDX_LOG_SECTOR_SIZE) * VHDX_LOG_SECTOR_SIZE;
+ file_offset = QEMU_ALIGN_DOWN(offset, VHDX_LOG_SECTOR_SIZE);
aligned_length = length;
diff --git a/block/vpc.c b/block/vpc.c
index 82911eb..1576d7b 100644
--- a/block/vpc.c
+++ b/block/vpc.c
@@ -783,7 +783,7 @@ static int calculate_geometry(int64_t total_sectors, uint16_t* cyls,
} else {
*secs_per_cyl = 17;
cyls_times_heads = total_sectors / *secs_per_cyl;
- *heads = (cyls_times_heads + 1023) / 1024;
+ *heads = DIV_ROUND_UP(cyls_times_heads, 1024);
if (*heads < 4) {
*heads = 4;
@@ -836,7 +836,7 @@ static int create_dynamic_disk(BlockBackend *blk, uint8_t *buf,
offset = 3 * 512;
memset(buf, 0xFF, 512);
- for (i = 0; i < (num_bat_entries * 4 + 511) / 512; i++) {
+ for (i = 0; i < DIV_ROUND_UP(num_bat_entries * 4, 512); i++) {
ret = blk_pwrite(blk, offset, buf, 512, 0);
if (ret < 0) {
goto fail;
diff --git a/block/vvfat.c b/block/vvfat.c
index a9e207f..c54fa94 100644
--- a/block/vvfat.c
+++ b/block/vvfat.c
@@ -449,7 +449,7 @@ static direntry_t *create_long_filename(BDRVVVFATState *s, const char *filename)
return NULL;
}
- number_of_entries = (length * 2 + 25) / 26;
+ number_of_entries = DIV_ROUND_UP(length * 2, 26);
for(i=0;i<number_of_entries;i++) {
entry=array_get_next(&(s->directory));
@@ -2554,7 +2554,7 @@ static int commit_one_file(BDRVVVFATState* s,
(size > offset && c >=2 && !fat_eof(s, c)));
ret = vvfat_read(s->bs, cluster2sector(s, c),
- (uint8_t*)cluster, (rest_size + 0x1ff) / 0x200);
+ (uint8_t*)cluster, DIV_ROUND_UP(rest_size, 0x200));
if (ret < 0) {
qemu_close(fd);