1/*****************************************************************************
2
3Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved.
4
5This program is free software; you can redistribute it and/or modify it under
6the terms of the GNU General Public License as published by the Free Software
7Foundation; version 2 of the License.
8
9This program is distributed in the hope that it will be useful, but WITHOUT
10ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12
13You should have received a copy of the GNU General Public License along with
14this program; if not, write to the Free Software Foundation, Inc.,
1551 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
16
17*****************************************************************************/
18
19/**************************************************//**
20@file include/lock0types.h
21The transaction lock system global types
22
23Created 5/7/1996 Heikki Tuuri
24*******************************************************/
25
26#include "ut0lst.h"
27
28#ifndef lock0types_h
29#define lock0types_h
30
31#define lock_t ib_lock_t
32
33struct lock_t;
34struct lock_table_t;
35
36/* Basic lock modes */
37enum lock_mode {
38 LOCK_IS = 0, /* intention shared */
39 LOCK_IX, /* intention exclusive */
40 LOCK_S, /* shared */
41 LOCK_X, /* exclusive */
42 LOCK_AUTO_INC, /* locks the auto-inc counter of a table
43 in an exclusive mode */
44 LOCK_NONE, /* this is used elsewhere to note consistent read */
45 LOCK_NUM = LOCK_NONE, /* number of lock modes */
46 LOCK_NONE_UNSET = 255
47};
48
49/** Convert the given enum value into string.
50@param[in] mode the lock mode
51@return human readable string of the given enum value */
52inline
53const char* lock_mode_string(enum lock_mode mode)
54{
55 switch (mode) {
56 case LOCK_IS:
57 return("LOCK_IS");
58 case LOCK_IX:
59 return("LOCK_IX");
60 case LOCK_S:
61 return("LOCK_S");
62 case LOCK_X:
63 return("LOCK_X");
64 case LOCK_AUTO_INC:
65 return("LOCK_AUTO_INC");
66 case LOCK_NONE:
67 return("LOCK_NONE");
68 case LOCK_NONE_UNSET:
69 return("LOCK_NONE_UNSET");
70 default:
71 ut_error;
72 }
73}
74
75typedef UT_LIST_BASE_NODE_T(lock_t) trx_lock_list_t;
76
77#endif /* lock0types_h */
78