Convert tunefs use to nmount(2)
Reviewed by: jhb, emaste Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D8822
This commit is contained in:
parent
716911af3e
commit
98acad147a
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=310382
@ -3,9 +3,14 @@
|
|||||||
|
|
||||||
PACKAGE=runtime
|
PACKAGE=runtime
|
||||||
PROG= tunefs
|
PROG= tunefs
|
||||||
|
SRCS= tunefs.c getmntopts.c
|
||||||
LIBADD= ufs
|
LIBADD= ufs
|
||||||
MAN= tunefs.8
|
MAN= tunefs.8
|
||||||
|
|
||||||
|
MOUNT= ${SRCTOP}/sbin/mount
|
||||||
|
CFLAGS+= -I${MOUNT}
|
||||||
|
.PATH: ${MOUNT}
|
||||||
|
|
||||||
WARNS= 3
|
WARNS= 3
|
||||||
|
|
||||||
.include <bsd.prog.mk>
|
.include <bsd.prog.mk>
|
||||||
|
@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <fstab.h>
|
#include <fstab.h>
|
||||||
#include <libufs.h>
|
#include <libufs.h>
|
||||||
|
#include <mntopts.h>
|
||||||
#include <paths.h>
|
#include <paths.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -93,9 +94,11 @@ main(int argc, char *argv[])
|
|||||||
int kvalue, Lflag, lflag, mflag, mvalue, Nflag, nflag, oflag, ovalue;
|
int kvalue, Lflag, lflag, mflag, mvalue, Nflag, nflag, oflag, ovalue;
|
||||||
int pflag, sflag, svalue, Svalue, tflag;
|
int pflag, sflag, svalue, Svalue, tflag;
|
||||||
int ch, found_arg, i;
|
int ch, found_arg, i;
|
||||||
|
int iovlen = 0;
|
||||||
const char *chg[2];
|
const char *chg[2];
|
||||||
struct ufs_args args;
|
|
||||||
struct statfs stfs;
|
struct statfs stfs;
|
||||||
|
struct iovec *iov = NULL;
|
||||||
|
char errmsg[255] = {0};
|
||||||
|
|
||||||
if (argc < 3)
|
if (argc < 3)
|
||||||
usage();
|
usage();
|
||||||
@ -556,10 +559,16 @@ main(int argc, char *argv[])
|
|||||||
goto err;
|
goto err;
|
||||||
ufs_disk_close(&disk);
|
ufs_disk_close(&disk);
|
||||||
if (active) {
|
if (active) {
|
||||||
bzero(&args, sizeof(args));
|
build_iovec_argf(&iov, &iovlen, "fstype", "ufs");
|
||||||
if (mount("ufs", on,
|
build_iovec_argf(&iov, &iovlen, "fspath", "%s", on);
|
||||||
stfs.f_flags | MNT_UPDATE | MNT_RELOAD, &args) < 0)
|
build_iovec(&iov, &iovlen, "errmsg", errmsg, sizeof(errmsg));
|
||||||
err(9, "%s: reload", special);
|
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");
|
warnx("file system reloaded");
|
||||||
}
|
}
|
||||||
exit(0);
|
exit(0);
|
||||||
|
Loading…
Reference in New Issue
Block a user