qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Denis V. Lunev" <den@openvz.org>
To: qemu-block@nongnu.org, qemu-devel@nongnu.org
Cc: Klim Kireev <klim.kireev@virtuozzo.com>,
	"Denis V . Lunev" <den@openvz.org>,
	Stefan Hajnoczi <stefanha@redhat.com>
Subject: [Qemu-devel] [PATCH 4/5] block/parallels: replace some magic numbers
Date: Mon, 18 Dec 2017 14:09:10 +0300	[thread overview]
Message-ID: <1513595351-5899-5-git-send-email-den@openvz.org> (raw)
In-Reply-To: <1513595351-5899-1-git-send-email-den@openvz.org>

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>
CC: 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 7d0fb73..9be29fe 100644
--- a/block/parallels.h
+++ b/block/parallels.h
@@ -31,6 +31,8 @@
 #define BLOCK_PARALLELS_H
 #include "qemu/module.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 f9a3b99..7a8e8b0 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.7.4

  parent reply	other threads:[~2017-12-18 11:09 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-18 11:09 [Qemu-devel] [PATCH 0/5] preparation for Parallels Disk xml driver Denis V. Lunev
2017-12-18 11:09 ` [Qemu-devel] [PATCH 1/5] docs/interop/prl-xml: description of Parallels Disk format Denis V. Lunev
2018-01-04 11:34   ` Stefan Hajnoczi
2018-01-10 16:23     ` klim
2018-01-11 15:33       ` Stefan Hajnoczi
2017-12-18 11:09 ` [Qemu-devel] [PATCH 2/5] configure: add dependency Denis V. Lunev
2017-12-22 12:38   ` [Qemu-devel] [Qemu-block] " Roman Kagan
2018-01-10 15:37     ` klim
2018-01-10 15:49     ` Daniel P. Berrange
2017-12-18 11:09 ` [Qemu-devel] [PATCH 3/5] block/parallels: move some structures into header Denis V. Lunev
2018-01-04 13:18   ` Stefan Hajnoczi
2017-12-18 11:09 ` Denis V. Lunev [this message]
2018-01-04 13:20   ` [Qemu-devel] [PATCH 4/5] block/parallels: replace some magic numbers Stefan Hajnoczi
2017-12-18 11:09 ` [Qemu-devel] [PATCH 5/5] block/parallels: add backing support to readv/writev Denis V. Lunev
2018-01-04 13:29   ` Stefan Hajnoczi
  -- strict thread matches above, loose matches on Subject: below --
2018-01-10 17:36 [Qemu-devel] [PATCH 0/5 v2] preparation for Parallels Disk xml driver Klim Kireev
2018-01-10 17:36 ` [Qemu-devel] [PATCH 4/5] block/parallels: replace some magic numbers Klim Kireev
2018-01-12  9:01 [Qemu-devel] [PATCH 0/5 v3] preparation for Parallels Disk xml driver Klim Kireev
2018-01-12  9:01 ` [Qemu-devel] [PATCH 4/5] block/parallels: replace some magic numbers Klim Kireev

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=1513595351-5899-5-git-send-email-den@openvz.org \
    --to=den@openvz.org \
    --cc=klim.kireev@virtuozzo.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.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).