]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libblkid: ddf_raid: drop little-endian handling
authorThomas Weißschuh <thomas@t-8ch.de>
Thu, 27 Feb 2025 17:15:56 +0000 (18:15 +0100)
committerThomas Weißschuh <thomas@t-8ch.de>
Thu, 27 Feb 2025 17:15:56 +0000 (18:15 +0100)
The DDF specification, both 1.2 and 2.0 require big-endian.
This is also what mdadm expects.

5.2 Byte Ordering

Each section of the DDF MUST be stored in big-endian format
(i.e., the more significant bytes of the section are stored in
lower addresses in relation to bytes of lesser significance).

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
libblkid/src/superblocks/ddf_raid.c

index f3be81574419138354bf6326dcc965fa0aa61f26..f5b52bff2b37b7fa20c99d0ed6a70dfff6eef4ed 100644 (file)
@@ -88,8 +88,7 @@ static int probe_ddf(blkid_probe pr,
                                        sizeof(struct ddf_header));
                if (!ddf)
                        return errno ? -errno : 1;
-               if (ddf->signature == cpu_to_be32(DDF_MAGIC) ||
-                   ddf->signature == cpu_to_le32(DDF_MAGIC))
+               if (ddf->signature == cpu_to_be32(DDF_MAGIC))
                        break;
                ddf = NULL;
        }
@@ -97,9 +96,7 @@ static int probe_ddf(blkid_probe pr,
        if (!ddf)
                return 1;
 
-       lba = ddf->signature == cpu_to_be32(DDF_MAGIC) ?
-                       be64_to_cpu(ddf->primary_lba) :
-                       le64_to_cpu(ddf->primary_lba);
+       lba = be64_to_cpu(ddf->primary_lba);
 
        if (lba > 0) {
                /* check primary header */