Author: brooks Date: Thu Dec 22 00:35:12 2016 New Revision: 310382 URL: https://svnweb.freebsd.org/changeset/base/310382
Log: Convert tunefs use to nmount(2) Reviewed by: jhb, emaste Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D8822 Modified: head/sbin/tunefs/Makefile head/sbin/tunefs/tunefs.c Modified: head/sbin/tunefs/Makefile ============================================================================== --- head/sbin/tunefs/Makefile Thu Dec 22 00:09:53 2016 (r310381) +++ head/sbin/tunefs/Makefile Thu Dec 22 00:35:12 2016 (r310382) @@ -3,9 +3,14 @@ PACKAGE=runtime PROG= tunefs +SRCS= tunefs.c getmntopts.c LIBADD= ufs MAN= tunefs.8 +MOUNT= ${SRCTOP}/sbin/mount +CFLAGS+= -I${MOUNT} +.PATH: ${MOUNT} + WARNS= 3 .include <bsd.prog.mk> Modified: head/sbin/tunefs/tunefs.c ============================================================================== --- head/sbin/tunefs/tunefs.c Thu Dec 22 00:09:53 2016 (r310381) +++ head/sbin/tunefs/tunefs.c Thu Dec 22 00:35:12 2016 (r310382) @@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$"); #include <fcntl.h> #include <fstab.h> #include <libufs.h> +#include <mntopts.h> #include <paths.h> #include <stdio.h> #include <stdlib.h> @@ -93,9 +94,11 @@ main(int argc, char *argv[]) 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 ufs_args args; struct statfs stfs; + struct iovec *iov = NULL; + char errmsg[255] = {0}; if (argc < 3) usage(); @@ -556,10 +559,16 @@ main(int argc, char *argv[]) goto err; ufs_disk_close(&disk); if (active) { - bzero(&args, sizeof(args)); - if (mount("ufs", on, - stfs.f_flags | MNT_UPDATE | MNT_RELOAD, &args) < 0) - err(9, "%s: reload", special); + 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"); } exit(0); _______________________________________________ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"