From 8f867039068a77f88a1c28228f9ce127217ea353 Mon Sep 17 00:00:00 2001 From: Bruce Evans Date: Mon, 3 Mar 1997 13:23:54 +0000 Subject: [PATCH] Updated mount_msdos to use the Lite2 getvfsbyname() interface. --- sbin/i386/mount_msdos/Makefile | 3 ++- sbin/i386/mount_msdos/mount_msdos.c | 23 ++++++++++++----------- sbin/mount_msdos/Makefile | 3 ++- sbin/mount_msdos/mount_msdos.c | 23 ++++++++++++----------- sbin/mount_msdosfs/Makefile | 3 ++- sbin/mount_msdosfs/mount_msdosfs.c | 23 ++++++++++++----------- 6 files changed, 42 insertions(+), 36 deletions(-) diff --git a/sbin/i386/mount_msdos/Makefile b/sbin/i386/mount_msdos/Makefile index b0460ef42905..f6c88ab34c32 100644 --- a/sbin/i386/mount_msdos/Makefile +++ b/sbin/i386/mount_msdos/Makefile @@ -1,5 +1,5 @@ # -# $Id$ +# $Id: Makefile,v 1.4 1997/02/22 14:32:29 peter Exp $ # PROG= mount_msdos @@ -10,6 +10,7 @@ BINOWN= root BINMODE= 4555 MOUNT= ${.CURDIR}/../../mount +CFLAGS+= -D_NEW_VFSCONF CFLAGS+= -I${MOUNT} .PATH: ${MOUNT} diff --git a/sbin/i386/mount_msdos/mount_msdos.c b/sbin/i386/mount_msdos/mount_msdos.c index 590ced714387..dff366b2df62 100644 --- a/sbin/i386/mount_msdos/mount_msdos.c +++ b/sbin/i386/mount_msdos/mount_msdos.c @@ -30,14 +30,15 @@ #ifndef lint static const char rcsid[] = - "$Id$"; + "$Id: mount_msdos.c,v 1.7 1997/02/22 14:32:30 peter Exp $"; #endif /* not lint */ -#include #include -#define MSDOSFS #include #include + +#include + #include #include #include @@ -67,9 +68,9 @@ main(argc, argv) { struct msdosfs_args args; struct stat sb; - int c, mntflags, set_gid, set_uid, set_mask; + int c, error, mntflags, set_gid, set_uid, set_mask; char *dev, *dir, ndir[MAXPATHLEN+1]; - struct vfsconf *vfc; + struct vfsconf vfc; mntflags = set_gid = set_uid = set_mask = 0; (void)memset(&args, '\0', sizeof(args)); @@ -131,17 +132,17 @@ main(argc, argv) args.mask = sb.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO); } - vfc = getvfsbyname("msdos"); - if(!vfc && vfsisloadable("msdos")) { - if(vfsload("msdos")) + error = getvfsbyname("msdos", &vfc); + if (error && vfsisloadable("msdos")) { + if (vfsload("msdos")) err(EX_OSERR, "vfsload(msdos)"); endvfsent(); /* clear cache */ - vfc = getvfsbyname("msdos"); + error = getvfsbyname("msdos", &vfc); } - if (!vfc) + if (error) errx(EX_OSERR, "msdos filesystem is not available"); - if (mount(vfc->vfc_index, dir, mntflags, &args) < 0) + if (mount(vfc.vfc_name, dir, mntflags, &args) < 0) err(EX_OSERR, "%s", dev); exit (0); diff --git a/sbin/mount_msdos/Makefile b/sbin/mount_msdos/Makefile index b0460ef42905..f6c88ab34c32 100644 --- a/sbin/mount_msdos/Makefile +++ b/sbin/mount_msdos/Makefile @@ -1,5 +1,5 @@ # -# $Id$ +# $Id: Makefile,v 1.4 1997/02/22 14:32:29 peter Exp $ # PROG= mount_msdos @@ -10,6 +10,7 @@ BINOWN= root BINMODE= 4555 MOUNT= ${.CURDIR}/../../mount +CFLAGS+= -D_NEW_VFSCONF CFLAGS+= -I${MOUNT} .PATH: ${MOUNT} diff --git a/sbin/mount_msdos/mount_msdos.c b/sbin/mount_msdos/mount_msdos.c index 590ced714387..dff366b2df62 100644 --- a/sbin/mount_msdos/mount_msdos.c +++ b/sbin/mount_msdos/mount_msdos.c @@ -30,14 +30,15 @@ #ifndef lint static const char rcsid[] = - "$Id$"; + "$Id: mount_msdos.c,v 1.7 1997/02/22 14:32:30 peter Exp $"; #endif /* not lint */ -#include #include -#define MSDOSFS #include #include + +#include + #include #include #include @@ -67,9 +68,9 @@ main(argc, argv) { struct msdosfs_args args; struct stat sb; - int c, mntflags, set_gid, set_uid, set_mask; + int c, error, mntflags, set_gid, set_uid, set_mask; char *dev, *dir, ndir[MAXPATHLEN+1]; - struct vfsconf *vfc; + struct vfsconf vfc; mntflags = set_gid = set_uid = set_mask = 0; (void)memset(&args, '\0', sizeof(args)); @@ -131,17 +132,17 @@ main(argc, argv) args.mask = sb.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO); } - vfc = getvfsbyname("msdos"); - if(!vfc && vfsisloadable("msdos")) { - if(vfsload("msdos")) + error = getvfsbyname("msdos", &vfc); + if (error && vfsisloadable("msdos")) { + if (vfsload("msdos")) err(EX_OSERR, "vfsload(msdos)"); endvfsent(); /* clear cache */ - vfc = getvfsbyname("msdos"); + error = getvfsbyname("msdos", &vfc); } - if (!vfc) + if (error) errx(EX_OSERR, "msdos filesystem is not available"); - if (mount(vfc->vfc_index, dir, mntflags, &args) < 0) + if (mount(vfc.vfc_name, dir, mntflags, &args) < 0) err(EX_OSERR, "%s", dev); exit (0); diff --git a/sbin/mount_msdosfs/Makefile b/sbin/mount_msdosfs/Makefile index b0460ef42905..f6c88ab34c32 100644 --- a/sbin/mount_msdosfs/Makefile +++ b/sbin/mount_msdosfs/Makefile @@ -1,5 +1,5 @@ # -# $Id$ +# $Id: Makefile,v 1.4 1997/02/22 14:32:29 peter Exp $ # PROG= mount_msdos @@ -10,6 +10,7 @@ BINOWN= root BINMODE= 4555 MOUNT= ${.CURDIR}/../../mount +CFLAGS+= -D_NEW_VFSCONF CFLAGS+= -I${MOUNT} .PATH: ${MOUNT} diff --git a/sbin/mount_msdosfs/mount_msdosfs.c b/sbin/mount_msdosfs/mount_msdosfs.c index 590ced714387..dff366b2df62 100644 --- a/sbin/mount_msdosfs/mount_msdosfs.c +++ b/sbin/mount_msdosfs/mount_msdosfs.c @@ -30,14 +30,15 @@ #ifndef lint static const char rcsid[] = - "$Id$"; + "$Id: mount_msdos.c,v 1.7 1997/02/22 14:32:30 peter Exp $"; #endif /* not lint */ -#include #include -#define MSDOSFS #include #include + +#include + #include #include #include @@ -67,9 +68,9 @@ main(argc, argv) { struct msdosfs_args args; struct stat sb; - int c, mntflags, set_gid, set_uid, set_mask; + int c, error, mntflags, set_gid, set_uid, set_mask; char *dev, *dir, ndir[MAXPATHLEN+1]; - struct vfsconf *vfc; + struct vfsconf vfc; mntflags = set_gid = set_uid = set_mask = 0; (void)memset(&args, '\0', sizeof(args)); @@ -131,17 +132,17 @@ main(argc, argv) args.mask = sb.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO); } - vfc = getvfsbyname("msdos"); - if(!vfc && vfsisloadable("msdos")) { - if(vfsload("msdos")) + error = getvfsbyname("msdos", &vfc); + if (error && vfsisloadable("msdos")) { + if (vfsload("msdos")) err(EX_OSERR, "vfsload(msdos)"); endvfsent(); /* clear cache */ - vfc = getvfsbyname("msdos"); + error = getvfsbyname("msdos", &vfc); } - if (!vfc) + if (error) errx(EX_OSERR, "msdos filesystem is not available"); - if (mount(vfc->vfc_index, dir, mntflags, &args) < 0) + if (mount(vfc.vfc_name, dir, mntflags, &args) < 0) err(EX_OSERR, "%s", dev); exit (0);