From: Pali Rohár Date: Tue, 6 Jul 2021 13:03:21 +0000 (+0200) Subject: libfdisk: (dos) Use helper macros cylinder() and sector() in check_consistency() X-Git-Tag: v2.38-rc1~362^2~5 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bfdee4708245f4020692ee4fef292ddeeebcd388;p=thirdparty%2Futil-linux.git libfdisk: (dos) Use helper macros cylinder() and sector() in check_consistency() Helper macros are already used there and make code more readable. Signed-off-by: Pali Rohár --- 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);