2008-01-02 14:48:20 +03:00
|
|
|
/* $NetBSD: sysvbfs_vfsops.c,v 1.21 2008/01/02 11:48:46 ad Exp $ */
|
2005-12-29 17:53:45 +03:00
|
|
|
|
|
|
|
/*-
|
|
|
|
* Copyright (c) 2004 The NetBSD Foundation, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This code is derived from software contributed to The NetBSD Foundation
|
|
|
|
* by UCHIYAMA Yasushi.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 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 NetBSD
|
|
|
|
* Foundation, Inc. and its contributors.
|
|
|
|
* 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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 SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <sys/cdefs.h>
|
2008-01-02 14:48:20 +03:00
|
|
|
__KERNEL_RCSID(0, "$NetBSD: sysvbfs_vfsops.c,v 1.21 2008/01/02 11:48:46 ad Exp $");
|
2005-12-29 17:53:45 +03:00
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/systm.h>
|
|
|
|
#include <sys/pool.h>
|
|
|
|
#include <sys/time.h>
|
|
|
|
#include <sys/ucred.h>
|
|
|
|
#include <sys/mount.h>
|
|
|
|
#include <sys/disklabel.h>
|
|
|
|
#include <sys/fcntl.h>
|
|
|
|
#include <sys/malloc.h>
|
2006-05-15 15:16:16 +04:00
|
|
|
#include <sys/kauth.h>
|
2007-07-21 23:06:20 +04:00
|
|
|
#include <sys/proc.h>
|
2005-12-29 17:53:45 +03:00
|
|
|
|
|
|
|
/* v-node */
|
|
|
|
#include <sys/namei.h>
|
|
|
|
#include <sys/vnode.h>
|
|
|
|
/* devsw */
|
|
|
|
#include <sys/conf.h>
|
|
|
|
|
|
|
|
#include <fs/sysvbfs/sysvbfs.h> /* external interface */
|
|
|
|
#include <fs/sysvbfs/bfs.h> /* internal interface */
|
|
|
|
|
|
|
|
#ifdef SYSVBFS_VNOPS_DEBUG
|
|
|
|
#define DPRINTF(fmt, args...) printf(fmt, ##args)
|
|
|
|
#else
|
|
|
|
#define DPRINTF(arg...) ((void)0)
|
|
|
|
#endif
|
|
|
|
|
2007-06-30 13:37:53 +04:00
|
|
|
MALLOC_JUSTDEFINE(M_SYSVBFS_VFS, "sysvbfs vfs", "sysvbfs vfs structures");
|
2005-12-29 17:53:45 +03:00
|
|
|
|
2007-06-30 13:37:53 +04:00
|
|
|
struct pool sysvbfs_node_pool;
|
2005-12-29 17:53:45 +03:00
|
|
|
|
|
|
|
int sysvbfs_mountfs(struct vnode *, struct mount *, struct lwp *);
|
|
|
|
|
|
|
|
int
|
2007-11-26 22:01:26 +03:00
|
|
|
sysvbfs_mount(struct mount *mp, const char *path, void *data, size_t *data_len)
|
2005-12-29 17:53:45 +03:00
|
|
|
{
|
2007-11-26 22:01:26 +03:00
|
|
|
struct lwp *l = curlwp;
|
2007-08-01 01:14:15 +04:00
|
|
|
struct nameidata nd;
|
2007-07-12 23:35:32 +04:00
|
|
|
struct sysvbfs_args *args = data;
|
2005-12-29 17:53:45 +03:00
|
|
|
struct sysvbfs_mount *bmp = NULL;
|
|
|
|
struct vnode *devvp = NULL;
|
|
|
|
int error;
|
2007-02-22 01:59:35 +03:00
|
|
|
bool update;
|
2005-12-29 17:53:45 +03:00
|
|
|
|
2007-12-15 03:39:14 +03:00
|
|
|
DPRINTF("%s: mnt_flag=%x\n", __func__, mp->mnt_flag);
|
2005-12-29 17:53:45 +03:00
|
|
|
|
2007-07-12 23:35:32 +04:00
|
|
|
if (*data_len < sizeof *args)
|
|
|
|
return EINVAL;
|
|
|
|
|
2005-12-29 17:53:45 +03:00
|
|
|
if (mp->mnt_flag & MNT_GETARGS) {
|
|
|
|
if ((bmp = (void *)mp->mnt_data) == NULL)
|
|
|
|
return EIO;
|
2007-07-12 23:35:32 +04:00
|
|
|
args->fspec = NULL;
|
|
|
|
*data_len = sizeof *args;
|
|
|
|
return 0;
|
2005-12-29 17:53:45 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-12-15 03:39:14 +03:00
|
|
|
DPRINTF("%s: args->fspec=%s\n", __func__, args->fspec);
|
2005-12-29 17:53:45 +03:00
|
|
|
update = mp->mnt_flag & MNT_UPDATE;
|
2007-07-12 23:35:32 +04:00
|
|
|
if (args->fspec == NULL) {
|
2005-12-29 17:53:45 +03:00
|
|
|
/* nothing to do. */
|
|
|
|
return EINVAL;
|
|
|
|
}
|
|
|
|
|
2007-07-12 23:35:32 +04:00
|
|
|
if (args->fspec != NULL) {
|
2005-12-29 17:53:45 +03:00
|
|
|
/* Look up the name and verify that it's sane. */
|
2007-12-08 22:29:36 +03:00
|
|
|
NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, args->fspec);
|
2007-08-01 01:14:15 +04:00
|
|
|
if ((error = namei(&nd)) != 0)
|
2005-12-29 17:53:45 +03:00
|
|
|
return (error);
|
2007-08-01 01:14:15 +04:00
|
|
|
devvp = nd.ni_vp;
|
2005-12-29 17:53:45 +03:00
|
|
|
|
|
|
|
if (!update) {
|
|
|
|
/*
|
|
|
|
* Be sure this is a valid block device
|
|
|
|
*/
|
|
|
|
if (devvp->v_type != VBLK)
|
|
|
|
error = ENOTBLK;
|
|
|
|
else if (bdevsw_lookup(devvp->v_specinfo->si_rdev) ==
|
|
|
|
NULL)
|
|
|
|
error = ENXIO;
|
|
|
|
} else {
|
|
|
|
/*
|
|
|
|
* Be sure we're still naming the same device
|
|
|
|
* used for our initial mount
|
|
|
|
*/
|
|
|
|
if (devvp != bmp->devvp)
|
|
|
|
error = EINVAL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* If mount by non-root, then verify that user has necessary
|
|
|
|
* permissions on the device.
|
|
|
|
*/
|
2007-01-04 18:42:37 +03:00
|
|
|
if (error == 0 && kauth_authorize_generic(l->l_cred,
|
|
|
|
KAUTH_GENERIC_ISSUSER, NULL)) {
|
2005-12-29 17:53:45 +03:00
|
|
|
int accessmode = VREAD;
|
|
|
|
if (update ?
|
|
|
|
(mp->mnt_iflag & IMNT_WANTRDWR) != 0 :
|
|
|
|
(mp->mnt_flag & MNT_RDONLY) == 0)
|
|
|
|
accessmode |= VWRITE;
|
|
|
|
vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY);
|
2007-11-26 22:01:26 +03:00
|
|
|
error = VOP_ACCESS(devvp, accessmode, l->l_cred);
|
2005-12-29 17:53:45 +03:00
|
|
|
VOP_UNLOCK(devvp, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (error) {
|
|
|
|
vrele(devvp);
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!update) {
|
|
|
|
if ((error = sysvbfs_mountfs(devvp, mp, l)) != 0) {
|
|
|
|
vrele(devvp);
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
} else if (mp->mnt_flag & MNT_RDONLY) {
|
|
|
|
/* XXX: r/w -> read only */
|
|
|
|
}
|
|
|
|
|
2007-07-12 23:35:32 +04:00
|
|
|
return set_statvfs_info(path, UIO_USERSPACE, args->fspec, UIO_USERSPACE,
|
2007-07-17 15:19:31 +04:00
|
|
|
mp->mnt_op->vfs_name, mp, l);
|
2005-12-29 17:53:45 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
sysvbfs_mountfs(struct vnode *devvp, struct mount *mp, struct lwp *l)
|
|
|
|
{
|
2006-07-24 02:06:03 +04:00
|
|
|
kauth_cred_t cred = l->l_cred;
|
2005-12-29 17:53:45 +03:00
|
|
|
struct sysvbfs_mount *bmp;
|
|
|
|
struct partinfo dpart;
|
|
|
|
int error;
|
|
|
|
|
|
|
|
if ((error = vfs_mountedon(devvp)) != 0)
|
|
|
|
return error; /* Already mounted */
|
|
|
|
if (vcount(devvp) > 1)
|
|
|
|
return EBUSY; /* Opened by other */
|
|
|
|
vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY);
|
|
|
|
error = vinvalbuf(devvp, V_SAVE, cred, l, 0, 0);
|
|
|
|
VOP_UNLOCK(devvp, 0);
|
|
|
|
if (error)
|
|
|
|
return error;
|
|
|
|
|
|
|
|
/* Open block device */
|
2007-11-26 22:01:26 +03:00
|
|
|
if ((error = VOP_OPEN(devvp, FREAD, NOCRED)) != 0)
|
2005-12-29 17:53:45 +03:00
|
|
|
return error;
|
|
|
|
|
2006-02-25 05:28:55 +03:00
|
|
|
/* Get partition information */
|
2007-11-26 22:01:26 +03:00
|
|
|
if ((error = VOP_IOCTL(devvp, DIOCGPART, &dpart, FREAD, cred)) != 0)
|
2005-12-29 17:53:45 +03:00
|
|
|
return error;
|
|
|
|
|
|
|
|
bmp = malloc(sizeof(struct sysvbfs_mount), M_SYSVBFS_VFS, M_WAITOK);
|
|
|
|
if (bmp == NULL)
|
|
|
|
return ENOMEM;
|
|
|
|
bmp->devvp = devvp;
|
|
|
|
bmp->mountp = mp;
|
|
|
|
if ((error = sysvbfs_bfs_init(&bmp->bfs, devvp)) != 0) {
|
|
|
|
free(bmp, M_SYSVBFS_VFS);
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
LIST_INIT(&bmp->bnode_head);
|
|
|
|
|
|
|
|
mp->mnt_data = bmp;
|
|
|
|
mp->mnt_stat.f_fsidx.__fsid_val[0] = (long)devvp->v_rdev;
|
|
|
|
mp->mnt_stat.f_fsidx.__fsid_val[1] = makefstype(MOUNT_SYSVBFS);
|
|
|
|
mp->mnt_stat.f_fsid = mp->mnt_stat.f_fsidx.__fsid_val[0];
|
|
|
|
mp->mnt_flag |= MNT_LOCAL;
|
2007-06-28 16:33:18 +04:00
|
|
|
mp->mnt_dev_bshift = BFS_BSHIFT;
|
2005-12-29 17:53:45 +03:00
|
|
|
mp->mnt_fs_bshift = BFS_BSHIFT;
|
|
|
|
|
|
|
|
DPRINTF("fstype=%d dtype=%d bsize=%d\n", dpart.part->p_fstype,
|
|
|
|
dpart.disklab->d_type, dpart.disklab->d_secsize);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2007-11-26 22:01:26 +03:00
|
|
|
sysvbfs_start(struct mount *mp, int flags)
|
2005-12-29 17:53:45 +03:00
|
|
|
{
|
|
|
|
|
2007-12-15 03:39:14 +03:00
|
|
|
DPRINTF("%s:\n", __func__);
|
2005-12-29 17:53:45 +03:00
|
|
|
/* Nothing to do. */
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2007-11-26 22:01:26 +03:00
|
|
|
sysvbfs_unmount(struct mount *mp, int mntflags)
|
2005-12-29 17:53:45 +03:00
|
|
|
{
|
|
|
|
struct sysvbfs_mount *bmp = (void *)mp->mnt_data;
|
|
|
|
int error;
|
|
|
|
|
2007-12-15 03:39:14 +03:00
|
|
|
DPRINTF("%s: %p\n", __func__, bmp);
|
2005-12-29 17:53:45 +03:00
|
|
|
|
|
|
|
if ((error = vflush(mp, NULLVP,
|
|
|
|
mntflags & MNT_FORCE ? FORCECLOSE : 0)) != 0)
|
|
|
|
return error;
|
|
|
|
|
|
|
|
vn_lock(bmp->devvp, LK_EXCLUSIVE | LK_RETRY);
|
2007-11-26 22:01:26 +03:00
|
|
|
error = VOP_CLOSE(bmp->devvp, FREAD, NOCRED);
|
2005-12-29 17:53:45 +03:00
|
|
|
vput(bmp->devvp);
|
|
|
|
|
|
|
|
sysvbfs_bfs_fini(bmp->bfs);
|
|
|
|
|
|
|
|
free(bmp, M_SYSVBFS_VFS);
|
|
|
|
mp->mnt_data = NULL;
|
|
|
|
mp->mnt_flag &= ~MNT_LOCAL;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
sysvbfs_root(struct mount *mp, struct vnode **vpp)
|
|
|
|
{
|
|
|
|
struct vnode *vp;
|
|
|
|
int error;
|
|
|
|
|
2007-12-15 03:39:14 +03:00
|
|
|
DPRINTF("%s:\n", __func__);
|
2005-12-29 17:53:45 +03:00
|
|
|
if ((error = VFS_VGET(mp, BFS_ROOT_INODE, &vp)) != 0)
|
|
|
|
return error;
|
|
|
|
*vpp = vp;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2007-11-26 22:01:26 +03:00
|
|
|
sysvbfs_statvfs(struct mount *mp, struct statvfs *f)
|
2005-12-29 17:53:45 +03:00
|
|
|
{
|
|
|
|
struct sysvbfs_mount *bmp = mp->mnt_data;
|
|
|
|
struct bfs *bfs = bmp->bfs;
|
|
|
|
int free_block;
|
|
|
|
size_t data_block;
|
|
|
|
|
|
|
|
data_block = (bfs->data_end - bfs->data_start) >> BFS_BSHIFT;
|
|
|
|
if (bfs_inode_alloc(bfs, 0, 0, &free_block) != 0)
|
|
|
|
free_block = 0;
|
|
|
|
else
|
|
|
|
free_block = (bfs->data_end >> BFS_BSHIFT) - free_block;
|
|
|
|
|
2007-12-15 03:39:14 +03:00
|
|
|
DPRINTF("%s: %d %d %d\n", __func__, bfs->data_start,
|
2005-12-29 17:53:45 +03:00
|
|
|
bfs->data_end, free_block);
|
|
|
|
|
|
|
|
f->f_bsize = BFS_BSIZE;
|
|
|
|
f->f_frsize = BFS_BSIZE;
|
|
|
|
f->f_iosize = BFS_BSIZE;
|
|
|
|
f->f_blocks = data_block;
|
|
|
|
f->f_bfree = free_block;
|
|
|
|
f->f_bavail = f->f_bfree;
|
|
|
|
f->f_bresvd = 0;
|
|
|
|
f->f_files = bfs->n_inode;
|
|
|
|
f->f_ffree = bfs->max_inode - f->f_files;
|
|
|
|
f->f_favail = f->f_ffree;
|
|
|
|
f->f_fresvd = 0;
|
|
|
|
copy_statvfs_info(f, mp);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2007-11-26 22:01:26 +03:00
|
|
|
sysvbfs_sync(struct mount *mp, int waitfor, kauth_cred_t cred)
|
2005-12-29 17:53:45 +03:00
|
|
|
{
|
|
|
|
struct sysvbfs_mount *bmp = mp->mnt_data;
|
|
|
|
struct sysvbfs_node *bnode;
|
|
|
|
struct vnode *v;
|
|
|
|
int err, error;
|
|
|
|
|
2007-12-15 03:39:14 +03:00
|
|
|
DPRINTF("%s:\n", __func__);
|
2005-12-29 17:53:45 +03:00
|
|
|
error = 0;
|
2008-01-02 14:48:20 +03:00
|
|
|
mutex_enter(&mntvnode_lock);
|
2005-12-29 17:53:45 +03:00
|
|
|
for (bnode = LIST_FIRST(&bmp->bnode_head); bnode != NULL;
|
|
|
|
bnode = LIST_NEXT(bnode, link)) {
|
|
|
|
v = bnode->vnode;
|
2008-01-02 14:48:20 +03:00
|
|
|
mutex_enter(&v->v_interlock);
|
|
|
|
mutex_exit(&mntvnode_lock);
|
2005-12-29 17:53:45 +03:00
|
|
|
err = vget(v, LK_EXCLUSIVE | LK_NOWAIT | LK_INTERLOCK);
|
|
|
|
if (err == 0) {
|
2007-11-26 22:01:26 +03:00
|
|
|
err = VOP_FSYNC(v, cred, FSYNC_WAIT, 0, 0);
|
2005-12-29 17:53:45 +03:00
|
|
|
vput(v);
|
|
|
|
}
|
|
|
|
if (err != 0)
|
|
|
|
error = err;
|
2008-01-02 14:48:20 +03:00
|
|
|
mutex_enter(&mntvnode_lock);
|
2005-12-29 17:53:45 +03:00
|
|
|
}
|
2008-01-02 14:48:20 +03:00
|
|
|
mutex_exit(&mntvnode_lock);
|
2005-12-29 17:53:45 +03:00
|
|
|
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
sysvbfs_vget(struct mount *mp, ino_t ino, struct vnode **vpp)
|
|
|
|
{
|
|
|
|
struct sysvbfs_mount *bmp = mp->mnt_data;
|
|
|
|
struct bfs *bfs = bmp->bfs;
|
|
|
|
struct vnode *vp;
|
|
|
|
struct sysvbfs_node *bnode;
|
|
|
|
struct bfs_inode *inode;
|
|
|
|
int error;
|
|
|
|
|
2007-12-15 03:39:14 +03:00
|
|
|
DPRINTF("%s: i-node=%d\n", __func__, ino);
|
2005-12-29 17:53:45 +03:00
|
|
|
/* Lookup requested i-node */
|
|
|
|
if (!bfs_inode_lookup(bfs, ino, &inode)) {
|
|
|
|
DPRINTF("bfs_inode_lookup failed.\n");
|
|
|
|
return ENOENT;
|
|
|
|
}
|
|
|
|
for (bnode = LIST_FIRST(&bmp->bnode_head); bnode != NULL;
|
|
|
|
bnode = LIST_NEXT(bnode, link)) {
|
|
|
|
if (bnode->inode->number == ino) {
|
|
|
|
*vpp = bnode->vnode;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Allocate v-node. */
|
|
|
|
if ((error = getnewvnode(VT_SYSVBFS, mp, sysvbfs_vnodeop_p, &vp)) !=
|
|
|
|
0) {
|
2007-12-15 03:39:14 +03:00
|
|
|
DPRINTF("%s: getnewvnode error.\n", __func__);
|
2005-12-29 17:53:45 +03:00
|
|
|
return error;
|
|
|
|
}
|
|
|
|
/* Lock vnode here */
|
|
|
|
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
|
|
|
|
|
|
|
|
/* Allocate i-node */
|
|
|
|
vp->v_data = pool_get(&sysvbfs_node_pool, PR_WAITOK);
|
|
|
|
memset(vp->v_data, 0, sizeof(struct sysvbfs_node));
|
|
|
|
bnode = vp->v_data;
|
2008-01-02 14:48:20 +03:00
|
|
|
mutex_enter(&mntvnode_lock);
|
2005-12-29 17:53:45 +03:00
|
|
|
LIST_INSERT_HEAD(&bmp->bnode_head, bnode, link);
|
2008-01-02 14:48:20 +03:00
|
|
|
mutex_exit(&mntvnode_lock);
|
2005-12-29 17:53:45 +03:00
|
|
|
bnode->vnode = vp;
|
|
|
|
bnode->bmp = bmp;
|
|
|
|
bnode->inode = inode;
|
|
|
|
bnode->lockf = NULL; /* advlock */
|
|
|
|
|
|
|
|
if (ino == BFS_ROOT_INODE) { /* BFS is flat filesystem */
|
|
|
|
vp->v_type = VDIR;
|
2007-10-11 00:42:20 +04:00
|
|
|
vp->v_vflag |= VV_ROOT;
|
2005-12-29 17:53:45 +03:00
|
|
|
} else {
|
|
|
|
vp->v_type = VREG;
|
|
|
|
}
|
|
|
|
|
|
|
|
genfs_node_init(vp, &sysvbfs_genfsops);
|
2007-09-08 23:19:37 +04:00
|
|
|
uvm_vnp_setsize(vp, bfs_file_size(inode));
|
2005-12-29 17:53:45 +03:00
|
|
|
*vpp = vp;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
sysvbfs_fhtovp(struct mount *mp, struct fid *fid, struct vnode **vpp)
|
|
|
|
{
|
|
|
|
|
2007-12-15 03:39:14 +03:00
|
|
|
DPRINTF("%s:\n", __func__);
|
2005-12-29 17:53:45 +03:00
|
|
|
/* notyet */
|
|
|
|
return EOPNOTSUPP;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2006-07-13 16:00:24 +04:00
|
|
|
sysvbfs_vptofh(struct vnode *vpp, struct fid *fid, size_t *fh_size)
|
2005-12-29 17:53:45 +03:00
|
|
|
{
|
|
|
|
|
2007-12-15 03:39:14 +03:00
|
|
|
DPRINTF("%s:\n", __func__);
|
2005-12-29 17:53:45 +03:00
|
|
|
/* notyet */
|
|
|
|
return EOPNOTSUPP;
|
|
|
|
}
|
|
|
|
|
2007-06-30 13:37:53 +04:00
|
|
|
MALLOC_DECLARE(M_BFS);
|
|
|
|
MALLOC_DECLARE(M_SYSVBFS_VNODE);
|
|
|
|
|
2005-12-29 17:53:45 +03:00
|
|
|
void
|
|
|
|
sysvbfs_init(void)
|
|
|
|
{
|
|
|
|
|
2007-12-15 03:39:14 +03:00
|
|
|
DPRINTF("%s:\n", __func__);
|
2007-06-30 13:37:53 +04:00
|
|
|
malloc_type_attach(M_SYSVBFS_VFS);
|
|
|
|
malloc_type_attach(M_BFS);
|
|
|
|
malloc_type_attach(M_SYSVBFS_VNODE);
|
|
|
|
pool_init(&sysvbfs_node_pool, sizeof(struct sysvbfs_node), 0, 0, 0,
|
|
|
|
"sysvbfs_node_pool", &pool_allocator_nointr, IPL_NONE);
|
2005-12-29 17:53:45 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
sysvbfs_reinit(void)
|
|
|
|
{
|
|
|
|
|
|
|
|
/* Nothing to do. */
|
2007-12-15 03:39:14 +03:00
|
|
|
DPRINTF("%s:\n", __func__);
|
2005-12-29 17:53:45 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
sysvbfs_done(void)
|
|
|
|
{
|
|
|
|
|
2007-12-15 03:39:14 +03:00
|
|
|
DPRINTF("%s:\n", __func__);
|
2005-12-29 17:53:45 +03:00
|
|
|
pool_destroy(&sysvbfs_node_pool);
|
2007-06-30 13:37:53 +04:00
|
|
|
malloc_type_detach(M_BFS);
|
|
|
|
malloc_type_detach(M_SYSVBFS_VFS);
|
|
|
|
malloc_type_detach(M_SYSVBFS_VNODE);
|
2005-12-29 17:53:45 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
sysvbfs_gop_alloc(struct vnode *vp, off_t off, off_t len, int flags,
|
2006-05-15 01:31:52 +04:00
|
|
|
kauth_cred_t cred)
|
2005-12-29 17:53:45 +03:00
|
|
|
{
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|