* Copyright (c) 1989, 1990 The Regents of the University of California.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* from: @(#)mfs_vfsops.c 7.19 (Berkeley) 4/16/91
* $Id: mfs_vfsops.c,v 1.3 1993/10/16 18:17:42 rgrimes Exp $
extern struct vnodeops mfs_vnodeops
;
struct vfsops mfs_vfsops
= {
mfs_mount(mp
, path
, data
, ndp
, p
)
register struct mount
*mp
;
register struct mfsnode
*mfsp
;
if (mp
->mnt_flag
& MNT_UPDATE
) {
if (fs
->fs_ronly
&& (mp
->mnt_flag
& MNT_RDONLY
) == 0)
if (error
= copyin(data
, (caddr_t
)&args
, sizeof (struct mfs_args
)))
error
= getnewvnode(VT_MFS
, (struct mount
*)0, &mfs_vnodeops
, &devvp
);
if (checkalias(devvp
, makedev(255, mfs_minor
++), (struct mount
*)0))
panic("mfs_mount: dup dev");
mfsp
->mfs_baseoff
= args
.base
;
mfsp
->mfs_size
= args
.size
;
mfsp
->mfs_pid
= p
->p_pid
;
mfsp
->mfs_buflist
= (struct buf
*)0;
if (error
= mountfs(devvp
, mp
)) {
mfsp
->mfs_buflist
= (struct buf
*)-1;
(void) copyinstr(path
, fs
->fs_fsmnt
, sizeof(fs
->fs_fsmnt
) - 1, &size
);
bzero(fs
->fs_fsmnt
+ size
, sizeof(fs
->fs_fsmnt
) - size
);
bcopy((caddr_t
)fs
->fs_fsmnt
, (caddr_t
)mp
->mnt_stat
.f_mntonname
,
mp
->mnt_stat
.f_mntonname
[MNAMELEN
-1] = '\0';
(void) copyinstr(args
.name
, mp
->mnt_stat
.f_mntfromname
, MNAMELEN
- 1,
bzero(mp
->mnt_stat
.f_mntfromname
+ size
, MNAMELEN
- size
);
(void) mfs_statfs(mp
, &mp
->mnt_stat
);
if ((args
.flags
& MFSMNT_SIGPPID
) && (p
->p_pptr
!= initproc
))
(void)psignal(p
->p_pptr
, SIGUSR1
);
int mfs_pri
= PWAIT
| PCATCH
; /* XXX prob. temp */
* Used to grab the process and keep it in the kernel to service
* memory filesystem I/O requests.
* Loop servicing I/O requests.
* Copy the requested data into or out of the memory filesystem
register struct vnode
*vp
= VFSTOUFS(mp
)->um_devvp
;
register struct mfsnode
*mfsp
= VTOMFS(vp
);
base
= mfsp
->mfs_baseoff
;
while (mfsp
->mfs_buflist
!= (struct buf
*)(-1)) {
while (bp
= mfsp
->mfs_buflist
) {
mfsp
->mfs_buflist
= bp
->av_forw
;
* If a non-ignored signal is received, try to unmount.
* If that fails, clear the signal (it has been "processed"),
* otherwise we will loop here, as tsleep will always return
if (error
= tsleep((caddr_t
)vp
, mfs_pri
, "mfsidl", 0))
if (dounmount(mp
, MNT_NOFORCE
, p
) != 0)
* Get file system statistics.
error
= ufs_statfs(mp
, sbp
, p
);