rename old -a to -x, old -d to -u so above can have same values as `tunefs'
SCCS-vsn: sbin/newfs/mkfs.c 6.5
SCCS-vsn: sbin/newfs/newfs.c 6.11
-static char sccsid[] = "@(#)mkfs.c 6.4 (Berkeley) %G%";
+static char sccsid[] = "@(#)mkfs.c 6.5 (Berkeley) %G%";
#include <sys/dir.h>
#include <sys/disklabel.h>
#include <sys/dir.h>
#include <sys/disklabel.h>
-/*
- * MAXBLKPG determines the maximum number of data blocks which are
- * placed in a single cylinder group. This is currently a function
- * of the block and fragment size of the file system.
- */
-#define MAXBLKPG(fs) ((fs)->fs_fsize / sizeof(daddr_t))
-
#define UMASK 0755
#define MAXINOPB (MAXBSIZE / sizeof(struct dinode))
#define POWEROF2(num) (((num) & ((num) - 1)) == 0)
#define UMASK 0755
#define MAXINOPB (MAXBSIZE / sizeof(struct dinode))
#define POWEROF2(num) (((num) & ((num) - 1)) == 0)
extern int density; /* number of bytes per inode */
extern int maxcontig; /* max contiguous blocks to allocate */
extern int rotdelay; /* rotational delay between blocks */
extern int density; /* number of bytes per inode */
extern int maxcontig; /* max contiguous blocks to allocate */
extern int rotdelay; /* rotational delay between blocks */
+extern int maxbpg; /* maximum blocks per file in a cyl group */
extern int bbsize; /* boot block size */
extern int sbsize; /* superblock size */
extern int bbsize; /* boot block size */
extern int sbsize; /* superblock size */
sblock.fs_maxcontig = maxcontig;
sblock.fs_headswitch = headswitch;
sblock.fs_trkseek = trackseek;
sblock.fs_maxcontig = maxcontig;
sblock.fs_headswitch = headswitch;
sblock.fs_trkseek = trackseek;
- sblock.fs_maxbpg = MAXBLKPG(&sblock);
+ sblock.fs_maxbpg = maxbpg;
sblock.fs_rps = rpm / 60;
sblock.fs_optim = opt;
sblock.fs_cgrotor = 0;
sblock.fs_rps = rpm / 60;
sblock.fs_optim = opt;
sblock.fs_cgrotor = 0;
#endif not lint
#ifndef lint
#endif not lint
#ifndef lint
-static char sccsid[] = "@(#)newfs.c 6.10 (Berkeley) %G%";
+static char sccsid[] = "@(#)newfs.c 6.11 (Berkeley) %G%";
+/*
+ * MAXBLKPG determines the maximum number of data blocks which are
+ * placed in a single cylinder group. The default is one indirect
+ * block worth of data blocks.
+ */
+#define MAXBLKPG(bsize) ((bsize) / sizeof(daddr_t))
+
/*
* Each file system has a number of inodes statically allocated.
* We allocate one inode slot per NBPI bytes, expecting this
/*
* Each file system has a number of inodes statically allocated.
* We allocate one inode slot per NBPI bytes, expecting this
int density = NBPI; /* number of bytes per inode */
int maxcontig = MAXCONTIG; /* max contiguous blocks to allocate */
int rotdelay = ROTDELAY; /* rotational delay between blocks */
int density = NBPI; /* number of bytes per inode */
int maxcontig = MAXCONTIG; /* max contiguous blocks to allocate */
int rotdelay = ROTDELAY; /* rotational delay between blocks */
+int maxbpg; /* maximum blocks per file in a cyl group */
int bbsize = BBSIZE; /* boot block size */
int sbsize = SBSIZE; /* superblock size */
#ifdef COMPAT
int bbsize = BBSIZE; /* boot block size */
int sbsize = SBSIZE; /* superblock size */
#ifdef COMPAT
- fatal("-a: spare sectors per cylinder");
+ fatal("-a: missing max contiguous blocks\n");
- cylspares = atoi(*argv);
- if (cylspares < 0)
- fatal("%s: bad spare sectors per cylinder", *argv);
+ maxcontig = atoi(*argv);
+ if (maxcontig <= 0)
+ fatal("%s: bad max contiguous blocks\n",
+ *argv);
- fatal("-d: missing sectors/track");
+ fatal("-d: missing rotational delay\n");
- nsectors = atoi(*argv);
- if (nsectors <= 0)
- fatal("%s: bad sectors/track", *argv);
+ rotdelay = atoi(*argv);
+ if (rotdelay < 0)
+ fatal("%s: bad rotational delay\n",
+ *argv);
+ goto next;
+
+ case 'e':
+ if (argc < 1)
+ fatal("-e: missing blocks pre file in a cyl group\n");
+ argc--, argv++;
+ maxbpg = atoi(*argv);
+ if (maxbpg <= 0)
+ fatal("%s: bad blocks per file in a cyl group\n",
+ *argv);
fatal("%s: bad total tracks", *argv);
goto next;
fatal("%s: bad total tracks", *argv);
goto next;
+ case 'u':
+ if (argc < 1)
+ fatal("-u: missing sectors/track");
+ argc--, argv++;
+ nsectors = atoi(*argv);
+ if (nsectors <= 0)
+ fatal("%s: bad sectors/track", *argv);
+ goto next;
+
+ case 'x':
+ if (argc < 1)
+ fatal("-x: spare sectors per cylinder");
+ argc--, argv++;
+ cylspares = atoi(*argv);
+ if (cylspares < 0)
+ fatal("%s: bad spare sectors per cylinder", *argv);
+ goto next;
+
default:
fatal("-%c: unknown flag", cp);
}
default:
fatal("-%c: unknown flag", cp);
}
fprintf(stderr, "\t-m minimum free space %%\n");
fprintf(stderr, "\t-o optimization preference %s\n",
"(`space' or `time')");
fprintf(stderr, "\t-m minimum free space %%\n");
fprintf(stderr, "\t-o optimization preference %s\n",
"(`space' or `time')");
+ fprintf(stderr, "\t-a maximum contiguous blocks\n");
+ fprintf(stderr, "\t-d rotational delay between %s\n",
+ "contiguous blocks");
+ fprintf(stderr, "\t-e maximum blocks per file in a %s\n",
+ "cylinder group");
fprintf(stderr, "\t-i number of bytes per inode\n");
fprintf(stderr, "\t-c cylinders/group\n");
fprintf(stderr, "\t-s file system size (sectors)\n");
fprintf(stderr, "\t-r revolutions/minute\n");
fprintf(stderr, "\t-S sector size\n");
fprintf(stderr, "\t-i number of bytes per inode\n");
fprintf(stderr, "\t-c cylinders/group\n");
fprintf(stderr, "\t-s file system size (sectors)\n");
fprintf(stderr, "\t-r revolutions/minute\n");
fprintf(stderr, "\t-S sector size\n");
- fprintf(stderr, "\t-d sectors/track\n");
+ fprintf(stderr, "\t-u sectors/track\n");
fprintf(stderr, "\t-t tracks/cylinder\n");
fprintf(stderr, "\t-p spare sectors per track\n");
fprintf(stderr, "\t-t tracks/cylinder\n");
fprintf(stderr, "\t-p spare sectors per track\n");
- fprintf(stderr, "\t-a spare sectors per cylinder\n");
+ fprintf(stderr, "\t-x spare sectors per cylinder\n");
fprintf(stderr, "\t-l hardware sector interleave\n");
fprintf(stderr, "\t-k sector 0 skew, per track\n");
exit(1);
}
fprintf(stderr, "\t-l hardware sector interleave\n");
fprintf(stderr, "\t-k sector 0 skew, per track\n");
exit(1);
}
+ if (maxbpg == 0)
+ maxbpg = MAXBLKPG(bsize);
special = argv[0];
cp = rindex(special, '/');
if (cp != 0)
special = argv[0];
cp = rindex(special, '/');
if (cp != 0)