namevno.c revision 8c81938120fb4fc785845e4215fd40d7242c8077
/*
* 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 (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* This file defines the vnode operations for mounted file descriptors.
* The routines in this file act as a layer between the NAMEFS file
* nm_getattr() and nm_access(), the routines simply apply the VOP operation
* to the vnode representing the file descriptor. This switches control
* to the underlying file system to which the file descriptor belongs.
*/
#include <sys/vfs_opreg.h>
/*
* Create a reference to the vnode representing the file descriptor.
* Then, apply the VOP_OPEN operation to that vnode.
*
* The vnode for the file descriptor may be switched under you.
* If it is, search the hash list for an nodep - nodep->nm_filevp
* pair. If it exists, return that nodep to the user.
* If it does not exist, create a new namenode to attach
* to the nodep->nm_filevp then place the pair on the hash list.
*
* file system, with the parent being the initial mount.
*/
int
{
int error = 0;
/*
* If the vnode is switched under us, the corresponding
* VN_RELE for this VN_HOLD will be done by the file system
* performing the switch. Otherwise, the corresponding
* VN_RELE will be done by nm_close().
*/
return (error);
}
/*
* See if the new filevp (outfilevp) is already associated
* with the mount point. If it is, then it already has a
* namenode associated with it.
*/
if ((newnamep =
goto gotit;
}
/*
* Insert the new namenode into the hash list.
*/
/*
* Release the above reference to the infilevp, the reference
* to the NAMEFS vnode, create a reference to the new vnode
* and return the new vnode to the user.
*/
}
return (0);
}
/*
* Close a mounted file descriptor.
* Remove any locks and apply the VOP_CLOSE operation to the vnode for
* the file descriptor.
*/
static int
{
int error = 0;
if (count == 1) {
/*
* Before VN_RELE() we need to remove the vnode from
* the hash table. We should only do so in the NMNMNT case.
* In other cases, nodep->nm_filep keeps a reference
* to nm_filevp and the entry in the hash table doesn't
* hurt.
*/
}
}
return (error);
}
static int
{
}
static int
{
}
static int
{
}
/*
* Return in vap the attributes that are stored in the namenode
* structure. Only the size is taken from the mounted object.
*/
/* ARGSUSED */
static int
{
int error;
return (error);
}
return (0);
}
/*
* Standard access() like check. Figure out which mode bits apply
* to the caller then pass the missing mode bits to the secpolicy function.
*/
static int
{
int shift = 0;
shift += 3;
shift += 3;
}
if (mode == 0)
return (0);
}
/*
* Set the attributes of the namenode from the attributes in vap.
*/
/* ARGSUSED */
static int
int flags,
{
int error = 0;
/*
* Cannot set these attributes.
*/
return (EINVAL);
/*
* descriptor.
*/
if (error)
goto out;
/*
* If request to change mode, copy new
* mode into existing attribute structure.
*/
/*
* If request was to change user or group, turn off suid and sgid
* bits.
* If the system was configured with the "rstchown" option, the
* owner is not permitted to give away the file, and can change
* the group id only to a group of which he or she is a member.
*/
/*
* If request is to modify times, make sure user has write
* permissions on the file.
*/
}
out:
return (error);
}
/*
* Check mode permission on the namenode. First nm_access_unlocked()
* checks the bits on the name node, then an access check is performed
* on the underlying file.
*/
/* ARGSUSED */
static int
{
int error;
if (error == 0)
else
return (error);
}
/*
* We can get here if a creat or open with O_CREAT is done on a namefs
* mount point, for example, as the object of a shell output redirection to
* the mount point.
*/
/*ARGSUSED*/
static int
{
int error;
return (error);
return (0);
}
return (EEXIST);
}
/*
* Links are not allowed on mounted file descriptors.
*/
/*ARGSUSED*/
static int
{
return (EXDEV);
}
static int
{
}
/* Free the namenode */
/* ARGSUSED */
static void
{
return;
}
}
vn_invalid(vp);
}
static int
{
}
static int
{
}
static void
{
}
static int
{
}
/*
* Return the vnode representing the file descriptor in vpp.
*/
static int
{
return (0);
}
static int
{
}
struct vnodeops *nm_vnodeops;
const fs_operation_def_t nm_vnodeops_template[] = {
};