Define vfs_unmountall(), to unmount file systems at shutdown time.

This commit is contained in:
mycroft 1995-04-10 19:46:56 +00:00
parent 96dd4bc868
commit 6cabaea642

View File

@ -1,4 +1,4 @@
/* $NetBSD: vfs_subr.c,v 1.38 1995/01/18 06:24:21 mycroft Exp $ */
/* $NetBSD: vfs_subr.c,v 1.39 1995/04/10 19:46:56 mycroft Exp $ */
/*
* Copyright (c) 1989, 1993
@ -1474,3 +1474,23 @@ vaccess(file_mode, uid, gid, acc_mode, cred)
mask |= S_IWOTH;
return (file_mode & mask) == mask ? 0 : EACCES;
}
/*
* Unmount all file systems.
* We traverse the list in reverse order under the assumption that doing so
* will avoid needing to worry about dependencies.
*/
void
vfs_unmountall()
{
register struct mount *mp, *nmp;
int allerror;
for (allerror = 0,
mp = mountlist.cqh_last; mp != (void *)&mountlist; mp = nmp) {
nmp = mp->mnt_list.cqe_prev;
allerror |= dounmount(mp, MNT_FORCE, &proc0);
}
if (allerror)
printf("some file systems would not unmount\n");
}