]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libblkid: (probe) remove chunking from blkid_probe_get_idmag()
authorThomas Weißschuh <thomas@t-8ch.de>
Sun, 1 Oct 2023 12:24:04 +0000 (14:24 +0200)
committerThomas Weißschuh <thomas@t-8ch.de>
Wed, 4 Oct 2023 18:03:42 +0000 (20:03 +0200)
blkid_probe_get_buffer is doing the same thing internally now.

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

index 552bed22c01cbb4562c44c3770fb3a00c16e86d8..19b80ec6ebeb275b159b3b8c8fd60ccefa116958 100644 (file)
@@ -1280,21 +1280,19 @@ int blkid_probe_get_idmag(blkid_probe pr, const struct blkid_idinfo *id,
                        kboff = ((mag->zonenum * pr->zone_size) >> 10) + mag->kboff_inzone;
 
                if (kboff >= 0)
-                       off = hint_offset + ((kboff + (mag->sboff >> 10)) << 10);
+                       off = hint_offset + (kboff << 10) + mag->sboff;
                else
-                       off = pr->size - (-kboff << 10);
-               buf = blkid_probe_get_buffer(pr, off, 1024);
+                       off = pr->size - (-kboff << 10) + mag->sboff;
+               buf = blkid_probe_get_buffer(pr, off, mag->len);
 
                if (!buf && errno)
                        return -errno;
 
-               if (buf && !memcmp(mag->magic,
-                               buf + (mag->sboff & 0x3ff), mag->len)) {
-
+               if (buf && !memcmp(mag->magic, buf, mag->len)) {
                        DBG(LOWPROBE, ul_debug("\tmagic sboff=%u, kboff=%ld",
                                mag->sboff, kboff));
                        if (offset)
-                               *offset = off + (mag->sboff & 0x3ff);
+                               *offset = off;
                        if (res)
                                *res = mag;
                        return BLKID_PROBE_OK;