diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2007-04-03 17:08:31 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2007-04-03 17:08:31 +0000 |
commit | 9fa7c75c6f6e912f55844da3c9d6f166d5b8bf49 (patch) | |
tree | b5df23d6a12c1d0a49db9807fa88656b7e5d386e /sbin/newfs | |
parent | d1387b393a35c23e692e945817d534ab11c9fda3 (diff) |
Minor cleanup: remove rcsids, remove #ifdef'd out code, COMPAT is
the default, quiet gcc. OK deraadt@
Diffstat (limited to 'sbin/newfs')
-rw-r--r-- | sbin/newfs/mkfs.c | 77 | ||||
-rw-r--r-- | sbin/newfs/newfs.c | 64 |
2 files changed, 10 insertions, 131 deletions
diff --git a/sbin/newfs/mkfs.c b/sbin/newfs/mkfs.c index d2e954395e5..c6116f2072b 100644 --- a/sbin/newfs/mkfs.c +++ b/sbin/newfs/mkfs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mkfs.c,v 1.52 2007/04/02 20:20:39 millert Exp $ */ +/* $OpenBSD: mkfs.c,v 1.53 2007/04/03 17:08:30 millert Exp $ */ /* $NetBSD: mkfs.c,v 1.25 1995/06/18 21:35:38 cgd Exp $ */ /* @@ -30,14 +30,6 @@ * SUCH DAMAGE. */ -#ifndef lint -#if 0 -static char sccsid[] = "@(#)mkfs.c 8.3 (Berkeley) 2/3/94"; -#else -static char rcsid[] = "$OpenBSD: mkfs.c,v 1.52 2007/04/02 20:20:39 millert Exp $"; -#endif -#endif /* not lint */ - #include <sys/param.h> #include <sys/time.h> #include <ufs/ufs/dinode.h> @@ -59,10 +51,6 @@ static char rcsid[] = "$OpenBSD: mkfs.c,v 1.52 2007/04/02 20:20:39 millert Exp $ #endif /* - * make file system for cylinder-group style file systems - */ - -/* * We limit the size of the inode map to be no more than a * third of the cylinder group space, since we must leave at * least an equal amount of space for the block map. @@ -76,17 +64,6 @@ static char rcsid[] = "$OpenBSD: mkfs.c,v 1.52 2007/04/02 20:20:39 millert Exp $ #define POWEROF2(num) (((num) & ((num) - 1)) == 0) /* - * For each cylinder we keep track of the availability of blocks at different - * rotational positions, so that we can lay out the data to be picked - * up with minimum rotational latency. NRPOS is the default number of - * rotational positions that we distinguish. With NRPOS of 8 the resolution - * of our summary information is 2ms for a typical 3600 rpm drive. Caching - * and zoning pretty much defeats rotational optimization, so we now use a - * default of 1. - */ -#define NRPOS 1 /* number distinct rotational positions */ - -/* * variables set up by front end. */ extern int mfs; /* run as the memory based filesystem */ @@ -285,7 +262,7 @@ recalc: sblock.fs_fsize, sblock.fs_bsize, sblock.fs_bsize / MAXFRAG); } - sblock.fs_nrpos = NRPOS; + sblock.fs_nrpos = 1; sblock.fs_nindir = sblock.fs_bsize / sizeof(daddr_t); sblock.fs_inopb = sblock.fs_bsize / sizeof(struct ufs1_dinode); sblock.fs_nspf = sblock.fs_fsize / sectorsize; @@ -851,18 +828,11 @@ initcg(int cylno, time_t utime) */ struct ufs1_dinode node; -#ifdef LOSTDIR -#define PREDEFDIR 3 -#else #define PREDEFDIR 2 -#endif struct direct root_dir[] = { { ROOTINO, sizeof(struct direct), DT_DIR, 1, "." }, { ROOTINO, sizeof(struct direct), DT_DIR, 2, ".." }, -#ifdef LOSTDIR - { LOSTFOUNDINO, sizeof(struct direct), DT_DIR, 10, "lost+found" }, -#endif }; struct odirect { u_int32_t d_ino; @@ -872,22 +842,7 @@ struct odirect { } oroot_dir[] = { { ROOTINO, sizeof(struct direct), 1, "." }, { ROOTINO, sizeof(struct direct), 2, ".." }, -#ifdef LOSTDIR - { LOSTFOUNDINO, sizeof(struct direct), 10, "lost+found" }, -#endif -}; -#ifdef LOSTDIR -struct direct lost_found_dir[] = { - { LOSTFOUNDINO, sizeof(struct direct), DT_DIR, 1, "." }, - { ROOTINO, sizeof(struct direct), DT_DIR, 2, ".." }, - { 0, DIRBLKSIZ, 0, 0, 0 }, -}; -struct odirect olost_found_dir[] = { - { LOSTFOUNDINO, sizeof(struct direct), 1, "." }, - { ROOTINO, sizeof(struct direct), 2, ".." }, - { 0, DIRBLKSIZ, 0, 0 }, }; -#endif int fsinit(time_t utime, mode_t mfsmode, uid_t mfsuid, gid_t mfsgid) @@ -898,34 +853,6 @@ fsinit(time_t utime, mode_t mfsmode, uid_t mfsuid, gid_t mfsgid) node.di_atime = utime; node.di_mtime = utime; node.di_ctime = utime; -#ifdef LOSTDIR - /* - * create the lost+found directory - */ - if (Oflag) { - int i; - - (void)makedir((struct direct *)olost_found_dir, 2); - for (i = DIRBLKSIZ; i < sblock.fs_bsize; i += DIRBLKSIZ) - memcpy(&buf[i], &olost_found_dir[2], - DIRSIZ(0, &olost_found_dir[2])); - } else { - int i; - - (void)makedir(lost_found_dir, 2); - for (i = DIRBLKSIZ; i < sblock.fs_bsize; i += DIRBLKSIZ) - memcpy(&buf[i], &lost_found_dir[2], - DIRSIZ(0, &lost_found_dir[2])); - } - node.di_mode = IFDIR | 1700; - node.di_nlink = 2; - node.di_size = sblock.fs_bsize; - if ((node.di_db[0] = alloc(node.di_size, node.di_mode)) == 0) - return (1); - node.di_blocks = btodb(fragroundup(&sblock, node.di_size)); - wtfs(fsbtodb(&sblock, node.di_db[0]), node.di_size, buf); - iput(&node, LOSTFOUNDINO); -#endif /* * create the root directory */ diff --git a/sbin/newfs/newfs.c b/sbin/newfs/newfs.c index 36d7a7eac44..e0871585951 100644 --- a/sbin/newfs/newfs.c +++ b/sbin/newfs/newfs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: newfs.c,v 1.53 2007/04/02 20:20:39 millert Exp $ */ +/* $OpenBSD: newfs.c,v 1.54 2007/04/03 17:08:30 millert Exp $ */ /* $NetBSD: newfs.c,v 1.20 1996/05/16 07:13:03 thorpej Exp $ */ /* @@ -30,23 +30,6 @@ * SUCH DAMAGE. */ -#ifndef lint -static char copyright[] = -"@(#) Copyright (c) 1983, 1989, 1993, 1994\n\ - The Regents of the University of California. All rights reserved.\n"; -#endif /* not lint */ - -#ifndef lint -#if 0 -static char sccsid[] = "@(#)newfs.c 8.8 (Berkeley) 4/18/94"; -#else -static char rcsid[] = "$OpenBSD: newfs.c,v 1.53 2007/04/02 20:20:39 millert Exp $"; -#endif -#endif /* not lint */ - -/* - * newfs: friendly front end to mkfs - */ #include <sys/param.h> #include <sys/types.h> #include <sys/stat.h> @@ -90,8 +73,6 @@ void mkfs(struct partition *, char *, int, int, mode_t, uid_t, gid_t); void rewritelabel(char *, int, struct disklabel *); u_short dkcksum(struct disklabel *); -#define COMPAT /* allow non-labeled disks */ - /* * The following two constants set the default block and fragment sizes. * Both constants must be a power of 2 and meet the following constraints: @@ -111,14 +92,6 @@ u_short dkcksum(struct disklabel *); #define DESCPG 65536 /* desired fs_cpg */ /* - * ROTDELAY gives the minimum number of milliseconds to initiate - * another disk transfer on the same cylinder. It is used in - * determining the rotationally optimal layout for disk blocks - * within a file; the default of fs_rotdelay is 0ms. - */ -#define ROTDELAY 0 - -/* * 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. @@ -153,7 +126,7 @@ int opt = DEFAULTOPT; /* optimization preference (space or time) */ int reqopt = -1; /* opt preference has not been specified */ int density; /* number of bytes per inode */ int maxcontig = 0; /* max contiguous blocks to allocate */ -int rotdelay = ROTDELAY; /* rotational delay between blocks */ +int rotdelay = 0; /* rotational delay between blocks */ int maxbpg; /* maximum blocks per file in a cyl group */ int avgfilesize = AVFILESIZ;/* expected average file size */ int avgfilesperdir = AFPDIR;/* expected number of files per directory */ @@ -163,11 +136,8 @@ int mntflags = MNT_ASYNC; /* flags to be passed to mount */ int quiet = 0; /* quiet flag */ u_long memleft; /* virtual memory available */ caddr_t membase; /* start address of memory based filesystem */ -#ifdef COMPAT char *disktype; int unlabeled; -#endif - char device[MAXPATHLEN]; extern char *__progname; @@ -201,9 +171,9 @@ main(int argc, char *argv[]) struct stat mountpoint; int status; #endif - uid_t mfsuid; - gid_t mfsgid; - mode_t mfsmode; + uid_t mfsuid = 0; + gid_t mfsgid = 0; + mode_t mfsmode = 0; char *fstype = NULL; char **saveargv = argv; int ffs = 1; @@ -230,11 +200,9 @@ main(int argc, char *argv[]) if ((sectorsize = atoi(optarg)) <= 0) fatal("%s: bad sector size", optarg); break; -#ifdef COMPAT case 'T': disktype = optarg; break; -#endif case 'a': if ((maxcontig = atoi(optarg)) <= 0) fatal("%s: bad maximum contiguous blocks\n", @@ -434,15 +402,12 @@ main(int argc, char *argv[]) ++mp; } } -#ifdef COMPAT if (mfs && disktype != NULL) { lp = (struct disklabel *)getdiskbyname(disktype); if (lp == NULL) fatal("%s: unknown disk type", disktype); pp = &lp->d_partitions[1]; - } else -#endif - { + } else { fsi = open(special, O_RDONLY); if (fsi < 0) fatal("%s: %s", special, strerror(errno)); @@ -537,10 +502,6 @@ havelabel: (unsigned long)lp->d_secpercyl); if (maxbpg == 0) maxbpg = MAXBLKPG(bsize); -#ifdef notdef /* label may be 0 if faked up by kernel */ - bbsize = lp->d_bbsize; - sbsize = lp->d_sbsize; -#endif oldpartition = *pp; realsectorsize = sectorsize; if (sectorsize < DEV_BSIZE) { @@ -664,11 +625,7 @@ havelabel: exit(0); } -#ifdef COMPAT char lmsg[] = "%s: can't read disk label; disk type must be specified"; -#else -char lmsg[] = "%s: can't read disk label"; -#endif struct disklabel * getdisklabel(char *s, int fd) @@ -676,8 +633,7 @@ getdisklabel(char *s, int fd) static struct disklabel lab; if (ioctl(fd, DIOCGDINFO, (char *)&lab) < 0) { -#ifdef COMPAT - if (disktype) { + if (disktype != NULL) { struct disklabel *lp; unlabeled++; @@ -686,7 +642,6 @@ getdisklabel(char *s, int fd) fatal("%s: unknown disk type", disktype); return (lp); } -#endif warn("ioctl (GDINFO)"); fatal(lmsg, s); } @@ -696,10 +651,9 @@ getdisklabel(char *s, int fd) void rewritelabel(char *s, int fd, struct disklabel *lp) { -#ifdef COMPAT if (unlabeled) return; -#endif + lp->d_checksum = 0; lp->d_checksum = dkcksum(lp); if (ioctl(fd, DIOCWDINFO, (char *)lp) < 0) { @@ -774,9 +728,7 @@ struct fsoptions { { "-P src populate mfs filesystem", 2 }, #endif { "-S sector size", 0 }, -#ifdef COMPAT { "-T disktype", 0 }, -#endif { "-a maximum contiguous blocks", 1 }, { "-b block size", 1 }, { "-c cylinders/group", 1 }, |