aboutsummaryrefslogtreecommitdiff
path: root/sbin/tunefs/tunefs.c
diff options
context:
space:
mode:
Diffstat (limited to 'sbin/tunefs/tunefs.c')
-rw-r--r--sbin/tunefs/tunefs.c50
1 files changed, 6 insertions, 44 deletions
diff --git a/sbin/tunefs/tunefs.c b/sbin/tunefs/tunefs.c
index e59b583ea58b..6f6df8446cd9 100644
--- a/sbin/tunefs/tunefs.c
+++ b/sbin/tunefs/tunefs.c
@@ -29,20 +29,6 @@
* SUCH DAMAGE.
*/
-#if 0
-#ifndef lint
-static const char copyright[] =
-"@(#) Copyright (c) 1983, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
-#endif /* not lint */
-
-#ifndef lint
-static char sccsid[] = "@(#)tunefs.c 8.2 (Berkeley) 4/19/94";
-#endif /* not lint */
-#endif
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
/*
* tunefs: change layout parameters to an existing file system.
*/
@@ -80,7 +66,7 @@ static char clrbuf[MAXBSIZE];
static struct uufsd disk;
#define sblock disk.d_fs
-static void usage(void);
+static void usage(void) __dead2;
static void printfs(void);
static int journal_alloc(int64_t size);
static void journal_clear(void);
@@ -91,18 +77,14 @@ main(int argc, char *argv[])
{
const char *avalue, *jvalue, *Jvalue, *Lvalue, *lvalue, *Nvalue, *nvalue;
const char *tvalue;
- const char *special, *on;
+ const char *special;
const char *name;
- int active;
+ char *diskname;
int Aflag, aflag, eflag, evalue, fflag, fvalue, jflag, Jflag, kflag;
int kvalue, Lflag, lflag, mflag, mvalue, Nflag, nflag, oflag, ovalue;
int pflag, sflag, svalue, Svalue, tflag;
int ch, found_arg, i;
- int iovlen = 0;
const char *chg[2];
- struct statfs stfs;
- struct iovec *iov = NULL;
- char errmsg[255] = {0};
if (argc < 3)
usage();
@@ -110,7 +92,6 @@ main(int argc, char *argv[])
lflag = mflag = Nflag = nflag = oflag = pflag = sflag = tflag = 0;
avalue = jvalue = Jvalue = Lvalue = lvalue = Nvalue = nvalue = NULL;
evalue = fvalue = mvalue = ovalue = svalue = Svalue = 0;
- active = 0;
found_arg = 0; /* At least one arg is required. */
while ((ch = getopt(argc, argv, "Aa:e:f:j:J:k:L:l:m:N:n:o:ps:S:t:"))
!= -1)
@@ -309,7 +290,7 @@ main(int argc, char *argv[])
if (found_arg == 0 || argc != 1)
usage();
- on = special = argv[0];
+ special = argv[0];
if (ufs_disk_fillout(&disk, special) == -1)
goto err;
/*
@@ -319,13 +300,6 @@ main(int argc, char *argv[])
(sblock.fs_flags & (FS_UNCLEAN | FS_NEEDSFSCK)) != 0) &&
(found_arg > 1 || !pflag))
errx(1, "%s is not clean - run fsck.\n", special);
- if (disk.d_name != special) {
- if (statfs(special, &stfs) != 0)
- warn("Can't stat %s", special);
- if (strcmp(special, stfs.f_mntonname) == 0)
- active = 1;
- }
-
if (pflag) {
printfs();
exit(0);
@@ -570,20 +544,9 @@ main(int argc, char *argv[])
if (sbwrite(&disk, Aflag) == -1)
goto err;
+ diskname = strdup(disk.d_name);
ufs_disk_close(&disk);
- if (active) {
- build_iovec_argf(&iov, &iovlen, "fstype", "ufs");
- build_iovec_argf(&iov, &iovlen, "fspath", "%s", on);
- build_iovec(&iov, &iovlen, "errmsg", errmsg, sizeof(errmsg));
- if (nmount(iov, iovlen,
- stfs.f_flags | MNT_UPDATE | MNT_RELOAD) < 0) {
- if (errmsg[0])
- err(9, "%s: reload: %s", special, errmsg);
- else
- err(9, "%s: reload", special);
- }
- warnx("file system reloaded");
- }
+ chkdoreload(getmntpoint(diskname), warnx);
exit(0);
err:
if (disk.d_error != NULL)
@@ -976,7 +939,6 @@ journal_alloc(int64_t size)
*/
if (size == 0) {
size = (sblock.fs_size * sblock.fs_bsize) / 1024;
- size = MIN(SUJ_MAX, size);
if (size / sblock.fs_fsize > sblock.fs_fpg)
size = sblock.fs_fpg * sblock.fs_fsize;
size = MAX(SUJ_MIN, size);