Module Name: src Committed By: christos Date: Thu Dec 1 22:24:29 UTC 2011
Modified Files: src/sbin/fdisk: fdisk.8 fdisk.c Log Message: Add a flag to support writing overlapping partitions and explain why. To generate a diff of this commit: cvs rdiff -u -r1.71 -r1.72 src/sbin/fdisk/fdisk.8 cvs rdiff -u -r1.134 -r1.135 src/sbin/fdisk/fdisk.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sbin/fdisk/fdisk.8 diff -u src/sbin/fdisk/fdisk.8:1.71 src/sbin/fdisk/fdisk.8:1.72 --- src/sbin/fdisk/fdisk.8:1.71 Mon Apr 25 18:23:47 2011 +++ src/sbin/fdisk/fdisk.8 Thu Dec 1 17:24:29 2011 @@ -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 @@ and 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 Index: src/sbin/fdisk/fdisk.c diff -u src/sbin/fdisk/fdisk.c:1.134 src/sbin/fdisk/fdisk.c:1.135 --- src/sbin/fdisk/fdisk.c:1.134 Sun Aug 28 11:46:26 2011 +++ src/sbin/fdisk/fdisk.c Thu Dec 1 17:24:29 2011 @@ -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 char *disk_type = NULL; 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 @@ main(int argc, char *argv[]) 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 @@ change_part(int extended, int part, int 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 @@ change_part(int extended, int part, int * 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);