fs_subr.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Generic vnode operations.
*/
/*
* The associated operation is not supported by the file system.
*/
int
fs_nosys()
{
return (ENOSYS);
}
/*
* The associated operation is invalid (on this vnode).
*/
int
fs_inval()
{
return (EINVAL);
}
/*
* The associated operation is valid only for directories.
*/
int
{
return (ENOTDIR);
}
/*
* Free the file system specific resources. For the file systems that
* do not support the forced unmount, it will be a nop function.
*/
/*ARGSUSED*/
void
{
}
/* ARGSUSED */
int
{
return (ENOSYS);
}
/* ARGSUSED */
int
{
return (ENOSYS);
}
/* ARGSUSED */
int
register short events,
int anyyet,
register short *reventsp,
{
return (ENOSYS);
}
/*
* The file system has nothing to sync to disk. However, the
* VFS_SYNC operation must not fail.
*/
/* ARGSUSED */
int
{
return (0);
}
/*
*/
/* ARGSUSED */
int
{
return (-1);
}
/* ARGSUSED */
void
{
}
/*
* Compare two vnodes.
*/
int
{
}
/*
* No-op seek operation.
*/
/* ARGSUSED */
int
{
}
/*
* File and record locking.
*/
/* ARGSUSED */
int
{
int frcmd;
int nlmid;
int error = 0;
int serialize = 0;
switch (cmd) {
case F_GETLK:
case F_O_GETLK:
if (flag & F_REMOTELOCK) {
break;
}
if (flag & F_PXFSLOCK) {
break;
}
frcmd = 0;
break;
case F_SETLK_NBMAND:
/*
* Are NBMAND locks allowed on this file?
*/
goto done;
}
goto done;
}
/*FALLTHROUGH*/
case F_SETLK:
/*
* Check whether there is an NBMAND share reservation that
* conflicts with the lock request.
*/
if (nbl_need_check(vp)) {
serialize = 1;
goto done;
}
}
if (flag & F_REMOTELOCK) {
break;
}
if (flag & F_PXFSLOCK) {
break;
}
if (cmd == F_SETLK_NBMAND &&
/* would check here for conflict with mapped region */
}
break;
case F_SETLKW:
/*
* If there is an NBMAND share reservation that conflicts
* with the lock request, block until the conflicting share
* reservation goes away.
*/
if (nbl_need_check(vp)) {
serialize = 1;
if (error != 0)
goto done;
}
}
if (flag & F_REMOTELOCK) {
break;
}
if (flag & F_PXFSLOCK) {
break;
}
break;
case F_HASREMOTELOCKS:
if (nlmid != 0) { /* booted as a cluster */
} else { /* not booted as a cluster */
}
goto done;
default:
goto done;
}
/*
* If this is a blocking lock request and we're serializing lock
* requests, modify the callback list to leave the critical region
* while we're waiting for the lock.
*/
}
done:
if (serialize)
return (error);
}
/*
* Callback when a lock request blocks and we are serializing requests. If
* before sleeping, leave the critical region. If after wakeup, reenter
* the critical region.
*/
static callb_cpr_t *
{
if (when == FLK_BEFORE_SLEEP)
else {
}
return (NULL);
}
/*
* Allow any flags.
*/
/* ARGSUSED */
int
{
return (0);
}
/*
* Return the answer requested to poll() for non-device files.
* Only POLLIN, POLLRDNORM, and POLLOUT are recognized.
*/
/* ARGSUSED */
int
register short events,
int anyyet,
register short *reventsp,
{
*reventsp = 0;
if (events & POLLRDNORM)
*reventsp |= POLLRDNORM;
if (events & POLLRDBAND)
*reventsp |= POLLRDBAND;
if (events & POLLWRBAND)
*reventsp |= POLLWRBAND;
return (0);
}
/*
* POSIX pathconf() support.
*/
/* ARGSUSED */
int
{
register int error = 0;
switch (cmd) {
case _PC_LINK_MAX:
break;
case _PC_MAX_CANON:
break;
case _PC_MAX_INPUT:
break;
case _PC_NAME_MAX:
break;
break;
case _PC_PATH_MAX:
case _PC_SYMLINK_MAX:
val = MAXPATHLEN;
break;
case _PC_PIPE_BUF:
break;
case _PC_NO_TRUNC:
else
break;
case _PC_VDISABLE:
break;
case _PC_CHOWN_RESTRICTED:
if (rstchown)
else
break;
case _PC_FILESIZEBITS:
/*
* If ever we come here it means that underlying file system
* does not recognise the command and therefore this
* configurable limit cannot be determined. We return -1
* and don't change errno.
*/
break;
case _PC_ACL_ENABLED:
val = 0;
break;
default:
break;
}
if (error == 0)
return (error);
}
/*
* Dispose of a page.
*/
/* ARGSUSED */
void
{
else
}
/* ARGSUSED */
void
{
}
/*
* fabricate acls for file systems that do not support acls.
*/
/* ARGSUSED */
int
int flag;
{
int error;
vsecattr->vsa_aclcnt = 0;
KM_SLEEP);
return (error);
aclentp++;
aclentp++;
aclentp++;
}
return (0);
}
/*
* Common code for implementing DOS share reservations
*/
/* ARGSUSED4 */
int
{
int error;
/*
* Make sure that the file was opened with permissions appropriate
* for the request, and make sure the caller isn't trying to sneak
* in an NBMAND request.
*/
return (EBADF);
return (EINVAL);
}
if (cmd == F_SHARE_NBMAND) {
/* must have write permission to deny read access */
return (EBADF);
/* make sure nbmand is allowed on the file */
return (EINVAL);
}
return (EINVAL);
}
}
switch (cmd) {
case F_SHARE_NBMAND:
/*FALLTHROUGH*/
case F_SHARE:
break;
case F_UNSHARE:
break;
case F_HASREMOTELOCKS:
/*
* We are overloading this command to refer to remote
* shares as well as remote locks, despite its name.
*/
error = 0;
break;
default:
break;
}
return (error);
}
/*ARGSUSED1*/
int
{
return (ENOTSUP);
}
/*ARGSUSED1*/
int
{
return (0);
}