lx_prvfsops.c revision aa59c4cb15a6ac5d4e585dadf7a055b580abf579
/*
* 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"
/*
* lxprvfsops.c: vfs operations for /lxprocfs.
*/
#include <sys/sysmacros.h>
#include <sys/vfs_opreg.h>
#include "lx_proc.h"
/* Module level parameters */
static int lxprocfstype;
static kmutex_t lxpr_mount_lock;
int nproc_highbit; /* highbit(v.v_nproc) */
static int lxpr_init(int, char *);
"lx_proc",
0,
};
/*
* Module linkage information for the kernel.
*/
};
static struct modlinkage modlinkage = {
};
int
_init(void)
{
return (mod_install(&modlinkage));
}
int
{
}
int
_fini(void)
{
int retval;
/*
* attempt to unload the module
*/
goto done;
/*
* destroy lxpr_node cache
*/
/*
* clean out the vfsops and vnodeops
*/
(void) vfs_freevfsops_by_type(lxprocfstype);
done:
return (retval);
}
static int
{
static const fs_operation_def_t lxpr_vfsops_template[] = {
};
extern const fs_operation_def_t lxpr_vnodeops_template[];
int error;
ASSERT(lxprocfstype != 0);
/*
* Associate VFS ops vector with this fstype.
*/
if (error != 0) {
return (error);
}
/*
* Set up vnode ops vector too.
*/
if (error != 0) {
(void) vfs_freevfsops_by_type(fstype);
return (error);
}
/*
* Assign a unique "device" number (used by stat(2)).
*/
dev = 0;
}
/*
* Make the pseudo device
*/
/*
* Initialise cache for lxpr_nodes
*/
return (0);
}
static int
{
int err;
/*
* must be root to mount
*/
return (EPERM);
/*
* mount point must be a directory
*/
return (ENOTDIR);
if (zone == global_zone) {
return (EBUSY);
}
/*
* Having the resource be anything but "lxproc" doesn't make sense
*/
return (err);
}
/*
* Ensure we don't allow overlaying mounts
*/
return (EBUSY);
}
/*
* allocate the first vnode
*/
/* Arbitrarily set the parent vnode to the mounted over directory */
/* Correctly set the fs for the root node */
return (0);
}
static int
{
int count;
/*
* must be root to unmount
*/
return (EPERM);
}
/*
* forced unmount is not supported by this file system
*/
return (ENOTSUP);
}
/*
* Ensure that no vnodes are in use on this mount point.
*/
if (count > 1) {
return (EBUSY);
}
/*
* purge the dnlc cache for vnode entries
* associated with this file system
*/
/*
* free up the lxprnode
*/
return (0);
}
static int
{
return (0);
}
static int
{
int n;
/* It is guaranteed that vsw_name will fit in f_basetype */
/* We know f_fstr is 32 chars */
return (0);
}