nbmlock.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) 2001 by Sun Microsystems, Inc.
* All rights reserved.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Utility routines and top-level conflict detection code for NBMAND
* locks.
*/
/*
* requests. "mode" specifies whether the caller intends to update
*/
void
{
}
/*
* Leave the critical region.
*/
void
{
}
/*
* Return non-zero if some thread is in the critical region.
* Note that this is appropriate for use in ASSERT()s only.
*/
int
{
}
/*
* Return the nbl_op_t that corresponds to the given lock type (read or
* write).
*/
nbl_lock_to_op(int lock_type)
{
int level;
switch (lock_type) {
case F_WRLCK:
return (NBL_READWRITE);
case F_RDLCK:
return (NBL_READ);
default:
#ifdef DEBUG
#else
#endif
return (NBL_WRITE); /* pick something restrictive */
}
/*NOTREACHED*/
}
/*
* Returns non-zero if we need to look further for an NBMAND lock or
* share conflict.
*/
int
{
/*
* the filesystem. An option for the future would be to have a
* flag on the vnode, though the locking for that can get tricky.
*/
}
/*
* Top-level conflict detection routine. The arguments describe the
* operation that is being attempted. If the operation conflicts with an
* existing lock or share reservation, a non-zero value is returned. If
* the operation is allowed, zero is returned. Note that there is an
* implicit argument, which is the process ID of the requester.
*
* svmand indicates that the file has System V mandatory locking enabled,
* so we should look at all record locks, not just NBMAND record locks.
* (This is to avoid a deadlock between a process making an I/O request and
* a process trying to release a lock. Instead of letting the first
* process block in the filesystem code, we flag a conflict here.)
*/
int
int svmand) /* System V mandatory locking */
{
return (1);
}
/*
* If this is not an I/O request, there's no need to check against
* the locks on the file.
*/
return (0);
}
/*
* Determine if the given file has mode bits for System V mandatory locks.
* If there was an error, the errno value is returned. Otherwise, zero is
* returned and *svp is set appropriately (non-zero for mandatory locks,
* zero for no mandatory locks).
*/
int
{
int error;
if (error != 0)
return (error);
return (0);
}