diff options
Diffstat (limited to 'sbin/newfs/newfs.c')
-rw-r--r-- | sbin/newfs/newfs.c | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/sbin/newfs/newfs.c b/sbin/newfs/newfs.c index afb71f9f25b4..418319d1cd3a 100644 --- a/sbin/newfs/newfs.c +++ b/sbin/newfs/newfs.c @@ -38,18 +38,6 @@ * SUCH DAMAGE. */ -#if 0 -#ifndef lint -static const 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 -static char sccsid[] = "@(#)newfs.c 8.13 (Berkeley) 5/1/95"; -#endif /* not lint */ -#endif -#include <sys/cdefs.h> /* * newfs: friendly front end to mkfs */ @@ -117,7 +105,6 @@ struct uufsd disk; /* libufs disk structure */ static char device[MAXPATHLEN]; static u_char bootarea[BBSIZE]; static int is_file; /* work on a file, not a device */ -static char *dkname; static char *disktype; static void getfssize(intmax_t *, const char *p, intmax_t, intmax_t); @@ -340,9 +327,7 @@ main(int argc, char *argv[]) if (fstat(disk.d_fd, &st) < 0) err(1, "%s", special); if ((st.st_mode & S_IFMT) != S_IFCHR) { - warn("%s: not a character-special device", special); is_file = 1; /* assume it is a file */ - dkname = special; if (sectorsize == 0) sectorsize = 512; mediasize = st.st_size; @@ -356,6 +341,11 @@ main(int argc, char *argv[]) } pp = NULL; lp = getdisklabel(); + /* + * set filesystem size from file size when a bsdlabel isn't present + */ + if (lp == NULL && is_file) + fssize = mediasize / sectorsize; if (lp != NULL) { if (!is_file) /* already set for files */ part_name = special[strlen(special) - 1]; @@ -395,6 +385,9 @@ main(int argc, char *argv[]) fprintf(stderr, "because minfree is less than %d%%\n", MINFREE); opt = FS_OPTSPACE; } + /* Use soft updates by default for UFS2 and above */ + if (Oflag > 1) + Uflag = 1; realsectorsize = sectorsize; if (sectorsize != DEV_BSIZE) { /* XXX */ int secperblk = sectorsize / DEV_BSIZE; @@ -442,7 +435,7 @@ getdisklabel(void) bootarea + (0 /* labeloffset */ + 1 /* labelsoffset */ * sectorsize), &lab, MAXPARTITIONS)) - errx(1, "no valid label found"); + return (NULL); lp = &lab; return &lab; |