MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FsReadWriteReq.hpp
1 /*
2  Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; version 2 of the License.
7 
8  This program is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  GNU General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License
14  along with this program; if not, write to the Free Software
15  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
16 */
17 
18 #ifndef FS_READWRITEREQ_H
19 #define FS_READWRITEREQ_H
20 
21 #include "SignalData.hpp"
22 
37  friend class Ndbfs;
38  friend class VoidFs;
39  friend class AsyncFile;
40  friend class PosixAsyncFile; // FIXME
41  friend class Win32AsyncFile;
42 
46  friend class Dbdict;
47  friend class Lgman;
48  friend class Tsman;
49  friend class Pgman;
50  friend class Restore;
51  friend class Dblqh;
52 
56  friend bool printFSREADWRITEREQ(FILE * output, const Uint32 * theData, Uint32 len, Uint16 receiverBlockNo);
57 
58 public:
63  fsFormatListOfPairs=0,
64  fsFormatArrayOfPages=1,
65  fsFormatListOfMemPages=2,
66  fsFormatGlobalPage=3,
67  fsFormatSharedPage=4,
68  fsFormatMax
69  };
70 
74  STATIC_CONST( FixedLength = 6 );
75 
76 private:
77 
81  UintR filePointer; // DATA 0
82  UintR userReference; // DATA 1
83  UintR userPointer; // DATA 2
84  UintR operationFlag; // DATA 3
85  UintR varIndex; // DATA 4
86  UintR numberOfPages; // DATA 5
87 
88 //-------------------------------------------------------------
89 // Variable sized part. Those will contain
90 // info about memory/file pages to read/write
91 //-------------------------------------------------------------
92  union {
93  UintR pageData[16]; // DATA 6 - 21
94  struct {
95  Uint32 varIndex; // In unit cluster size
96  Uint32 fileOffset; // In unit page size
97  } listOfPair[8];
98  struct {
99  Uint32 varIndex;
100  Uint32 fileOffset;
101  } arrayOfPages;
102  struct {
103  Uint32 varIndex[1]; // Size = numberOfPages
104  Uint32 fileOffset;
105  } listOfMemPages;
106  } data;
107 
108  static Uint8 getSyncFlag(const UintR & opFlag);
109  static void setSyncFlag(UintR & opFlag, Uint8 flag);
110 
111  static NdbfsFormatType getFormatFlag(const UintR & opFlag);
112  static void setFormatFlag(UintR & opFlag, Uint8 flag);
113 
114  static Uint32 getPartialReadFlag(UintR opFlag);
115  static void setPartialReadFlag(UintR & opFlag, Uint32 flag);
116 };
117 
129 #define SYNC_SHIFT (4)
130 #define SYNC_MASK (0x01)
131 
132 #define FORMAT_MASK (0x0F)
133 
134 #define PARTIAL_READ_SHIFT (5)
135 
136 inline
137 Uint8
138 FsReadWriteReq::getSyncFlag(const UintR & opFlag){
139  return (Uint8)((opFlag >> SYNC_SHIFT) & SYNC_MASK);
140 }
141 
142 inline
144 FsReadWriteReq::getFormatFlag(const UintR & opFlag){
145  return (NdbfsFormatType)(opFlag & FORMAT_MASK);
146 }
147 
148 inline
149 void
150 FsReadWriteReq::setSyncFlag(UintR & opFlag, Uint8 flag){
151  ASSERT_BOOL(flag, "FsReadWriteReq::setSyncFlag");
152  opFlag |= (flag << SYNC_SHIFT);
153 }
154 
155 inline
156 void
157 FsReadWriteReq::setFormatFlag(UintR & opFlag, Uint8 flag){
158  ASSERT_MAX(flag, fsFormatMax, "FsReadWriteReq::setSyncFlag");
159  opFlag |= flag;
160 }
161 
162 inline
163 void
164 FsReadWriteReq::setPartialReadFlag(UintR & opFlag, Uint32 flag){
165  ASSERT_BOOL(flag, "FsReadWriteReq::setSyncFlag");
166  opFlag |= (flag << PARTIAL_READ_SHIFT);
167 }
168 
169 inline
170 Uint32
171 FsReadWriteReq::getPartialReadFlag(UintR opFlag){
172  return (opFlag >> PARTIAL_READ_SHIFT) & 1;
173 }
174 
176 {
177  UintR filePointer; // DATA 0
178  Uint32 milliseconds;
179 
180  STATIC_CONST(SignalLength = 2);
181 };
182 
183 #endif