From: Stefan Hajnoczi <stefanha@redhat.com>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
Klim Kireev <klim.kireev@virtuozzo.com>,
"Denis V . Lunev" <den@openvz.org>,
Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>,
Edgar Kaziakhmedov <edgar.kaziakhmedov@virtuozzo.com>,
Stefan Hajnoczi <stefanha@redhat.com>
Subject: [Qemu-devel] [PULL v2 5/6] block/parallels: replace some magic numbers
Date: Mon, 22 Jan 2018 16:00:47 +0000 [thread overview]
Message-ID: <20180122160048.29571-6-stefanha@redhat.com> (raw)
In-Reply-To: <20180122160048.29571-1-stefanha@redhat.com>
From: Klim Kireev <klim.kireev@virtuozzo.com>
Signed-off-by: Klim Kireev <klim.kireev@virtuozzo.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Denis V. Lunev <den@openvz.org>
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Edgar Kaziakhmedov <edgar.kaziakhmedov@virtuozzo.com>
Message-id: 20180112090122.1702-5-klim.kireev@virtuozzo.com
CC: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
block/parallels.h | 2 ++
block/parallels.c | 5 +++--
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/block/parallels.h b/block/parallels.h
index 71183c0c8e..4b044079ef 100644
--- a/block/parallels.h
+++ b/block/parallels.h
@@ -34,6 +34,8 @@
#include "qemu/coroutine.h"
#include "qemu/typedefs.h"
+#define HEADS_NUMBER 16
+#define SEC_IN_CYL 32
#define DEFAULT_CLUSTER_SIZE 1048576 /* 1 MiB */
/* always little-endian */
diff --git a/block/parallels.c b/block/parallels.c
index f9a3b999ea..7a8e8b05a9 100644
--- a/block/parallels.c
+++ b/block/parallels.c
@@ -476,8 +476,9 @@ static int parallels_create(const char *filename, QemuOpts *opts, Error **errp)
memcpy(header.magic, HEADER_MAGIC2, sizeof(header.magic));
header.version = cpu_to_le32(HEADER_VERSION);
/* don't care much about geometry, it is not used on image level */
- header.heads = cpu_to_le32(16);
- header.cylinders = cpu_to_le32(total_size / BDRV_SECTOR_SIZE / 16 / 32);
+ header.heads = cpu_to_le32(HEADS_NUMBER);
+ header.cylinders = cpu_to_le32(total_size / BDRV_SECTOR_SIZE
+ / HEADS_NUMBER / SEC_IN_CYL);
header.tracks = cpu_to_le32(cl_size >> BDRV_SECTOR_BITS);
header.bat_entries = cpu_to_le32(bat_entries);
header.nb_sectors = cpu_to_le64(DIV_ROUND_UP(total_size, BDRV_SECTOR_SIZE));
--
2.14.3
next prev parent reply other threads:[~2018-01-22 16:02 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-22 16:00 [Qemu-devel] [PULL v2 0/6] Block patches Stefan Hajnoczi
2018-01-22 16:00 ` [Qemu-devel] [PULL v2 1/6] block: add block_set_io_throttle virtio-blk-pci QMP example Stefan Hajnoczi
2018-01-22 16:00 ` [Qemu-devel] [PULL v2 2/6] docs/interop/prl-xml: description of Parallels Disk format Stefan Hajnoczi
2018-01-22 16:00 ` [Qemu-devel] [PULL v2 3/6] configure: add dependency Stefan Hajnoczi
2018-01-22 16:00 ` [Qemu-devel] [PULL v2 4/6] block/parallels: move some structures into header Stefan Hajnoczi
2018-01-22 16:00 ` Stefan Hajnoczi [this message]
2018-01-22 16:00 ` [Qemu-devel] [PULL v2 6/6] block/parallels: add backing support to readv/writev Stefan Hajnoczi
2018-01-24 16:59 ` [Qemu-devel] [PULL v2 0/6] Block patches Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180122160048.29571-6-stefanha@redhat.com \
--to=stefanha@redhat.com \
--cc=den@openvz.org \
--cc=edgar.kaziakhmedov@virtuozzo.com \
--cc=klim.kireev@virtuozzo.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=vsementsov@virtuozzo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).