diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2017-06-22 13:04:16 +0200 |
---|---|---|
committer | Marc-André Lureau <marcandre.lureau@redhat.com> | 2017-08-31 12:29:07 +0200 |
commit | 13f1493f82860cff39e3b8160a3dce557970f95f (patch) | |
tree | 3225efb123c439f83d5b42d248c2379cf942ccd7 /block/vpc.c | |
parent | 21cf3e120191eb1302da2bbfc6c41239e0d84db7 (diff) |
vpc: use DIV_ROUND_UP
I used the clang-tidy qemu-round check to generate the fix:
https://github.com/elmarco/clang-tools-extra
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Diffstat (limited to 'block/vpc.c')
-rw-r--r-- | block/vpc.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/block/vpc.c b/block/vpc.c index 82911ebead..1576d7b595 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; |