grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v2 1/1] osdep/freebsd: Fix partition calculation for EBR entries


From: James Clarke
Subject: [PATCH v2 1/1] osdep/freebsd: Fix partition calculation for EBR entries
Date: Tue, 26 Feb 2019 18:40:14 +0000
User-agent: NeoMutt/20170113 (1.7.2)

For EBR partitions, "start" is the relative starting sector of the EBR
header itself, whereas "offset" is the relative starting byte of the
partition's contents, excluding the EBR header and any padding. Thus we
must use "offset", and divide by the sector size to convert to sectors.

Signed-off-by: James Clarke <address@hidden>
Reviewed-by: Colin Watson <address@hidden>
---
 grub-core/osdep/freebsd/getroot.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/grub-core/osdep/freebsd/getroot.c 
b/grub-core/osdep/freebsd/getroot.c
index ccc1d7028..4f1720451 100644
--- a/grub-core/osdep/freebsd/getroot.c
+++ b/grub-core/osdep/freebsd/getroot.c
@@ -338,8 +338,9 @@ grub_util_follow_gpart_up (const char *name, 
grub_disk_addr_t *off_out, char **n
            grub_util_follow_gpart_up (name_tmp, &off, name_out);
            free (name_tmp);
            LIST_FOREACH (config, &provider->lg_config, lg_config)
-             if (strcasecmp (config->lg_name, "start") == 0)
-               off += strtoull (config->lg_val, 0, 10);
+             if (strcasecmp (config->lg_name, "offset") == 0)
+               off += strtoull (config->lg_val, 0, 10)
+                      / provider->lg_sectorsize;
            if (off_out)
              *off_out = off;
            return;
-- 
2.20.1



reply via email to

[Prev in Thread] Current Thread [Next in Thread]