1 /* Copyright (c) 2003-2005, 2007 MySQL AB
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; version 2 of the License.
7 This program is distributed in the hope that it will be useful,
8 but WITHOUT ANY WARRANTY; without even the implied warranty of
9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 GNU General Public License for more details.
12 You should have received a copy of the GNU General Public License
13 along with this program; if not, write to the Free Software
14 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
19 #include "SignalData.hpp"
29 friend class NdbTransaction
;
41 friend bool printTCKEYCONF(FILE *, const Uint32
*, Uint32
, Uint16
);
47 STATIC_CONST( StaticLength
= 5 );
48 STATIC_CONST( OperationLength
= 2 );
49 STATIC_CONST( DirtyReadBit
= (((Uint32
)1) << 31) );
56 //-------------------------------------------------------------
57 // Unconditional part. First 5 words
58 //-------------------------------------------------------------
66 struct OperationConf
{
67 Uint32 apiOperationPtr
;
70 //-------------------------------------------------------------
71 // Operations confirmations,
72 // No of actually sent = getNoOfOperations(confInfo)
73 //-------------------------------------------------------------
74 OperationConf operations
[10];
77 * Get:ers for confInfo
79 static Uint32
getNoOfOperations(const Uint32
& confInfo
);
80 static Uint32
getCommitFlag(const Uint32
& confInfo
);
81 static bool getMarkerFlag(const Uint32
& confInfo
);
84 * Set:ers for confInfo
86 static void setCommitFlag(Uint32
& confInfo
, Uint8 flag
);
87 static void setNoOfOperations(Uint32
& confInfo
, Uint32 noOfOps
);
88 static void setMarkerFlag(Uint32
& confInfo
, Uint32 flag
);
93 TcKeyConf::getNoOfOperations(const Uint32
& confInfo
){
94 return confInfo
& 65535;
99 TcKeyConf::getCommitFlag(const Uint32
& confInfo
){
100 return ((confInfo
>> 16) & 1);
105 TcKeyConf::getMarkerFlag(const Uint32
& confInfo
){
106 const Uint32 bits
= 3 << 16; // Marker only valid when doing commit
107 return (confInfo
& bits
) == bits
;
112 TcKeyConf::setNoOfOperations(Uint32
& confInfo
, Uint32 noOfOps
){
113 ASSERT_MAX(noOfOps
, 65535, "TcKeyConf::setNoOfOperations");
114 confInfo
= (confInfo
& 0xFFFF0000) | noOfOps
;
119 TcKeyConf::setCommitFlag(Uint32
& confInfo
, Uint8 flag
){
120 ASSERT_BOOL(flag
, "TcKeyConf::setCommitFlag");
121 confInfo
|= (flag
<< 16);
126 TcKeyConf::setMarkerFlag(Uint32
& confInfo
, Uint32 flag
){
127 ASSERT_BOOL(flag
, "TcKeyConf::setMarkerFlag");
128 confInfo
|= (flag
<< 17);