From 1c0f77f024b01c2df41c395b7e5afd760d0a9062 Mon Sep 17 00:00:00 2001 From: peter Date: Tue, 11 Mar 1997 12:40:45 +0000 Subject: Merge from Lite2 (use new getvfsbyname() and mount(2) interface) --- sbin/mount_union/Makefile | 1 + sbin/mount_union/mount_union.c | 17 +++++++++-------- 2 files changed, 10 insertions(+), 8 deletions(-) (limited to 'sbin/mount_union') diff --git a/sbin/mount_union/Makefile b/sbin/mount_union/Makefile index e213137..6ac36c9 100644 --- a/sbin/mount_union/Makefile +++ b/sbin/mount_union/Makefile @@ -5,6 +5,7 @@ SRCS= mount_union.c getmntopts.c MAN8= mount_union.8 MOUNT= ${.CURDIR}/../mount +CFLAGS+= -D_NEW_VFSCONF CFLAGS+= -I${.CURDIR}/../../sys -I${MOUNT} .PATH: ${MOUNT} diff --git a/sbin/mount_union/mount_union.c b/sbin/mount_union/mount_union.c index 54c4647..cb5e406 100644 --- a/sbin/mount_union/mount_union.c +++ b/sbin/mount_union/mount_union.c @@ -74,7 +74,8 @@ main(argc, argv) struct union_args args; int ch, mntflags; char target[MAXPATHLEN]; - struct vfsconf *vfc; + struct vfsconf vfc; + int error; mntflags = 0; args.mntflags = UNMNT_ABOVE; @@ -111,17 +112,17 @@ main(argc, argv) args.target = target; - vfc = getvfsbyname("union"); - if(!vfc && vfsisloadable("union")) { - if(vfsload("union")) - err(1, "vfsload(union)"); + error = getvfsbyname("union", &vfc); + if (error && vfsisloadable("union")) { + if (vfsload("union")) + err(EX_OSERR, "vfsload(union)"); endvfsent(); /* flush cache */ - vfc = getvfsbyname("union"); + error = getvfsbyname("union", &vfc); } - if (!vfc) + if (error) errx(EX_OSERR, "union filesystem is not available"); - if (mount(vfc->vfc_index, argv[1], mntflags, &args)) + if (mount(vfc.vfc_name, argv[1], mntflags, &args)) err(EX_OSERR, target); exit(0); } -- cgit v1.1