Source-Changes-HG archive

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

[src/trunk]: src/sbin/fdisk Use the disk size from the device driver, not the...



details:   https://anonhg.NetBSD.org/src/rev/80671b504b2f
branches:  trunk
changeset: 566487:80671b504b2f
user:      dsl <dsl%NetBSD.org@localhost>
date:      Mon May 10 20:32:07 2004 +0000

description:
Use the disk size from the device driver, not the bios when checking
whether partitions are valid.
Stops problems with broken BIOS, fixes PR bin/25491

diffstat:

 sbin/fdisk/fdisk.c |  10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diffs (45 lines):

diff -r 44768d593539 -r 80671b504b2f sbin/fdisk/fdisk.c
--- a/sbin/fdisk/fdisk.c        Mon May 10 20:27:42 2004 +0000
+++ b/sbin/fdisk/fdisk.c        Mon May 10 20:32:07 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fdisk.c,v 1.78 2004/05/08 20:52:59 dsl Exp $ */
+/*     $NetBSD: fdisk.c,v 1.79 2004/05/10 20:32:07 dsl Exp $ */
 
 /*
  * Mach Operating System
@@ -35,7 +35,7 @@
 #include <sys/cdefs.h>
 
 #ifndef lint
-__RCSID("$NetBSD: fdisk.c,v 1.78 2004/05/08 20:52:59 dsl Exp $");
+__RCSID("$NetBSD: fdisk.c,v 1.79 2004/05/10 20:32:07 dsl Exp $");
 #endif /* not lint */
 
 #include <sys/types.h>
@@ -1544,7 +1544,7 @@
        if (sysid != 0) {
                if (start < dos_sectors)
                        return "Track zero is reserved for the BIOS";
-               if (start + size > dos_disksectors) 
+               if (start + size > disksectors) 
                        return "Partition exceeds size of disk";
                for (p = 0; p < MBR_PART_COUNT; p++) {
                        if (p == part || mboot.mbr_parts[p].mbrp_type == 0)
@@ -1809,7 +1809,7 @@
                                        p = -1;
                                }
                        }
-                       if (start >= dos_disksectors) {
+                       if (start >= disksectors) {
                                printf("No free space\n");
                                return 0;
                        }
@@ -1829,7 +1829,7 @@
 #endif
                } else {
                        daddr_t old = start;
-                       daddr_t lim = extended ? ext.limit : dos_disksectors;
+                       daddr_t lim = extended ? ext.limit : disksectors;
                        start = decimal("start", start,
                                DEC_SEC | DEC_RND_0 | (extended ? DEC_RND : 0),
                                extended ? ext.base : 0, lim);



Home | Main Index | Thread Index | Old Index