Source-Changes-HG archive

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

[src/trunk]: src/sbin/newfs For mount_mfs, allow an 'm' suffix to the file sy...



details:   https://anonhg.NetBSD.org/src/rev/69319ceae398
branches:  trunk
changeset: 499888:69319ceae398
user:      simonb <simonb%NetBSD.org@localhost>
date:      Fri Dec 01 12:48:09 2000 +0000

description:
For mount_mfs, allow an 'm' suffix to the file system size option to
specify the size of the mfs in megabytes.

Inspired by the Solaris tmpfs "-o size=sz" option.

diffstat:

 sbin/newfs/newfs.8 |   8 ++++++--
 sbin/newfs/newfs.c |  22 ++++++++++++++++------
 2 files changed, 22 insertions(+), 8 deletions(-)

diffs (78 lines):

diff -r 51f83a3b1b64 -r 69319ceae398 sbin/newfs/newfs.8
--- a/sbin/newfs/newfs.8        Fri Dec 01 12:28:30 2000 +0000
+++ b/sbin/newfs/newfs.8        Fri Dec 01 12:48:09 2000 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: newfs.8,v 1.24 1999/05/16 20:58:49 ad Exp $
+.\"    $NetBSD: newfs.8,v 1.25 2000/12/01 12:48:09 simonb Exp $
 .\"
 .\" Copyright (c) 1983, 1987, 1991, 1993, 1994
 .\"    The Regents of the University of California.  All rights reserved.
@@ -207,7 +207,11 @@
 .Xr tunefs 8
 for more details on how to set this option.
 .It Fl s Ar size
-The size of the file system in sectors.
+The size of the file system in sectors.  For
+.Nm mount_mfs
+an
+.Sq m
+suffix will be interpreted as a number of megabytes.
 .El
 .Pp
 The following options override the standard sizes for the disk geometry.
diff -r 51f83a3b1b64 -r 69319ceae398 sbin/newfs/newfs.c
--- a/sbin/newfs/newfs.c        Fri Dec 01 12:28:30 2000 +0000
+++ b/sbin/newfs/newfs.c        Fri Dec 01 12:48:09 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: newfs.c,v 1.40 2000/12/01 11:52:54 simonb Exp $        */
+/*     $NetBSD: newfs.c,v 1.41 2000/12/01 12:48:09 simonb Exp $        */
 
 /*
  * Copyright (c) 1983, 1989, 1993, 1994
@@ -43,7 +43,7 @@
 #if 0
 static char sccsid[] = "@(#)newfs.c    8.13 (Berkeley) 5/1/95";
 #else
-__RCSID("$NetBSD: newfs.c,v 1.40 2000/12/01 11:52:54 simonb Exp $");
+__RCSID("$NetBSD: newfs.c,v 1.41 2000/12/01 12:48:09 simonb Exp $");
 #endif
 #endif /* not lint */
 
@@ -192,15 +192,14 @@
 int
 main(int argc, char *argv[])
 {
-       int ch;
        struct partition *pp;
        struct disklabel *lp;
        struct disklabel mfsfakelabel;
        struct partition oldpartition;
        struct stat st;
        struct statfs *mp;
-       int fsi = 0, fso, len, n, maxpartitions;
-       char *cp = NULL, *s1, *s2, *special, *opstring;
+       int ch, fsi = 0, fso, len, maxpartitions, n;
+       char *cp = NULL, *endp, *opstring, *s1, *s2, *special;
 #ifdef MFS
        char mountfromname[100];
        pid_t pid, res;
@@ -321,7 +320,18 @@
                                errx(1, "%s: bad revolutions/minute", optarg);
                        break;
                case 's':
-                       if ((fssize = atoi(optarg)) <= 0)
+                       fssize = (int)strtol(optarg, &endp, 10);
+                       if (*endp) {
+                               if (mfs) {      /* Only do 'm' for mfs */
+                                       if (*endp == 'm' || *endp == 'M')
+                                               fssize *= 1024 * 1024 / 512;
+                                       else
+                                               fssize = -1;    /* error */
+                               }
+                               else
+                                       fssize = -1;    /* error */
+                       }
+                       if (fssize <= 0)
                                errx(1, "%s: bad file system size", optarg);
                        break;
                case 't':



Home | Main Index | Thread Index | Old Index