Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 02 Mar 2000 13:43:17 -0700
From:      Warner Losh <imp@village.org>
Cc:        current@FreeBSD.ORG, phk@FreeBSD.ORG
Subject:   Re: Please review: fdisk -e -> -I 
Message-ID:  <200003022043.NAA17997@harmony.village.org>
In-Reply-To: Your message of "Thu, 02 Mar 2000 13:33:41 MST." <200003022033.NAA17898@harmony.village.org> 
References:  <200003022033.NAA17898@harmony.village.org>  

next in thread | previous in thread | raw e-mail | index | archive | help
In message <200003022033.NAA17898@harmony.village.org> Warner Losh writes:
: Given that OpenBSD had the -e flag to fdisk first, and that it means
: edit there and that disklabel -e means edit, I'd like to apply the
: following patch to -current before it becomes 4.0.  If we wait, we'll
: have compatibility problems.  Right now it is too easy to shoot
: yourself in the foot with this.
: 
: When this was hashed out here, the idea was met with wide spread
: support, even fiven the advanced nature of the freeze.  I take that
: support to mean that this is something that would be a good idea to do
: for 4.0.
: 
: Comments?

I hate to follow up my own post.  It would appear that -e was added
before 3.3R went out the door.  Given that, I think the patch should
look more like the following:

Index: fdisk.8
===================================================================
RCS file: /home/imp/FreeBSD/CVS/src/sbin/i386/fdisk/fdisk.8,v
retrieving revision 1.16
diff -u -r1.16 fdisk.8
--- fdisk.8	1999/08/28 00:13:01	1.16
+++ fdisk.8	2000/03/02 20:29:12
@@ -8,7 +8,7 @@
 .Nd PC partition table maintenance program
 .Sh SYNOPSIS
 .Nm fdisk
-.Op Fl Baeitu
+.Op Fl BIaitu
 .Op Fl b Ar bootcode
 .Op Fl 1234
 .Op Ar disk
@@ -62,7 +62,7 @@
 if
 .Fl f
 is given.
-.It Fl e
+.It Fl I
 Initialize the contents of sector 0 with one FreeBSD slice covering the entire disk.
 .It Fl f Ar configfile
 Set partition values using the file
Index: fdisk.c
===================================================================
RCS file: /home/imp/FreeBSD/CVS/src/sbin/i386/fdisk/fdisk.c,v
retrieving revision 1.34
diff -u -r1.34 fdisk.c
--- fdisk.c	2000/02/11 11:25:23	1.34
+++ fdisk.c	2000/03/02 20:42:48
@@ -120,7 +120,7 @@
 static int B_flag  = 0;		/* replace boot code */
 static int a_flag  = 0;		/* set active partition */
 static char *b_flag = NULL;	/* path to boot code */
-static int e_flag  = 0;		/* use entire disk for FreeBSD */
+static int I_flag  = 0;		/* use entire disk for FreeBSD */
 static int i_flag  = 0;		/* replace partition data */
 static int u_flag  = 0;		/* update partition data */
 static int t_flag  = 0;		/* test only, if f_flag is given */
@@ -216,11 +216,14 @@
 {
 	int	c, i;
 
-	while ((c = getopt(argc, argv, "Bab:ef:ituv1234")) != -1)
+	while ((c = getopt(argc, argv, "BIab:ef:ituv1234")) != -1)
 		switch (c) {
 		case 'B':
 			B_flag = 1;
 			break;
+		case 'I':
+			I_flag = 1;
+			break;
 		case 'a':
 			a_flag = 1;
 			break;
@@ -228,7 +231,7 @@
 			b_flag = optarg;
 			break;
 		case 'e':
-			e_flag = 1;
+			warnx("-e ignored.  Please use -I");
 			break;
 		case 'f':
 			f_flag = optarg;
@@ -292,7 +295,7 @@
 
 	printf("******* Working on device %s *******\n",disk);
 
-	if (e_flag)
+	if (I_flag)
 	{
 		struct dos_partition *partp;
 
@@ -648,7 +651,7 @@
 	if ( !(st.st_mode & S_IFCHR) )
 		warnx("device %s is not character special", disk);
 	if ((fd = open(disk,
-	    a_flag || e_flag || B_flag || u_flag ? O_RDWR : O_RDONLY)) == -1) {
+	    a_flag || I_flag || B_flag || u_flag ? O_RDWR : O_RDONLY)) == -1) {
 		if(errno == ENXIO)
 			return -2;
 		warnx("can't open device %s", disk);


Warner


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200003022043.NAA17997>