Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Mar 2009 01:51:42 +0000 (UTC)
From:      "David E. O'Brien" <obrien@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
Subject:   svn commit: r190357 - in stable/7: gnu/usr.bin/grep include lib/libelf sbin/fsck sbin/fsck_ffs sbin/mount usr.bin/gprof usr.bin/make usr.sbin/crunch usr.sbin/sade usr.sbin/sysinstall
Message-ID:  <200903240151.n2O1pgT0028693@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: obrien
Date: Tue Mar 24 01:51:42 2009
New Revision: 190357
URL: http://svn.freebsd.org/changeset/base/190357

Log:
  MFC: r186581: Sound less scary about errorousous disk geometry.

Modified:
  stable/7/gnu/usr.bin/grep/   (props changed)
  stable/7/include/   (props changed)
  stable/7/lib/libelf/   (props changed)
  stable/7/sbin/fsck/   (props changed)
  stable/7/sbin/fsck/fsck.8
  stable/7/sbin/fsck/fsck.c
  stable/7/sbin/fsck/fsutil.h
  stable/7/sbin/fsck_ffs/   (props changed)
  stable/7/sbin/fsck_ffs/fsck.h
  stable/7/sbin/fsck_ffs/fsck_ffs.8
  stable/7/sbin/fsck_ffs/main.c
  stable/7/sbin/fsck_ffs/setup.c
  stable/7/sbin/mount/   (props changed)
  stable/7/usr.bin/gprof/   (props changed)
  stable/7/usr.bin/make/   (props changed)
  stable/7/usr.sbin/crunch/   (props changed)
  stable/7/usr.sbin/sade/   (props changed)
  stable/7/usr.sbin/sade/disks.c
  stable/7/usr.sbin/sysinstall/   (props changed)
  stable/7/usr.sbin/sysinstall/disks.c
  stable/7/usr.sbin/sysinstall/sysinstall.8

Modified: stable/7/sbin/fsck/fsck.8
==============================================================================
--- stable/7/sbin/fsck/fsck.8	Tue Mar 24 01:35:58 2009	(r190356)
+++ stable/7/sbin/fsck/fsck.8	Tue Mar 24 01:51:42 2009	(r190357)
@@ -29,7 +29,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd January 25, 2009
+.Dd April 25, 2001
 .Dt FSCK 8
 .Os
 .Sh NAME
@@ -37,7 +37,7 @@
 .Nd file system consistency check and interactive repair
 .Sh SYNOPSIS
 .Nm
-.Op Fl Cdfnpvy
+.Op Fl dfnpvy
 .Op Fl B | F
 .Op Fl T Ar fstype : Ns Ar fsoptions
 .Op Fl t Ar fstype
@@ -112,11 +112,6 @@ to be the partition and slice designator
 .Pp
 The options are as follows:
 .Bl -tag -width indent
-.It Fl C
-Check if the
-.Dq clean
-flag is set in the superblock and skip file system checks if file system was
-properly dismounted and marked clean.
 .It Fl d
 Debugging mode.
 Just print the commands without executing them.

Modified: stable/7/sbin/fsck/fsck.c
==============================================================================
--- stable/7/sbin/fsck/fsck.c	Tue Mar 24 01:35:58 2009	(r190356)
+++ stable/7/sbin/fsck/fsck.c	Tue Mar 24 01:51:42 2009	(r190357)
@@ -103,7 +103,7 @@ main(int argc, char *argv[])
 	TAILQ_INIT(&selhead);
 	TAILQ_INIT(&opthead);
 
-	while ((i = getopt(argc, argv, "BCdvpfFnyl:t:T:")) != -1)
+	while ((i = getopt(argc, argv, "BdvpfFnyl:t:T:")) != -1)
 		switch (i) {
 		case 'B':
 			if (flags & CHECK_BACKGRD)
@@ -128,9 +128,6 @@ main(int argc, char *argv[])
 		case 'p':
 			flags |= CHECK_PREEN;
 			/*FALLTHROUGH*/
-		case 'C':
-			flags |= CHECK_CLEAN;
-			/*FALLTHROUGH*/
 		case 'n':
 		case 'y':
 			globopt[1] = i;
@@ -569,7 +566,7 @@ static void
 usage(void)
 {
 	static const char common[] =
-	    "[-Cdfnpvy] [-B | -F] [-T fstype:fsoptions] [-t fstype]";
+	    "[-dfnpvy] [-B | -F] [-T fstype:fsoptions] [-t fstype]";
 
 	(void)fprintf(stderr, "usage: %s %s [special | node] ...\n",
 	    getprogname(), common);

Modified: stable/7/sbin/fsck/fsutil.h
==============================================================================
--- stable/7/sbin/fsck/fsutil.h	Tue Mar 24 01:35:58 2009	(r190356)
+++ stable/7/sbin/fsck/fsutil.h	Tue Mar 24 01:51:42 2009	(r190357)
@@ -48,7 +48,6 @@ char *estrdup(const char *);
 #define	CHECK_DEBUG	0x0004
 #define	CHECK_BACKGRD	0x0008
 #define	DO_BACKGRD	0x0010
-#define	CHECK_CLEAN	0x0020
 
 struct fstab;
 int checkfstab(int, int (*)(struct fstab *), 

Modified: stable/7/sbin/fsck_ffs/fsck.h
==============================================================================
--- stable/7/sbin/fsck_ffs/fsck.h	Tue Mar 24 01:35:58 2009	(r190356)
+++ stable/7/sbin/fsck_ffs/fsck.h	Tue Mar 24 01:51:42 2009	(r190357)
@@ -271,7 +271,6 @@ int	bkgrdflag;		/* use a snapshot to run
 int	bflag;			/* location of alternate super block */
 int	debug;			/* output debugging info */
 char	damagedflag;		/* run in damaged mode */
-char	ckclean;		/* only do work if not cleanly unmounted */
 int	cvtlevel;		/* convert to newer file system format */
 int	bkgrdcheck;		/* determine if background check is possible */
 int	bkgrdsumadj;		/* whether the kernel have ability to adjust superblock summary */

Modified: stable/7/sbin/fsck_ffs/fsck_ffs.8
==============================================================================
--- stable/7/sbin/fsck_ffs/fsck_ffs.8	Tue Mar 24 01:35:58 2009	(r190356)
+++ stable/7/sbin/fsck_ffs/fsck_ffs.8	Tue Mar 24 01:51:42 2009	(r190357)
@@ -29,7 +29,7 @@
 .\"	@(#)fsck.8	8.4 (Berkeley) 5/9/95
 .\" $FreeBSD$
 .\"
-.Dd January 25, 2009
+.Dd January 20, 2009
 .Dt FSCK_FFS 8
 .Os
 .Sh NAME
@@ -46,9 +46,9 @@
 .Ar ...
 .Sh DESCRIPTION
 The specified disk partitions and/or file systems are checked.
-In "preen" or "check clean" mode the clean flag of each file system's
-superblock is examined and only those file systems that are not marked clean
-are checked.
+In "preen" mode the clean flag of each file system's superblock is examined
+and only those file systems that
+are not marked clean are checked.
 File systems are marked clean when they are unmounted,
 when they have been mounted read-only, or when
 .Nm
@@ -175,14 +175,6 @@ Use the block specified immediately afte
 the super block for the file system.
 An alternate super block is usually located at block 32 for UFS1,
 and block 160 for UFS2.
-.It Fl C
-Check if file system was dismouted cleanly.
-If so, skip file system checks (like "preen").
-However, if the file system was not cleanly dismounted, do full checks,
-is if
-.Nm
-was invoked without
-.Fl C .
 .It Fl c
 Convert the file system to the specified level.
 Note that the level of a file system can only be raised.

Modified: stable/7/sbin/fsck_ffs/main.c
==============================================================================
--- stable/7/sbin/fsck_ffs/main.c	Tue Mar 24 01:35:58 2009	(r190356)
+++ stable/7/sbin/fsck_ffs/main.c	Tue Mar 24 01:51:42 2009	(r190357)
@@ -82,7 +82,7 @@ main(int argc, char *argv[])
 	sync();
 	skipclean = 1;
 	damagedflag = 0;
-	while ((ch = getopt(argc, argv, "b:Bc:CdDfFm:npy")) != -1) {
+	while ((ch = getopt(argc, argv, "b:Bc:dDfFm:npy")) != -1) {
 		switch (ch) {
 		case 'b':
 			skipclean = 0;
@@ -132,10 +132,6 @@ main(int argc, char *argv[])
 
 		case 'p':
 			preen++;
-			/*FALLTHROUGH*/
-
-		case 'C':
-			ckclean++;
 			break;
 
 		case 'y':
@@ -155,7 +151,7 @@ main(int argc, char *argv[])
 
 	if (signal(SIGINT, SIG_IGN) != SIG_IGN)
 		(void)signal(SIGINT, catch);
-	if (ckclean)
+	if (preen)
 		(void)signal(SIGQUIT, catchquit);
 	signal(SIGINFO, infohandler);
 	if (bkgrdflag) {
@@ -220,7 +216,7 @@ checkfilesys(char *filesys)
 	errmsg[0] = '\0';
 
 	cdevname = filesys;
-	if (debug && ckclean)
+	if (debug && preen)
 		pwarn("starting\n");
 	/*
 	 * Make best effort to get the disk name. Check first to see
@@ -255,7 +251,7 @@ checkfilesys(char *filesys)
 			exit(7);	/* Filesystem clean, report it now */
 		exit(0);
 	}
-	if (ckclean && skipclean) {
+	if (preen && skipclean) {
 		/*
 		 * If file system is gjournaled, check it here.
 		 */
@@ -306,7 +302,7 @@ checkfilesys(char *filesys)
 					    "CANNOT RUN IN BACKGROUND\n");
 				}
 				if ((sblock.fs_flags & FS_UNCLEAN) == 0 &&
-				    skipclean && ckclean) {
+				    skipclean && preen) {
 					/*
 					 * file system is clean;
 					 * skip snapshot and report it clean

Modified: stable/7/sbin/fsck_ffs/setup.c
==============================================================================
--- stable/7/sbin/fsck_ffs/setup.c	Tue Mar 24 01:35:58 2009	(r190356)
+++ stable/7/sbin/fsck_ffs/setup.c	Tue Mar 24 01:51:42 2009	(r190357)
@@ -65,7 +65,7 @@ static struct disklabel *getdisklabel(ch
 /*
  * Read in a superblock finding an alternate if necessary.
  * Return 1 if successful, 0 if unsuccessful, -1 if file system
- * is already clean (ckclean and preen mode only).
+ * is already clean (preen mode only).
  */
 int
 setup(char *dev)
@@ -201,7 +201,7 @@ setup(char *dev)
 		pwarn("USING ALTERNATE SUPERBLOCK AT %d\n", bflag);
 		bflag = 0;
 	}
-	if (skipclean && ckclean && sblock.fs_clean) {
+	if (skipclean && preen && sblock.fs_clean) {
 		pwarn("FILE SYSTEM CLEAN; SKIPPING CHECKS\n");
 		return (-1);
 	}

Modified: stable/7/usr.sbin/sade/disks.c
==============================================================================
--- stable/7/usr.sbin/sade/disks.c	Tue Mar 24 01:35:58 2009	(r190356)
+++ stable/7/usr.sbin/sade/disks.c	Tue Mar 24 01:51:42 2009	(r190357)
@@ -103,6 +103,47 @@ record_chunks(Disk *d)
 static daddr_t Total;
 
 static void
+check_geometry(Disk *d)
+{
+    int sg;
+
+#ifdef PC98
+    if (d->bios_cyl >= 65536 || d->bios_hd > 256 || d->bios_sect >= 256)
+#else
+    if (d->bios_cyl > 65536 || d->bios_hd > 256 || d->bios_sect >= 64)
+#endif
+    {
+	dialog_clear_norefresh();
+	sg = msgYesNo("WARNING:  It is safe to use a geometry of %lu/%lu/%lu for %s on\n"
+		      "computers with modern BIOS versions.  If this disk is to be used\n"
+		      "on rather old machines, however, it is recommended to ensure that\n"
+		      "it does not have more than 65535 cylinders, or more than 255 heads\n"
+		      "or more than "
+#ifdef PC98
+		      "255"
+#else
+		      "63"
+#endif
+		      " sectors per track.\n"
+		      "\n"
+		      "Would you like that to keep using the current geometry?\n",
+		      d->bios_cyl, d->bios_hd, d->bios_sect, d->name);
+	if (sg == 1) {
+	    Sanitize_Bios_Geom(d);
+	    msgConfirm("A geometry of %lu/%lu/%lu was calculated for %s.\n"
+		       "\n"
+		       "If you are not sure about this, please consult the Hardware Guide\n"
+		       "in the Documentation submenu or use the (G)eometry command to\n"
+		       "change it.  Remember: you need to enter whatever your BIOS thinks\n"
+		       "the geometry is!  For IDE, it's what you were told in the BIOS\n"
+		       "setup.  For SCSI, it's the translation mode your controller is\n"
+		       "using.  Do NOT use a ``physical geometry''.\n",
+		       d->bios_cyl, d->bios_hd, d->bios_sect, d->name);
+	}
+    }
+}
+
+static void
 print_chunks(Disk *d, int u)
 {
     int row;
@@ -116,26 +157,6 @@ print_chunks(Disk *d, int u)
     Total = 0;
     for (i = 0; chunk_info[i]; i++)
 	Total += chunk_info[i]->size;
-#ifdef PC98
-    if (d->bios_cyl >= 65536 || d->bios_hd > 256 || d->bios_sect >= 256) {
-#else
-    if (d->bios_cyl > 65536 || d->bios_hd > 256 || d->bios_sect >= 64) {
-#endif
-	dialog_clear_norefresh();
-	msgConfirm("WARNING:  A geometry of %lu/%lu/%lu for %s is incorrect.  Using\n"
-		   "a more likely geometry.  If this geometry is incorrect or you\n"
-		   "are unsure as to whether or not it's correct, please consult\n"
-		   "the Hardware Guide in the Documentation submenu or use the\n"
-		   "(G)eometry command to change it now.\n\n"
-		   "Remember: you need to enter whatever your BIOS thinks the\n"
-		   "geometry is!  For IDE, it's what you were told in the BIOS\n"
-		   "setup. For SCSI, it's the translation mode your controller is\n"
-		   "using.  Do NOT use a ``physical geometry''.",
-	  d->bios_cyl, d->bios_hd, d->bios_sect, d->name);
-	Sanitize_Bios_Geom(d);
-	msgDebug("Sanitized geometry for %s is %lu/%lu/%lu.\n",
-	    d->name, d->bios_cyl, d->bios_hd, d->bios_sect);
-    }
     attrset(A_NORMAL);
     mvaddstr(0, 0, "Disk name:\t");
     clrtobot();
@@ -339,6 +360,9 @@ diskPartition(Device *dev)
     /* Set up the chunk array */
     record_chunks(d);
 
+    /* Give the user a chance to sanitize the disk geometry, if necessary */
+    check_geometry(d);
+
     while (chunking) {
 	char *val, geometry[80];
 	    
@@ -909,22 +933,25 @@ diskPartitionNonInteractive(Device *dev)
     record_chunks(d);
     cp = variable_get(VAR_GEOMETRY);
     if (cp) {
-	msgDebug("Setting geometry from script to: %s\n", cp);
-	d->bios_cyl = strtol(cp, &cp, 0);
-	d->bios_hd = strtol(cp + 1, &cp, 0);
-	d->bios_sect = strtol(cp + 1, 0, 0);
-    }
-
+	if (!strcasecmp(cp, "sane")) {
 #ifdef PC98
-    if (d->bios_cyl >= 65536 || d->bios_hd > 256 || d->bios_sect >= 256) {
+	    if (d->bios_cyl >= 65536 || d->bios_hd > 256 || d->bios_sect >= 256)
 #else
-    if (d->bios_cyl > 65536 || d->bios_hd > 256 || d->bios_sect >= 64) {
+	    if (d->bios_cyl > 65536 || d->bios_hd > 256 || d->bios_sect >= 64)
 #endif
-	msgDebug("Warning:  A geometry of %lu/%lu/%lu for %s is incorrect.\n",
-	    d->bios_cyl, d->bios_hd, d->bios_sect, d->name);
-	Sanitize_Bios_Geom(d);
-	msgDebug("Sanitized geometry for %s is %lu/%lu/%lu.\n",
-	    d->name, d->bios_cyl, d->bios_hd, d->bios_sect);
+	    {
+		msgDebug("Warning:  A geometry of %lu/%lu/%lu for %s is incorrect.\n",
+		    d->bios_cyl, d->bios_hd, d->bios_sect, d->name);
+		Sanitize_Bios_Geom(d);
+		msgDebug("Sanitized geometry for %s is %lu/%lu/%lu.\n",
+		    d->name, d->bios_cyl, d->bios_hd, d->bios_sect);
+	    }
+	} else {
+	    msgDebug("Setting geometry from script to: %s\n", cp);
+	    d->bios_cyl = strtol(cp, &cp, 0);
+	    d->bios_hd = strtol(cp + 1, &cp, 0);
+	    d->bios_sect = strtol(cp + 1, 0, 0);
+	}
     }
 
     cp = variable_get(VAR_PARTITION);

Modified: stable/7/usr.sbin/sysinstall/disks.c
==============================================================================
--- stable/7/usr.sbin/sysinstall/disks.c	Tue Mar 24 01:35:58 2009	(r190356)
+++ stable/7/usr.sbin/sysinstall/disks.c	Tue Mar 24 01:51:42 2009	(r190357)
@@ -106,6 +106,47 @@ record_chunks(Disk *d)
 static daddr_t Total;
 
 static void
+check_geometry(Disk *d)
+{
+    int sg;
+
+#ifdef PC98
+    if (d->bios_cyl >= 65536 || d->bios_hd > 256 || d->bios_sect >= 256)
+#else
+    if (d->bios_cyl > 65536 || d->bios_hd > 256 || d->bios_sect >= 64)
+#endif
+    {
+	dialog_clear_norefresh();
+	sg = msgYesNo("WARNING:  It is safe to use a geometry of %lu/%lu/%lu for %s on\n"
+		      "computers with modern BIOS versions.  If this disk is to be used\n"
+		      "on rather old machines, however, it is recommended to ensure that\n"
+		      "it does not have more than 65535 cylinders, or more than 255 heads\n"
+		      "or more than "
+#ifdef PC98
+		      "255"
+#else
+		      "63"
+#endif
+		      " sectors per track.\n"
+		      "\n"
+		      "Would you like that to keep using the current geometry?\n",
+		      d->bios_cyl, d->bios_hd, d->bios_sect, d->name);
+	if (sg == 1) {
+	    Sanitize_Bios_Geom(d);
+	    msgConfirm("A geometry of %lu/%lu/%lu was calculated for %s.\n"
+		       "\n"
+		       "If you are not sure about this, please consult the Hardware Guide\n"
+		       "in the Documentation submenu or use the (G)eometry command to\n"
+		       "change it.  Remember: you need to enter whatever your BIOS thinks\n"
+		       "the geometry is!  For IDE, it's what you were told in the BIOS\n"
+		       "setup.  For SCSI, it's the translation mode your controller is\n"
+		       "using.  Do NOT use a ``physical geometry''.\n",
+		       d->bios_cyl, d->bios_hd, d->bios_sect, d->name);
+	}
+    }
+}
+
+static void
 print_chunks(Disk *d, int u)
 {
     int row;
@@ -119,24 +160,6 @@ print_chunks(Disk *d, int u)
     Total = 0;
     for (i = 0; chunk_info[i]; i++)
 	Total += chunk_info[i]->size;
-#ifdef PC98
-    if (d->bios_cyl >= 65536 || d->bios_hd > 256 || d->bios_sect >= 256) {
-#else
-    if (d->bios_cyl > 65536 || d->bios_hd > 256 || d->bios_sect >= 64) {
-#endif
-	dialog_clear_norefresh();
-	msgConfirm("WARNING:  A geometry of %lu/%lu/%lu for %s is incorrect.  Using\n"
-		   "a more likely geometry.  If this geometry is incorrect or you\n"
-		   "are unsure as to whether or not it's correct, please consult\n"
-		   "the Hardware Guide in the Documentation submenu or use the\n"
-		   "(G)eometry command to change it now.\n\n"
-		   "Remember: you need to enter whatever your BIOS thinks the\n"
-		   "geometry is!  For IDE, it's what you were told in the BIOS\n"
-		   "setup. For SCSI, it's the translation mode your controller is\n"
-		   "using.  Do NOT use a ``physical geometry''.",
-	  d->bios_cyl, d->bios_hd, d->bios_sect, d->name);
-	Sanitize_Bios_Geom(d);
-    }
     attrset(A_NORMAL);
     mvaddstr(0, 0, "Disk name:\t");
     clrtobot();
@@ -341,6 +364,9 @@ diskPartition(Device *dev)
     /* Set up the chunk array */
     record_chunks(d);
 
+    /* Give the user a chance to sanitize the disk geometry, if necessary */
+    check_geometry(d);
+
     while (chunking) {
 	char *val, geometry[80];
 	    
@@ -916,21 +942,24 @@ diskPartitionNonInteractive(Device *dev)
     record_chunks(d);
     cp = variable_get(VAR_GEOMETRY);
     if (cp) {
-	msgDebug("Setting geometry from script to: %s\n", cp);
-	d->bios_cyl = strtol(cp, &cp, 0);
-	d->bios_hd = strtol(cp + 1, &cp, 0);
-	d->bios_sect = strtol(cp + 1, 0, 0);
-    } else {
+	if (!strcasecmp(cp, "sane")) {
 #ifdef PC98
-	if (d->bios_cyl >= 65536 || d->bios_hd > 256 || d->bios_sect >= 256) {
+	    if (d->bios_cyl >= 65536 || d->bios_hd > 256 || d->bios_sect >= 256)
 #else
-	if (d->bios_cyl > 65536 || d->bios_hd > 256 || d->bios_sect >= 64) {
+	    if (d->bios_cyl > 65536 || d->bios_hd > 256 || d->bios_sect >= 64)
 #endif
-	    msgDebug("Warning:  A geometry of %lu/%lu/%lu for %s is incorrect.\n",
-		d->bios_cyl, d->bios_hd, d->bios_sect, d->name);
-	    Sanitize_Bios_Geom(d);
-	    msgDebug("Sanitized geometry for %s is %lu/%lu/%lu.\n",
-		d->name, d->bios_cyl, d->bios_hd, d->bios_sect);
+	    {
+		msgDebug("Warning:  A geometry of %lu/%lu/%lu for %s is incorrect.\n",
+		    d->bios_cyl, d->bios_hd, d->bios_sect, d->name);
+		Sanitize_Bios_Geom(d);
+		msgDebug("Sanitized geometry for %s is %lu/%lu/%lu.\n",
+		    d->name, d->bios_cyl, d->bios_hd, d->bios_sect);
+	    }
+	} else {
+	    msgDebug("Setting geometry from script to: %s\n", cp);
+	    d->bios_cyl = strtol(cp, &cp, 0);
+	    d->bios_hd = strtol(cp + 1, &cp, 0);
+	    d->bios_sect = strtol(cp + 1, 0, 0);
 	}
     }
 

Modified: stable/7/usr.sbin/sysinstall/sysinstall.8
==============================================================================
--- stable/7/usr.sbin/sysinstall/sysinstall.8	Tue Mar 24 01:35:58 2009	(r190356)
+++ stable/7/usr.sbin/sysinstall/sysinstall.8	Tue Mar 24 01:51:42 2009	(r190357)
@@ -249,6 +249,12 @@ Invokes the disk partition (MBR) editor.
 .Bl -tag -width findx
 .It geometry
 The disk geometry, as a cyls/heads/sectors formatted string.
+The word "sane" instructs
+.Nm
+to calculate a safe (not necessarily optimal) geometry if the
+current one has more than 65535 cylinders, more than 256 heads or
+more than 63 sectors per track (255 sectors on the PC98
+architecture).
 Default: no
 change to geometry.
 .It partition



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