Subject: bin/454: tunefs should be able to report current parameters
To: None <gnats-admin>
From: Arne H Juul <arnej@dsl.unit.no>
List: netbsd-bugs
Date: 09/02/1994 14:05:03
>Number:         454
>Category:       bin
>Synopsis:       tunefs can only change parameters, not report them.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    gnats-admin (Utility Bug People)
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Fri Sep  2 14:05:00 1994
>Originator:     Arne H Juul
>Organization:
University of Trondheim, Norway
>Release:        
>Environment:
	NetBSD-current as of yesterday
System: NetBSD skarven.dsl.unit.no 1.0_BETA NetBSD 1.0_BETA (SKARVEN) #2: Sun Jul 31 16:32:24 MET DST 1994 arnej@skarven.dsl.unit.no:/usr/src/sys/arch/i386/compile/SKARVEN i386


>Description:
	If you want to find out what one of the tunable parameters are
	without changing it, you have to change it and then change it
	back.
>How-To-Repeat:
	tunefs
	# and read the usage message
>Fix:
	Here's a patch that adds an -R option, documents it and the
	-A flag, and gives a more normal usage message. tunefs could
	probably also be converted to use getopt() - do you want me to
	look into this?

diff -rcP /usr/src/sbin/tunefs/tunefs.8 ./sbin/tunefs/tunefs.8
*** /usr/src/sbin/tunefs/tunefs.8	Thu Jun  9 12:11:39 1994
--- ./sbin/tunefs/tunefs.8	Thu Sep  1 14:01:42 1994
***************
*** 40,45 ****
--- 40,47 ----
  .Nd tune up an existing file system
  .Sh SYNOPSIS
  .Nm tunefs
+ .Op Fl A
+ .Op Fl R
  .Op Fl a Ar maxcontig
  .Op Fl d Ar rotdelay
  .Op Fl e Ar maxbpg
***************
*** 55,60 ****
--- 57,66 ----
  The parameters which are to be changed are indicated by the flags
  given below:
  .Bl -tag -width Ds
+ .It Fl A
+ Also update the alternate superblocks.
+ .It Fl R
+ Report the current values.
  .It Fl a Ar maxcontig
  This specifies the maximum number of contiguous blocks that will
  be laid out before forcing a rotational delay (see
diff -rcP /usr/src/sbin/tunefs/tunefs.c ./sbin/tunefs/tunefs.c
*** /usr/src/sbin/tunefs/tunefs.c	Thu Jun  9 12:11:39 1994
--- ./sbin/tunefs/tunefs.c	Thu Sep  1 14:01:09 1994
***************
*** 114,119 ****
--- 114,140 ----
  		for (cp = &argv[0][1]; *cp; cp++)
  			switch (*cp) {
  
+ 			case 'R':
+ 				name = "maximum contiguous block count";
+ 				warnx("%s is %d", name, sblock.fs_maxcontig);
+ 				name =
+ 				   "rotational delay between contiguous blocks";
+ 				warnx("%s is %d", name, sblock.fs_rotdelay);
+ 				name =
+ 				  "maximum blocks per file in a cylinder group";
+ 				warnx("%s is %d", name, sblock.fs_maxbpg);
+ 				name = "minimum percentage of free space";
+ 				warnx("%s is %d", name, sblock.fs_minfree);
+ 				name = "optimization preference";
+ 				chg[FS_OPTSPACE] = "space";
+ 				chg[FS_OPTTIME] = "time";
+ 				warnx("%s is %s", name,
+ 					((sblock.fs_optim == FS_OPTSPACE)
+ 					 || (sblock.fs_optim == FS_OPTTIME)) ?
+ 						chg[sblock.fs_optim] :
+ 						"unknown");
+ 				continue;
+ 
  			case 'A':
  				Aflag++;
  				continue;
***************
*** 227,239 ****
  usage()
  {
  
! 	fprintf(stderr, "Usage: tunefs tuneup-options special-device\n");
! 	fprintf(stderr, "where tuneup-options are:\n");
! 	fprintf(stderr, "\t-a maximum contiguous blocks\n");
! 	fprintf(stderr, "\t-d rotational delay between contiguous blocks\n");
! 	fprintf(stderr, "\t-e maximum blocks per file in a cylinder group\n");
! 	fprintf(stderr, "\t-m minimum percentage of free space\n");
! 	fprintf(stderr, "\t-o optimization preference (`space' or `time')\n");
  	exit(2);
  }
  
--- 248,256 ----
  usage()
  {
  
! 	fprintf(stderr, "usage: tunefs [-AR] [-a maxcontig] [-o optpref]\n");
! 	fprintf(stderr, "              [-d rotdelay] [-e maxbpg] ");
! 	fprintf(stderr, "[-m minfree] device\n");
  	exit(2);
  }
  
>Audit-Trail:
>Unformatted:


------------------------------------------------------------------------------