Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
0002 /******************************************************************************
0003 *******************************************************************************
0004 **
0005 **  Copyright (C) Sistina Software, Inc.  1997-2003  All rights reserved.
0006 **  Copyright (C) 2004-2007 Red Hat, Inc.  All rights reserved.
0007 **
0008 **  This copyrighted material is made available to anyone wishing to use,
0009 **  modify, copy, or redistribute it subject to the terms and conditions
0010 **  of the GNU General Public License v.2.
0011 **
0012 *******************************************************************************
0013 ******************************************************************************/
0014 
0015 #ifndef __DLMCONSTANTS_DOT_H__
0016 #define __DLMCONSTANTS_DOT_H__
0017 
0018 /*
0019  * Constants used by DLM interface.
0020  */
0021 
0022 #define DLM_LOCKSPACE_LEN       64
0023 #define DLM_RESNAME_MAXLEN      64
0024 
0025 
0026 /*
0027  * Lock Modes
0028  */
0029 
0030 #define DLM_LOCK_IV     (-1)    /* invalid */
0031 #define DLM_LOCK_NL     0   /* null */
0032 #define DLM_LOCK_CR     1   /* concurrent read */
0033 #define DLM_LOCK_CW     2   /* concurrent write */
0034 #define DLM_LOCK_PR     3   /* protected read */
0035 #define DLM_LOCK_PW     4   /* protected write */
0036 #define DLM_LOCK_EX     5   /* exclusive */
0037 
0038 
0039 /*
0040  * Flags to dlm_lock
0041  *
0042  * DLM_LKF_NOQUEUE
0043  *
0044  * Do not queue the lock request on the wait queue if it cannot be granted
0045  * immediately.  If the lock cannot be granted because of this flag, DLM will
0046  * either return -EAGAIN from the dlm_lock call or will return 0 from
0047  * dlm_lock and -EAGAIN in the lock status block when the AST is executed.
0048  *
0049  * DLM_LKF_CANCEL
0050  *
0051  * Used to cancel a pending lock request or conversion.  A converting lock is
0052  * returned to its previously granted mode.
0053  *
0054  * DLM_LKF_CONVERT
0055  *
0056  * Indicates a lock conversion request.  For conversions the name and namelen
0057  * are ignored and the lock ID in the LKSB is used to identify the lock.
0058  *
0059  * DLM_LKF_VALBLK
0060  *
0061  * Requests DLM to return the current contents of the lock value block in the
0062  * lock status block.  When this flag is set in a lock conversion from PW or EX
0063  * modes, DLM assigns the value specified in the lock status block to the lock
0064  * value block of the lock resource.  The LVB is a DLM_LVB_LEN size array
0065  * containing application-specific information.
0066  *
0067  * DLM_LKF_QUECVT
0068  *
0069  * Force a conversion request to be queued, even if it is compatible with
0070  * the granted modes of other locks on the same resource.
0071  *
0072  * DLM_LKF_IVVALBLK
0073  *
0074  * Invalidate the lock value block.
0075  *
0076  * DLM_LKF_CONVDEADLK
0077  *
0078  * Allows the dlm to resolve conversion deadlocks internally by demoting the
0079  * granted mode of a converting lock to NL.  The DLM_SBF_DEMOTED flag is
0080  * returned for a conversion that's been effected by this.
0081  *
0082  * DLM_LKF_PERSISTENT
0083  *
0084  * Only relevant to locks originating in userspace.  A persistent lock will not
0085  * be removed if the process holding the lock exits.
0086  *
0087  * DLM_LKF_NODLCKWT
0088  *
0089  * Do not cancel the lock if it gets into conversion deadlock.
0090  * Exclude this lock from being monitored due to DLM_LSFL_TIMEWARN.
0091  *
0092  * DLM_LKF_NODLCKBLK
0093  *
0094  * net yet implemented
0095  *
0096  * DLM_LKF_EXPEDITE
0097  *
0098  * Used only with new requests for NL mode locks.  Tells the lock manager
0099  * to grant the lock, ignoring other locks in convert and wait queues.
0100  *
0101  * DLM_LKF_NOQUEUEBAST
0102  *
0103  * Send blocking AST's before returning -EAGAIN to the caller.  It is only
0104  * used along with the NOQUEUE flag.  Blocking AST's are not sent for failed
0105  * NOQUEUE requests otherwise.
0106  *
0107  * DLM_LKF_HEADQUE
0108  *
0109  * Add a lock to the head of the convert or wait queue rather than the tail.
0110  *
0111  * DLM_LKF_NOORDER
0112  *
0113  * Disregard the standard grant order rules and grant a lock as soon as it
0114  * is compatible with other granted locks.
0115  *
0116  * DLM_LKF_ORPHAN
0117  *
0118  * Acquire an orphan lock.
0119  *
0120  * DLM_LKF_ALTPR
0121  *
0122  * If the requested mode cannot be granted immediately, try to grant the lock
0123  * in PR mode instead.  If this alternate mode is granted instead of the
0124  * requested mode, DLM_SBF_ALTMODE is returned in the lksb.
0125  *
0126  * DLM_LKF_ALTCW
0127  *
0128  * The same as ALTPR, but the alternate mode is CW.
0129  *
0130  * DLM_LKF_FORCEUNLOCK
0131  *
0132  * Unlock the lock even if it is converting or waiting or has sublocks.
0133  * Only really for use by the userland device.c code.
0134  *
0135  */
0136 
0137 #define DLM_LKF_NOQUEUE     0x00000001
0138 #define DLM_LKF_CANCEL      0x00000002
0139 #define DLM_LKF_CONVERT     0x00000004
0140 #define DLM_LKF_VALBLK      0x00000008
0141 #define DLM_LKF_QUECVT      0x00000010
0142 #define DLM_LKF_IVVALBLK    0x00000020
0143 #define DLM_LKF_CONVDEADLK  0x00000040
0144 #define DLM_LKF_PERSISTENT  0x00000080
0145 #define DLM_LKF_NODLCKWT    0x00000100
0146 #define DLM_LKF_NODLCKBLK   0x00000200
0147 #define DLM_LKF_EXPEDITE    0x00000400
0148 #define DLM_LKF_NOQUEUEBAST 0x00000800
0149 #define DLM_LKF_HEADQUE     0x00001000
0150 #define DLM_LKF_NOORDER     0x00002000
0151 #define DLM_LKF_ORPHAN      0x00004000
0152 #define DLM_LKF_ALTPR       0x00008000
0153 #define DLM_LKF_ALTCW       0x00010000
0154 #define DLM_LKF_FORCEUNLOCK 0x00020000
0155 #define DLM_LKF_TIMEOUT     0x00040000
0156 
0157 /*
0158  * Some return codes that are not in errno.h
0159  */
0160 
0161 #define DLM_ECANCEL     0x10001
0162 #define DLM_EUNLOCK     0x10002
0163 
0164 #endif  /* __DLMCONSTANTS_DOT_H__ */