sharefs_vfsops.c revision a3175730a459223fb8f26a2915aa0a31f6b36f98
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/vfs_opreg.h>
#include <sys/sysmacros.h>
/*
* Kernel sharetab filesystem.
*
* This is a pseudo filesystem which exports information about shares currently
* in kernel memory. The only element of the pseudo filesystem is a file.
*
* This file contains functions that interact with the VFS layer.
*
* sharetab sharefs_datanode_t sharefs.c
*
*/
static const fs_operation_def_t sharefs_vfstops[];
static gfs_opsvec_t sharefs_opsvec[];
static int sharefs_init(int, char *);
/*
* The sharefs system call.
*/
static struct sysent sharefs_sysent = {
3,
};
"sharefs syscall",
};
#ifdef _SYSCALL32_IMPL
"sharefs syscall (32-bit)",
};
#endif /* _SYSCALL32_IMPL */
/*
* Module linkage
*/
static mntopts_t sharefs_mntopts = {
0,
};
"sharefs",
};
"sharetab filesystem",
&vfw
};
static struct modlinkage modlinkage = {
&modlfs,
&modlsys,
#ifdef _SYSCALL32_IMPL
#endif
};
int
_init(void)
{
return (mod_install(&modlinkage));
}
int
{
}
int
_fini(void)
{
/*
* The sharetab filesystem cannot be unloaded.
*/
return (EBUSY);
}
/*
* Filesystem initialization.
*/
static int sharefs_fstype;
static major_t sharefs_major;
static minor_t sharefs_minor;
static gfs_opsvec_t sharefs_opsvec[] = {
{ NULL }
};
/* ARGSUSED */
static int
{
int error;
return (error);
}
(void) vfs_freevfsops(vfsops);
return (error);
}
"sharefs_init: can't get unique device number");
sharefs_major = 0;
}
return (0);
}
/*
* VFS entry points
*/
static int
{
return (EPERM);
return (EBUSY);
/*
* Initialize vfs fields
*/
do {
} while (vfs_devismounted(dev));
/*
* Create root
*/
return (0);
}
static int
{
return (EPERM);
/*
* We do not currently support forced unmounts
*/
return (ENOTSUP);
/*
* We should never have a reference count of less than 2: one for the
* caller, one for the root vnode.
*/
/*
* Any active vnodes will result in a hold on the root vnode
*/
return (EBUSY);
/*
* Only allow an unmount iff there are no entries in memory.
*/
if (sharetab_size != 0) {
return (EBUSY);
}
/*
* Release the last hold on the root vnode
*/
return (0);
}
static int
{
return (0);
}
static int
{
int total = 1;
sizeof (sp->f_basetype));
return (0);
}
static const fs_operation_def_t sharefs_vfstops[] = {
{ NULL }
};