6198 Let's EOL cachefs
[illumos-gate.git] / usr / src / uts / common / sys / nbmlock.h
blob6c9d5b8ebd48579cd0508f24fcb8b012843f7661
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
19 * CDDL HEADER END
22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
26 #ifndef _NBMLOCK_H
27 #define _NBMLOCK_H
30 * Non-blocking mandatory locking support.
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
37 #include <sys/vnode.h>
38 #include <sys/rwlock.h>
39 #include <sys/cred.h>
42 * Type of operation; used when checking for lock/share conflict.
43 * NBL_READWRITE is used for checking for a conflict with an exclusive lock
44 * (F_WRLCK) or a read-write mmap request. For checking an actual I/O
45 * request, use NBL_READ or NBL_WRITE.
47 typedef enum {NBL_READ, NBL_WRITE, NBL_RENAME, NBL_REMOVE,
48 NBL_READWRITE} nbl_op_t;
50 /* critical region primitives */
51 extern void nbl_start_crit(vnode_t *, krw_t);
52 extern void nbl_end_crit(vnode_t *);
53 extern int nbl_in_crit(vnode_t *);
55 /* conflict checking */
56 extern int nbl_need_check(vnode_t *);
57 extern int nbl_conflict(vnode_t *, nbl_op_t, u_offset_t, ssize_t, int,
58 caller_context_t *);
59 extern int nbl_share_conflict(vnode_t *, nbl_op_t, caller_context_t *);
60 extern int nbl_lock_conflict(vnode_t *, nbl_op_t, u_offset_t, ssize_t, int,
61 caller_context_t *);
62 extern int nbl_svmand(vnode_t *, cred_t *, int *);
65 #ifdef __cplusplus
67 #endif
69 #endif /* _NBMLOCK_H */