Source-Changes-HG archive

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

[src/trunk]: src/sbin/fdisk Add a flag to support writing overlapping partiti...



details:   https://anonhg.NetBSD.org/src/rev/6b07bedbe597
branches:  trunk
changeset: 771726:6b07bedbe597
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Dec 01 22:24:29 2011 +0000

description:
Add a flag to support writing overlapping partitions and explain why.

diffstat:

 sbin/fdisk/fdisk.8 |  14 +++++++++++---
 sbin/fdisk/fdisk.c |  21 +++++++++++++--------
 2 files changed, 24 insertions(+), 11 deletions(-)

diffs (99 lines):

diff -r 6e633c1624fb -r 6b07bedbe597 sbin/fdisk/fdisk.8
--- a/sbin/fdisk/fdisk.8        Thu Dec 01 21:54:10 2011 +0000
+++ b/sbin/fdisk/fdisk.8        Thu Dec 01 22:24:29 2011 +0000
@@ -1,6 +1,6 @@
-.\"    $NetBSD: fdisk.8,v 1.71 2011/04/25 22:23:47 wiz Exp $
+.\"    $NetBSD: fdisk.8,v 1.72 2011/12/01 22:24:29 christos Exp $
 .\"
-.Dd April 6, 2010
+.Dd December 1, 2011
 .Dt FDISK 8
 .Os
 .Sh NAME
@@ -8,7 +8,7 @@
 .Nd MS-DOS partition maintenance program
 .Sh SYNOPSIS
 .Nm
-.Op Fl aBFfiSuv
+.Op Fl aBFfIiSuv
 .Bk -words
 .Oo
 .Fl 0 | 1 | 2 | 3 | E Ar number
@@ -270,6 +270,14 @@
 fields
 .Pq only Ar start No and Ar size No can be specified by Fl s No option .
 They will be automatically computed using the BIOS geometry.
+.It Fl I
+Ignore errors from overlapping partitions.
+Some devices (cameras CHDK) require overlapping partitions to support 
+bigger than 4GB cards.
+The
+.Fl I
+flag ignores overlapping error checks and does not fix them, allowing these
+incorrect configurations to be used.
 .It Fl i
 Explicitly request initialisation of the master boot code
 (similar to what
diff -r 6e633c1624fb -r 6b07bedbe597 sbin/fdisk/fdisk.c
--- a/sbin/fdisk/fdisk.c        Thu Dec 01 21:54:10 2011 +0000
+++ b/sbin/fdisk/fdisk.c        Thu Dec 01 22:24:29 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fdisk.c,v 1.134 2011/08/28 15:46:26 gson Exp $ */
+/*     $NetBSD: fdisk.c,v 1.135 2011/12/01 22:24:29 christos Exp $ */
 
 /*
  * Mach Operating System
@@ -39,7 +39,7 @@
 #include <sys/cdefs.h>
 
 #ifndef lint
-__RCSID("$NetBSD: fdisk.c,v 1.134 2011/08/28 15:46:26 gson Exp $");
+__RCSID("$NetBSD: fdisk.c,v 1.135 2011/12/01 22:24:29 christos Exp $");
 #endif /* not lint */
 
 #define MBRPTYPENAMES
@@ -224,6 +224,7 @@
 
 static int a_flag;             /* set active partition */
 static int i_flag;             /* init bootcode */
+static int I_flag;             /* ignore errors */
 static int u_flag;             /* update partition data */
 static int v_flag;             /* more verbose */
 static int sh_flag;            /* Output data as shell defines */
@@ -383,6 +384,9 @@
                case 'i':       /* Always update bootcode */
                        i_flag = 1;
                        break;
+               case 'I':       /* Ignore errors */
+                       I_flag = 1;
+                       break;
                case 'l':       /* List known partition types */
                        for (len = 0; len < KNOWN_SYSIDS; len++)
                                printf("%03d %s\n", mbr_ptypes[len].id,
@@ -2156,7 +2160,7 @@
                errtext = check_ext_overlap(part, sysid, start, size, 0);
        else
                errtext = check_overlap(part, sysid, start, size, 0);
-       if (errtext != NULL) {
+       if (errtext != NULL && !I_flag) {
                if (f_flag)
                        errx(2, "%s\n", errtext);
                printf("%s\n", errtext);
@@ -2170,11 +2174,12 @@
         * This also fixes the base of each extended partition if the
         * partition itself has moved.
         */
-
-       if (extended)
-               errtext = check_ext_overlap(part, sysid, start, size, 1);
-       else
-               errtext = check_overlap(part, sysid, start, size, 1);
+       if (!I_flag) {
+               if (extended)
+                       errtext = check_ext_overlap(part, sysid, start, size, 1);
+               else
+                       errtext = check_overlap(part, sysid, start, size, 1);
+       }
 
        if (errtext)
                errx(1, "%s\n", errtext);



Home | Main Index | Thread Index | Old Index