sdev_vfsops.c revision 3c5e027b0f15017d4b6afff01915ea70ae476223
/*
* 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 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* This is the /dev (hence, the sdev_ prefix) filesystem.
*/
#include <sys/sysmacros.h>
#include <sys/pathname.h>
#include <sys/vfs_opreg.h>
/*
* /dev vfs operations.
*/
/*
* globals
*/
/*
* static
*/
/* LINTED E_STATIC_UNUSED */ /* useful for debugging */
struct cred *);
static void sdev_insert_mntinfo(struct sdev_data *);
static int devinit(int, char *);
static vfsdef_t sdev_vfssw = {
"dev", /* type name string */
devinit, /* init routine */
VSW_CANREMOUNT, /* flags */
NULL /* mount options table prototype */
};
/*
* Module linkage information
*/
};
static struct modlinkage modlinkage = {
};
int
_init(void)
{
int e;
if ((e = mod_install(&modlinkage)) != 0) {
return (e);
}
return (0);
}
/*
* dev module remained loaded for the global /dev instance
*/
int
_fini(void)
{
return (EBUSY);
}
int
{
}
/*ARGSUSED*/
static int
{
static const fs_operation_def_t dev_vfsops_tbl[] = {
};
int error;
if (error != 0) {
return (error);
}
if (error != 0) {
(void) vfs_freevfsops_by_type(fstype);
return (error);
}
return (1);
}
/* initialize negative cache */
return (0);
}
/*
* Both mount point and backing store directory name are
* passed in from userland
*/
static int
{
int error = 0;
/*
* security check
*/
(secpolicy_sys_devices(cr) != 0))
return (EPERM);
/*
* Sanity check the mount point
*/
return (ENOTDIR);
/*
* Sanity Check for overlay mount.
*/
return (EBUSY);
}
/* copy in the arguments */
goto cleanup;
}
/*
* Sanity check the backing store
*/
if (args->sdev_attrdir) {
/* user supplied an attribute store */
"directory %s failed",
goto cleanup;
}
goto cleanup;
}
} else {
/* use mountp as the attribute store */
}
/*
* handling installation
*/
/*
* mark all existing sdev_nodes (except root node) stale
*/
sdev_stale(dv);
/* Reset previous mountargs */
if (sdev_data->sdev_mountargs) {
sizeof (struct sdev_mountargs));
}
goto cleanup; /* we're done */
}
/*
* Create and initialize the vfs-private data.
*/
while (vfs_devismounted(devdev)) {
/*
* All the minor numbers are used up.
*/
if (devminor == 0) {
goto cleanup;
}
}
/* get acl flavor from attribute dir */
if (!SDEV_IS_GLOBAL(dv)) {
} else {
}
if (args)
return (error);
}
/*
* unmounting the non-global /dev instances, e.g. when deleting a Kevlar zone.
*/
static int
{
int error;
/*
* enforce the security policies
*/
(secpolicy_sys_devices(cr) != 0))
return (EPERM);
return (ENOTSUP);
return (EBUSY);
}
/*
* global instance remains mounted
*/
if (SDEV_IS_GLOBAL(dv)) {
return (EBUSY);
}
/* verify the v_count */
return (error);
}
/* release hold on root node and destroy it */
sdev_nodedestroy(dv, 0);
/*
* XXX separate it into sdev_delete_mntinfo() if useful
*/
if (prev)
else
sdev_mntinfo = next;
if (next)
if (sdev_data->sdev_mountargs) {
sizeof (struct sdev_mountargs));
}
return (0);
}
/*
* return root vnode for given vfs
*/
static int
{
return (0);
}
/*
* return 'generic superblock' information to userland.
*
* not much that we can usefully admit to here
*/
static int
{
/* no illusions that blocks are relevant to devfs */
return (0);
}
static void
{
if (sdev_mntinfo) {
} else {
sdev_origins = data;
}
sdev_mntinfo = data;
}
struct sdev_data *
sdev_find_mntinfo(char *mntpt)
{
while (mntinfo) {
break;
}
}
return (mntinfo);
}
void
{
}