]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libfdisk: (dos) Use helper macros cylinder() and sector() in check_consistency()
authorPali Rohár <pali.rohar@gmail.com>
Tue, 6 Jul 2021 13:03:21 +0000 (15:03 +0200)
committerPali Rohár <pali.rohar@gmail.com>
Thu, 15 Jul 2021 19:49:30 +0000 (21:49 +0200)
Helper macros are already used there and make code more readable.

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
libfdisk/src/dos.c

index ab4213ad0ea19635504a263abf243e3cba83dc7d..1a2b58f99f23929b4c9141521ebb922e4ed5f26e 100644 (file)
@@ -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);