From bfdee4708245f4020692ee4fef292ddeeebcd388 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Pali=20Roh=C3=A1r?= Date: Tue, 6 Jul 2021 15:03:21 +0200 Subject: [PATCH] libfdisk: (dos) Use helper macros cylinder() and sector() in check_consistency() MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Helper macros are already used there and make code more readable. Signed-off-by: Pali Rohár --- libfdisk/src/dos.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libfdisk/src/dos.c b/libfdisk/src/dos.c index ab4213ad0e..1a2b58f99f 100644 --- a/libfdisk/src/dos.c +++ b/libfdisk/src/dos.c @@ -1574,14 +1574,14 @@ static int check_consistency(struct fdisk_context *cxt, struct dos_partition *p, return 0; /* do not check extended partitions */ /* physical beginning c, h, s */ - pbc = (p->bc & 0xff) | ((p->bs << 2) & 0x300); + pbc = cylinder(p->bs, p->bc); pbh = p->bh; - pbs = p->bs & 0x3f; + pbs = sector(p->bs); /* physical ending c, h, s */ - pec = (p->ec & 0xff) | ((p->es << 2) & 0x300); + pec = cylinder(p->es, p->ec); peh = p->eh; - pes = p->es & 0x3f; + pes = sector(p->es); /* compute logical beginning (c, h, s) */ long2chs(cxt, dos_partition_get_start(p), &lbc, &lbh, &lbs); -- 2.47.3