newfs.c (75078) | newfs.c (75377) |
---|---|
1/* 2 * Copyright (c) 1983, 1989, 1993, 1994 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 28 unchanged lines hidden (view full) --- 37 The Regents of the University of California. All rights reserved.\n"; 38#endif /* not lint */ 39 40#ifndef lint 41#if 0 42static char sccsid[] = "@(#)newfs.c 8.13 (Berkeley) 5/1/95"; 43#endif 44static const char rcsid[] = | 1/* 2 * Copyright (c) 1983, 1989, 1993, 1994 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 28 unchanged lines hidden (view full) --- 37 The Regents of the University of California. All rights reserved.\n"; 38#endif /* not lint */ 39 40#ifndef lint 41#if 0 42static char sccsid[] = "@(#)newfs.c 8.13 (Berkeley) 5/1/95"; 43#endif 44static const char rcsid[] = |
45 "$FreeBSD: head/sbin/newfs/newfs.c 75078 2001-04-02 01:25:55Z obrien $"; | 45 "$FreeBSD: head/sbin/newfs/newfs.c 75377 2001-04-10 08:38:59Z mckusick $"; |
46#endif /* not lint */ 47 48/* 49 * newfs: friendly front end to mkfs 50 */ 51#include <sys/param.h> 52#include <sys/stat.h> 53#include <sys/disklabel.h> --- 104 unchanged lines hidden (view full) --- 158 159/* 160 * About the same time as the above, we knew what went where on the disks. 161 * no longer so, so kill the code which finds the different platters too... 162 * We do this by saying one head, with a lot of sectors on it. 163 * The number of sectors are used to determine the size of a cyl-group. 164 * Kirk suggested one or two meg per "cylinder" so we say two. 165 */ | 46#endif /* not lint */ 47 48/* 49 * newfs: friendly front end to mkfs 50 */ 51#include <sys/param.h> 52#include <sys/stat.h> 53#include <sys/disklabel.h> --- 104 unchanged lines hidden (view full) --- 158 159/* 160 * About the same time as the above, we knew what went where on the disks. 161 * no longer so, so kill the code which finds the different platters too... 162 * We do this by saying one head, with a lot of sectors on it. 163 * The number of sectors are used to determine the size of a cyl-group. 164 * Kirk suggested one or two meg per "cylinder" so we say two. 165 */ |
166 | |
167#define NTRACKS 1 /* number of heads */ | 166#define NTRACKS 1 /* number of heads */ |
168 | |
169#define NSECTORS 4096 /* number of sectors */ 170 171int mfs; /* run as the memory based filesystem */ 172char *mfs_mtpt; /* mount point for mfs */ 173struct stat mfs_mtstat; /* stat prior to mount */ 174int Nflag; /* run without writing file system */ 175int Oflag; /* format as an 4.3BSD file system */ 176int Uflag; /* enable soft updates for file system */ --- 17 unchanged lines hidden (view full) --- 194int cpgflg; /* cylinders/cylinder group flag was given */ 195int minfree = MINFREE; /* free space threshold */ 196int opt = DEFAULTOPT; /* optimization preference (space or time) */ 197int density; /* number of bytes per inode */ 198int maxcontig = 0; /* max contiguous blocks to allocate */ 199int rotdelay = ROTDELAY; /* rotational delay between blocks */ 200int maxbpg; /* maximum blocks per file in a cyl group */ 201int nrpos = NRPOS; /* # of distinguished rotational positions */ | 167#define NSECTORS 4096 /* number of sectors */ 168 169int mfs; /* run as the memory based filesystem */ 170char *mfs_mtpt; /* mount point for mfs */ 171struct stat mfs_mtstat; /* stat prior to mount */ 172int Nflag; /* run without writing file system */ 173int Oflag; /* format as an 4.3BSD file system */ 174int Uflag; /* enable soft updates for file system */ --- 17 unchanged lines hidden (view full) --- 192int cpgflg; /* cylinders/cylinder group flag was given */ 193int minfree = MINFREE; /* free space threshold */ 194int opt = DEFAULTOPT; /* optimization preference (space or time) */ 195int density; /* number of bytes per inode */ 196int maxcontig = 0; /* max contiguous blocks to allocate */ 197int rotdelay = ROTDELAY; /* rotational delay between blocks */ 198int maxbpg; /* maximum blocks per file in a cyl group */ 199int nrpos = NRPOS; /* # of distinguished rotational positions */ |
200int avgfilesize = AVFILESIZ;/* expected average file size */ 201int avgfilesperdir = AFPDIR;/* expected number of files per directory */ |
|
202int bbsize = BBSIZE; /* boot block size */ 203int sbsize = SBSIZE; /* superblock size */ 204int mntflags = MNT_ASYNC; /* flags to be passed to mount */ 205int t_or_u_flag = 0; /* user has specified -t or -u */ 206u_long memleft; /* virtual memory available */ 207caddr_t membase; /* start address of memory based filesystem */ 208char *filename; 209#ifdef COMPAT --- 41 unchanged lines hidden (view full) --- 251"WARNING: MFS is being phased out in preference for md devices\n" 252"WARNING: Please see mdconfig(8) for details\n" 253"WARNING: Continuing in 15 seconds\n"); 254 sleep(15); 255 256 } 257 258 opstring = mfs ? | 202int bbsize = BBSIZE; /* boot block size */ 203int sbsize = SBSIZE; /* superblock size */ 204int mntflags = MNT_ASYNC; /* flags to be passed to mount */ 205int t_or_u_flag = 0; /* user has specified -t or -u */ 206u_long memleft; /* virtual memory available */ 207caddr_t membase; /* start address of memory based filesystem */ 208char *filename; 209#ifdef COMPAT --- 41 unchanged lines hidden (view full) --- 251"WARNING: MFS is being phased out in preference for md devices\n" 252"WARNING: Please see mdconfig(8) for details\n" 253"WARNING: Continuing in 15 seconds\n"); 254 sleep(15); 255 256 } 257 258 opstring = mfs ? |
259 "NF:T:Ua:b:c:d:e:f:i:m:o:s:" : 260 "NOS:T:Ua:b:c:d:e:f:i:k:l:m:n:o:p:r:s:t:u:vx:"; | 259 "NF:T:Ua:b:c:d:e:f:g:h:i:m:o:s:" : 260 "NOS:T:Ua:b:c:d:e:f:g:h:i:k:l:m:n:o:p:r:s:t:u:vx:"; |
261 while ((ch = getopt(argc, argv, opstring)) != -1) 262 switch (ch) { 263 case 'N': 264 Nflag = 1; 265 break; 266 case 'O': 267 Oflag = 1; 268 break; --- 34 unchanged lines hidden (view full) --- 303 if ((maxbpg = atoi(optarg)) <= 0) 304 fatal("%s: bad blocks per file in a cylinder group", 305 optarg); 306 break; 307 case 'f': 308 if ((fsize = atoi(optarg)) <= 0) 309 fatal("%s: bad fragment size", optarg); 310 break; | 261 while ((ch = getopt(argc, argv, opstring)) != -1) 262 switch (ch) { 263 case 'N': 264 Nflag = 1; 265 break; 266 case 'O': 267 Oflag = 1; 268 break; --- 34 unchanged lines hidden (view full) --- 303 if ((maxbpg = atoi(optarg)) <= 0) 304 fatal("%s: bad blocks per file in a cylinder group", 305 optarg); 306 break; 307 case 'f': 308 if ((fsize = atoi(optarg)) <= 0) 309 fatal("%s: bad fragment size", optarg); 310 break; |
311 case 'g': 312 if ((avgfilesize = atoi(optarg)) <= 0) 313 fatal("%s: bad average file size", optarg); 314 break; 315 case 'h': 316 if ((avgfilesperdir = atoi(optarg)) <= 0) 317 fatal("%s: bad average files per dir", optarg); 318 break; |
|
311 case 'i': 312 if ((density = atoi(optarg)) <= 0) 313 fatal("%s: bad bytes per inode", optarg); 314 break; 315 case 'k': 316 if ((trackskew = atoi(optarg)) < 0) 317 fatal("%s: bad track skew", optarg); 318 break; --- 444 unchanged lines hidden (view full) --- 763#endif 764 fprintf(stderr, "\t-U enable soft updates\n"); 765 fprintf(stderr, "\t-a maximum contiguous blocks\n"); 766 fprintf(stderr, "\t-b block size\n"); 767 fprintf(stderr, "\t-c cylinders/group\n"); 768 fprintf(stderr, "\t-d rotational delay between contiguous blocks\n"); 769 fprintf(stderr, "\t-e maximum blocks per file in a cylinder group\n"); 770 fprintf(stderr, "\t-f frag size\n"); | 319 case 'i': 320 if ((density = atoi(optarg)) <= 0) 321 fatal("%s: bad bytes per inode", optarg); 322 break; 323 case 'k': 324 if ((trackskew = atoi(optarg)) < 0) 325 fatal("%s: bad track skew", optarg); 326 break; --- 444 unchanged lines hidden (view full) --- 771#endif 772 fprintf(stderr, "\t-U enable soft updates\n"); 773 fprintf(stderr, "\t-a maximum contiguous blocks\n"); 774 fprintf(stderr, "\t-b block size\n"); 775 fprintf(stderr, "\t-c cylinders/group\n"); 776 fprintf(stderr, "\t-d rotational delay between contiguous blocks\n"); 777 fprintf(stderr, "\t-e maximum blocks per file in a cylinder group\n"); 778 fprintf(stderr, "\t-f frag size\n"); |
779 fprintf(stderr, "\t-g average file size\n"); 780 fprintf(stderr, "\t-h average files per directory\n"); |
|
771 fprintf(stderr, "\t-i number of bytes per inode\n"); 772 fprintf(stderr, "\t-k sector 0 skew, per track\n"); 773 fprintf(stderr, "\t-l hardware sector interleave\n"); 774 fprintf(stderr, "\t-m minimum free space %%\n"); 775 fprintf(stderr, "\t-n number of distinguished rotational positions\n"); 776 fprintf(stderr, "\t-o optimization preference (`space' or `time')\n"); 777 fprintf(stderr, "\t-p spare sectors per track\n"); 778 fprintf(stderr, "\t-s file system size (sectors)\n"); 779 fprintf(stderr, "\t-r revolutions/minute\n"); 780 fprintf(stderr, "\t-t tracks/cylinder\n"); 781 fprintf(stderr, "\t-u sectors/track\n"); 782 fprintf(stderr, 783 "\t-v do not attempt to determine partition name from device name\n"); 784 fprintf(stderr, "\t-x spare sectors per cylinder\n"); 785 exit(1); 786} | 781 fprintf(stderr, "\t-i number of bytes per inode\n"); 782 fprintf(stderr, "\t-k sector 0 skew, per track\n"); 783 fprintf(stderr, "\t-l hardware sector interleave\n"); 784 fprintf(stderr, "\t-m minimum free space %%\n"); 785 fprintf(stderr, "\t-n number of distinguished rotational positions\n"); 786 fprintf(stderr, "\t-o optimization preference (`space' or `time')\n"); 787 fprintf(stderr, "\t-p spare sectors per track\n"); 788 fprintf(stderr, "\t-s file system size (sectors)\n"); 789 fprintf(stderr, "\t-r revolutions/minute\n"); 790 fprintf(stderr, "\t-t tracks/cylinder\n"); 791 fprintf(stderr, "\t-u sectors/track\n"); 792 fprintf(stderr, 793 "\t-v do not attempt to determine partition name from device name\n"); 794 fprintf(stderr, "\t-x spare sectors per cylinder\n"); 795 exit(1); 796} |