* Copyright (c) 1989, 1990 The Regents of the University of California.
* Redistribution and use in source and binary forms are permitted
* provided that the above copyright notice and this paragraph are
* duplicated in all such forms and that any documentation,
* advertising materials, and other materials related to such
* distribution and use acknowledge that the software was developed
* by the University of California, Berkeley. The name of the
* University may not be used to endorse or promote products derived
* from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
* @(#)mfs_vfsops.c 7.16 (Berkeley) %G%
#include "../ufs/quota.h"
#include "../ufs/inode.h"
#include "../ufs/ufsmount.h"
#include "../ufs/mfsnode.h"
extern struct vnodeops mfs_vnodeops
;
struct vfsops mfs_vfsops
= {
mfs_mount(mp
, path
, data
, ndp
)
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
= u
.u_procp
->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
,
(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
);
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
);
struct proc
*p
= u
.u_procp
;
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
) != 0)
* Get file system statistics.
error
= ufs_statfs(mp
, sbp
);