1/*****************************************************************************
2
3Copyright (c) 2007, 2009, Oracle and/or its affiliates. All Rights Reserved.
4
5This program is free software; you can redistribute it and/or modify
6it under the terms of the GNU General Public License, version 2.0,
7as published by the Free Software Foundation.
8
9This program is also distributed with certain software (including
10but not limited to OpenSSL) that is licensed under separate terms,
11as designated in a particular file or component or in included license
12documentation.  The authors of MySQL hereby grant you an additional
13permission to link the program and your derivative works with the
14separately licensed software that they have included with MySQL.
15
16This program is distributed in the hope that it will be useful,
17but WITHOUT ANY WARRANTY; without even the implied warranty of
18MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19GNU General Public License, version 2.0, for more details.
20
21You should have received a copy of the GNU General Public License along with
22this program; if not, write to the Free Software Foundation, Inc.,
2351 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
24
25*****************************************************************************/
26
27/**************************************************//**
28@file include/lock0priv.ic
29Lock module internal inline methods.
30
31Created July 16, 2007 Vasil Dimov
32*******************************************************/
33
34/* This file contains only methods which are used in
35lock/lock0* files, other than lock/lock0lock.cc.
36I.e. lock/lock0lock.cc contains more internal inline
37methods but they are used only in that file. */
38
39#ifndef LOCK_MODULE_IMPLEMENTATION
40#error Do not include lock0priv.ic outside of the lock/ module
41#endif
42
43/*********************************************************************//**
44Gets the type of a lock.
45@return	LOCK_TABLE or LOCK_REC */
46UNIV_INLINE
47ulint
48lock_get_type_low(
49/*==============*/
50	const lock_t*	lock)	/*!< in: lock */
51{
52	ut_ad(lock);
53
54	return(lock->type_mode & LOCK_TYPE_MASK);
55}
56
57/*********************************************************************//**
58Checks if some transaction has an implicit x-lock on a record in a clustered
59index.
60@return	transaction id of the transaction which has the x-lock, or 0 */
61UNIV_INLINE
62trx_id_t
63lock_clust_rec_some_has_impl(
64/*=========================*/
65	const rec_t*		rec,	/*!< in: user record */
66	const dict_index_t*	index,	/*!< in: clustered index */
67	const ulint*		offsets)/*!< in: rec_get_offsets(rec, index) */
68{
69	ut_ad(dict_index_is_clust(index));
70	ut_ad(page_rec_is_user_rec(rec));
71
72	return(row_get_rec_trx_id(rec, index, offsets));
73}
74
75/* vim: set filetype=c: */
76