mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-17 09:10:08 +02:00
Co-authored-by: sfanxiang <sfanxiang@gmail.com> Co-authored-by: localanu <localanu@gmail.com>
29 lines
975 B
Diff
29 lines
975 B
Diff
From f3f607b4ae032bded0a10de6f27c807ded3d4a4e Mon Sep 17 00:00:00 2001
|
|
From: LoopbackDevice <140448619+LoopbackDevice@users.noreply.github.com>
|
|
Date: Mon, 24 Jul 2023 14:26:41 -0700
|
|
Subject: [PATCH] Fix "invalid primary" and "starts beyond disk end" errors
|
|
|
|
os_disk_geometry() was no longer setting disk_geom->d_nsecs,
|
|
possibly after commit 0529a52485411be351bb75d628edc187a53c0e40.
|
|
---
|
|
src/disku.c | 5 +++--
|
|
1 file changed, 3 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/src/disku.c b/src/disku.c
|
|
index d50cebf..24da917 100644
|
|
--- a/src/disku.c
|
|
+++ b/src/disku.c
|
|
@@ -62,9 +62,10 @@ static void os_disk_geometry(disk_desc *d, struct disk_geom *g)
|
|
if (ioctl(d->d_fd, BLKGETSIZE, &nsects) == -1)
|
|
pr(FATAL, EM_IOCTLFAILED, "BLKGETSIZE", strerror(errno));
|
|
else {
|
|
- if (hg.heads && hg.sectors)
|
|
+ if (hg.heads && hg.sectors) {
|
|
g->d_c = nsects / (hg.heads * hg.sectors);
|
|
- else
|
|
+ g->d_nsecs = nsects;
|
|
+ } else
|
|
geometry_from_num_sectors(g, nsects);
|
|
}
|
|
#endif
|