* Copyright (c) 1993 Paul Kranenburg
* 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 Paul Kranenburg.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software withough specific prior written permission
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 SUCH DAMAGE.
* $Id: procfs_vfsops.c,v 1.1 1993/12/12 12:26:41 davidg Exp $
* PROCFS VFS interface routines
extern struct vnodeops pfs_vnodeops
;
struct vfsops procfs_vfsops
= {
pfs_mount(mp
, path
, data
, ndp
, p
)
register struct mount
*mp
;
if (mp
->mnt_flag
& MNT_UPDATE
) {
if (error
= copyin(data
, (caddr_t
)&args
, sizeof (struct pfs_args
)))
(void) copyinstr(path
, (caddr_t
)mp
->mnt_stat
.f_mntonname
, MNAMELEN
, &size
);
bzero(mp
->mnt_stat
.f_mntonname
+ size
, MNAMELEN
- size
);
size
= sizeof("proc") - 1;
bcopy("proc", mp
->mnt_stat
.f_mntfromname
, size
);
bzero(mp
->mnt_stat
.f_mntfromname
+ size
, MNAMELEN
- size
);
(void) pfs_statfs(mp
, &mp
->mnt_stat
, p
);
pfs_unmount(mp
, mntflags
, p
)
struct pfsnode
*pfsp
, **pp
;
/* Look in "cache" first */
for (pfsp
= pfshead
; pfsp
!= NULL
; pfsp
= pfsp
->pfs_next
) {
if (pfsp
->pfs_vnode
->v_flag
& VROOT
) {
/* Not on list, allocate new vnode */
error
= getnewvnode(VT_PROCFS
, mp
, &pfs_vnodeops
, &vp
);
pfsp
->pfs_gid
= 2; /* XXX group kmem */
pfsp
->pfs_mode
= 0750; /* /proc = drwxr-x--- */
/* Append to pfs node list */
pfsp
->pfs_next
= pfshead
;
error
= getnewvnode(VT_PROCFS
, mp
, &pfs_vnodeops
, &vp
);
pfsp
->pfs_gid
= 2; /* XXX group kmem */
pfsp
->pfs_mode
= 0750; /* /proc = drwxr-x--- */
* Get file system statistics.
sbp
->f_type
= MOUNT_PROCFS
;
sbp
->f_bfree
= maxproc
- nprocs
;
sbp
->f_bavail
= sbp
->f_bfree
;
sbp
->f_files
= maxproc
; /* plus . and .. */
sbp
->f_ffree
= maxproc
- nprocs
;
pfs_quotactl(mp
, cmds
, uid
, arg
, p
)
register struct mount
*mp
;